On Thu, 1 Apr 2010, Wolfram Sang wrote:

> On Wed, Mar 31, 2010 at 09:55:55PM +0200, Julia Lawall wrote:
> > On Wed, 31 Mar 2010, Frederic Weisbecker wrote:
> > 
> > > Hi,
> > > 
> > > I'm trying to fetch all declarations of a variable of a given
> > > type and patch one of its field assignment.
> > > 
> > > In this particular case, I want to do this:
> > > 
> > > struct file_operations foo = {
> > >   .....
> > > - .ioctl = blah,
> > > + .unlocked_ioctl = blah,
> > >   .....
> > > };
> > 
> > Make the script as above, but with just three dots each time, instead of 
> > five.
> 
> Why is that? I thought isomorphism will handle that as placement of struct
> members can be random anyhow? Even more, the original patch works fine for me:
> 
> HANDLING: drivers/sbus/char/openprom.c
> diff = 
> diff -u -p a/openprom.c b/openprom.c
> --- a/openprom.c 2010-03-31 15:28:17.000000000 +0200
> +++ b/openprom.c 2010-04-01 04:31:46.000000000 +0200
> @@ -709,7 +709,7 @@ static int openprom_release(struct inode
>  static const struct file_operations openprom_fops = {
>       .owner =        THIS_MODULE,
>       .llseek =       no_llseek,
> -     .ioctl =        openprom_ioctl,
> +     .unlocked_ioctl = openprom_ioctl,
>       .compat_ioctl = openprom_compat_ioctl,
>       .open =         openprom_open,
>       .release =      openprom_release,
> 
> '-parse_cocci' will also give me the same output with and without the '...'?
> (using coccinelle 0.2.2 with its standard.h and .iso files)

Good point.  I get confused between structure declarations, where the ... 
are needed, because you might like to specify that the structure has only 
one field, and structure initializations, where the dots are not needed 
because the program is not obliged to initialize all of the fields.  So it 
is correct that there should be no need for the ...  Frederic, perhaps you 
could try your original patch again and see if there was some other reason 
why it did not work?

thanks,
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to