[Cocci] Having rules span multiple files

Luis R. Rodriguez mcgrof at kernel.org
Wed Nov 29 22:49:40 CET 2017

On Wed, Nov 29, 2017 at 10:21:00PM +0100, Michael Stefaniuc wrote:
> On 11/29/2017 09:58 PM, Luis R. Rodriguez wrote:
> > I've recently implemented support for a functionality which would allow us
> > to remove freezing calls on kthreads on filesystems *iff* the filesystem
> > implements support for filesystem freezing, this can be determined if
> > the filesystem implements the fs_freeze superblock callback. So the below
> > rule looks for the callback first, then looks to see if it has a kthread
> > implemented, and finally on the kthread fn, it removes any freeze calls.
> > This works quite nice on a filesystem where there is a match for all
> > the above in one file, for example fs/ext4/super.c, however it doesn't
> > work when say the fs_freeze is one file, and the kthread on another.
> > 
> > How could I get the rules to span multiple files?
> You mean treat multiple .c files as a single compilation unit?
> Just pass all those files together on the command line:
> spatch foo.c bar.c
> or
> spatch fs/ext4/*.c

Neat that works, thanks!


More information about the Cocci mailing list