On Thu, 25 Mar 2010, Jan Engelhardt wrote:

> Hi,
> 
> 
> The following spatch would change the function signature of
> checkentry functions in Netfilter/Xtables from bool to int. However,
> spatch only considers singular "struct xt_match ops" and misses out
> on net/netfilter/xt_tcpudp.c's use of "struct xt_match ops[]". Is a
> different syntax needed in this case?

You can also declare a metavariable as:

struct xt_match[] ops;

Your rule1 actually matches the case where there is a pointer, and where 
there is a top-level xt_match structure, due to the isomorphisms.  You can 
see this by giving the option -parse_cocci and the semantic patch file.  
Unfortunately the array case doesn't seem to expand in this way.  I'm 
not sure if there is a general way to capture an array of structures.

julia
 
> // <smpl>
> @ rule1 @
> struct xt_match ops;
> identifier check;
> @@
>  ops.checkentry = check;
> 
> @@
> type bool;
> identifier rule1.check;
> @@
> -bool check
> +int check
>  (...){...}
> // </smpl>
> 
> 
> thanks,
> Jan
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to