From: Stephen Boyd <sboyd@codeaurora.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 2/2] coccinelle: semantic patch for simple_open()
Date: Tue, 06 Mar 2012 00:43:57 -0800 [thread overview]
Message-ID: <4F55CE4D.9090408@codeaurora.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1203031307080.1780@hadrien>
On 03/03/12 04:10, Julia Lawall wrote:
>
>
> 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@lip6.fr>
>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.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;
Ah thanks. That works.
>
> Is there a header file that should be present?
It would be <include/fs.h> which should already be there if there is a
file_operations structure.
>
> 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.
I tried but failed. I get:
nit_defs_builtins: /usr/share/coccinelle/standard.h
between: p start 15 p end 15 m1 start 15 m1 end 15 m2 start 15 m2 end 15
-int -open:open_f-struct -inode -*-open:i-, -struct -file -*-open:f
Fatal error: exception Failure("The semantic patch is structured in a
way that may give bad results with isomorphisms. Please try to rewrite
it by moving + code out from -/context terms.")
When I add this:
@r1 depends on org || report @
identifier open_f != simple_open;
identifier i, f;
position p1;
@@
int open_f@p1(struct inode *i, struct file *f)
{
(
if (i->i_private)
f->private_data = i->i_private;
|
f->private_data = i->i_private;
)
return 0;
}
@script:python depends on org@
p1 << r1.p1;
@@
cocci.print_main("extra function",p1)
Any ideas what's wrong?
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
prev parent reply other threads:[~2012-03-06 8:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-03 10:06 [PATCH 0/2] Introduce simple_open() Stephen Boyd
2012-03-03 10:06 ` [PATCH 1/2] libfs: Add simple_open() Stephen Boyd
2012-03-03 10:06 ` [PATCH 2/2] coccinelle: semantic patch for simple_open() Stephen Boyd
2012-03-03 12:10 ` Julia Lawall
2012-03-06 8:43 ` Stephen Boyd [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F55CE4D.9090408@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.