[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 3 Mar 2012 13:10:59 +0100 (CET)
From: Julia Lawall <julia.lawall@...6.fr>
To: Stephen Boyd <sboyd@...eaurora.org>
cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Julia Lawall <Julia.Lawall@...6.fr>
Subject: Re: [PATCH 2/2] coccinelle: semantic patch for simple_open()
On Sat, 3 Mar 2012, Stephen Boyd wrote:
> Find instances of an open-coded simple_open() and replace them
> with calls to simple_open().
>
> Cc: Julia Lawall <Julia.Lawall@...6.fr>
> Signed-off-by: Stephen Boyd <sboyd@...eaurora.org>
> ---
>
> This seems to eat the definition of simple_open() as well. Is there
> a way to say only remove both the function and the reference to
> the function so that libfs survives?
Try identifier open_f != simple_open;
Is there a header file that should be present?
Your transformation rules should include depends on patch in the very
first line, after the rule name.
Can you make a report rule? If not, I will do it. Someone asked for that
to always be present.
thanks,
julia
> scripts/coccinelle/api/simple_open.cocci | 34 ++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
> create mode 100644 scripts/coccinelle/api/simple_open.cocci
>
> diff --git a/scripts/coccinelle/api/simple_open.cocci b/scripts/coccinelle/api/simple_open.cocci
> new file mode 100644
> index 0000000..956d04d
> --- /dev/null
> +++ b/scripts/coccinelle/api/simple_open.cocci
> @@ -0,0 +1,34 @@
> +// This removes an open coded simple_open() function
> +// and replaces file operations references to the function
> +// with simple_open() instead.
> +//
> +
> +virtual patch
> +virtual context
> +
> +@ open @
> +identifier open_f;
> +identifier i, f;
> +@@
> +-int open_f(struct inode *i, struct file *f)
> +-{
> +(
> +-if (i->i_private)
> +-f->private_data = i->i_private;
> +|
> +-f->private_data = i->i_private;
> +)
> +-return 0;
> +-}
> +
> +@ has_open depends on open @
> +identifier fops;
> +identifier open.open_f;
> +@@
> +struct file_operations fops = {
> +...
> +-.open = open_f,
> ++.open = simple_open,
> +...
> +};
> +
> --
> Sent by an employee of the Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists