mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bhumika Goyal <bhumirks@gmail.com>
To: julia.lawall@lip6.fr, eparis@parisplace.org,
	linux-kernel@vger.kernel.org
Cc: Bhumika Goyal <bhumirks@gmail.com>
Subject: [PATCH] notify: constify fsnotify_ops structures
Date: Wed, 11 Jan 2017 01:20:13 +0530	[thread overview]
Message-ID: <1484077813-27542-1-git-send-email-bhumirks@gmail.com> (raw)

Declare fsnotify_ops structures as const as they are only passed as an
argument to the function fsnotify_alloc_group. This argument is of type
const, so fsnotify_ops structures having the same property can be
declared const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct fsnotify_ops i@p={...};

@ok1@
identifier r1.i;
position p;
@@
fsnotify_alloc_group(&i@p)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct fsnotify_ops i;

File size before: fs/notify/dnotify/dnotify.o
   text	   data	    bss	    dec	    hex	filename
   2227	     71	      0	   2298	    8fa	fs/notify/dnotify/dnotify.o

File size after: fs/notify/dnotify/dnotify.o
   text	   data	    bss	    dec	    hex	filename
   2259	     39	      0	   2298	    8fa	fs/notify/dnotify/dnotify.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 fs/notify/dnotify/dnotify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 5a4ec30..33aea5d 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -136,7 +136,7 @@ static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
 	kmem_cache_free(dnotify_mark_cache, dn_mark);
 }
 
-static struct fsnotify_ops dnotify_fsnotify_ops = {
+static const struct fsnotify_ops dnotify_fsnotify_ops = {
 	.handle_event = dnotify_handle_event,
 };
 
-- 
1.9.1

                 reply	other threads:[~2017-01-10 19:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1484077813-27542-1-git-send-email-bhumirks@gmail.com \
    --to=bhumirks@gmail.com \
    --cc=eparis@parisplace.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®