From: johannes@sipsolutions.net (Johannes Berg)
To: cocci@systeme.lip6.fr
Subject: [Cocci] modifying array initializers?
Date: Fri, 21 Apr 2017 23:19:32 +0200 [thread overview]
Message-ID: <1492809572.24783.1.camel@sipsolutions.net> (raw)
In-Reply-To: <alpine.DEB.2.20.1704212131230.3038@hadrien>
> > Sounds like it doesn't like to add multiple things here, let me
> > think about how to work around that.
>
> If you don't find a solution, send back the rule and the code that
> causes trouble, and I will take a look.
I tried for a while now, but didn't find one. I think the problem is
that it's evaluating all of these things at once, and then it doesn't
know how to place two of the new wrap_fn functions when they both
should go before nl80211_ops[].
The code is net/wireless/n80211.c, and my current version of the
spatch, as you suggested, is this:
@@
identifier fn;
fresh identifier wrap_fn = "_wrap_" ## fn;
@@
+static int wrap_fn(struct sk_buff *skb, struct genl_info *info)
+{
+ return fn(skb, info);
+}
+
static struct genl_ops nl80211_ops[] = {
...,
{
- .doit = fn,
+ .doit = wrap_fn,
...
},
...
};
It *does* work to match multiple .doit instances now, but it seems to
get confused when trying to place more than one wrap_fn right before
nl80211_ops[].
I tried pulling it out into a separate rule, attaching it to some other
token, e.g. after nl80211_post_doit(), but I can't seem to get that to
work.
johannes
next prev parent reply other threads:[~2017-04-21 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 13:12 [Cocci] modifying array initializers? Johannes Berg
2017-04-21 14:07 ` Julia Lawall
2017-04-21 18:53 ` Johannes Berg
2017-04-21 19:32 ` Julia Lawall
2017-04-21 21:19 ` Johannes Berg [this message]
2017-04-21 21:22 ` Julia Lawall
2017-04-21 21:24 ` Johannes Berg
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=1492809572.24783.1.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=cocci@systeme.lip6.fr \
/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.