From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032320AbdAJTud (ORCPT ); Tue, 10 Jan 2017 14:50:33 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33086 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761962AbdAJTub (ORCPT ); Tue, 10 Jan 2017 14:50:31 -0500 From: Bhumika Goyal To: julia.lawall@lip6.fr, eparis@parisplace.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] notify: constify fsnotify_ops structures Date: Wed, 11 Jan 2017 01:20:13 +0530 Message-Id: <1484077813-27542-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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