cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fs: dlm: lockspace: constify kset_uevent_ops structures
Date: Thu, 27 Oct 2016 22:07:40 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1610272207050.1936@hadrien> (raw)
In-Reply-To: <1477592474-18513-1-git-send-email-bhumirks@gmail.com>



On Thu, 27 Oct 2016, Bhumika Goyal wrote:

> Declare kset_uevent_ops structure as const as it is only passed as
> the second argument to the function kset_create_and_add. This
> argument is of type const struct kset_uevent_ops *, so kset_uevent_ops
> structures having this property can be declared const.
> Done using Coccinelle:
>
> @r1 disable optional_qualifier @
> identifier i;
> position p;
> @@
> static struct kset_uevent_ops i at p = {...};
>
> @ok1@
> identifier r1.i;
> position p;
> expression e1,e2;
> @@
> kset_create_and_add(e1,&i at p,e2)
>
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i at p
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> static
> +const
> struct kset_uevent_ops i={...};
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct kset_uevent_ops i;
>
> File size before:
>    text	   data	    bss	    dec	    hex	filename
>    8034	    528	    484	   9046	   2356	fs/dlm/lockspace.o
>
> File size after:
>    text	   data	    bss	    dec	    hex	filename
>    8050	    496	    484	   9030	   2346	fs/dlm/lockspace.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
>  fs/dlm/lockspace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
> index f3e7278..2ea1b77 100644
> --- a/fs/dlm/lockspace.c
> +++ b/fs/dlm/lockspace.c
> @@ -233,7 +233,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj,
>  	return 0;
>  }
>
> -static struct kset_uevent_ops dlm_uevent_ops = {
> +static const struct kset_uevent_ops dlm_uevent_ops = {
>  	.uevent = dlm_uevent,
>  };
>
> --
> 1.9.1
>
>



      reply	other threads:[~2016-10-27 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 18:21 [Cluster-devel] [PATCH] fs: dlm: lockspace: constify kset_uevent_ops structures Bhumika Goyal
2016-10-27 20:07 ` Julia Lawall [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=alpine.DEB.2.20.1610272207050.1936@hadrien \
    --to=julia.lawall@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).