]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
fs: xfs: libxfs: constify xfs_nameops structures
authorBhumika Goyal <bhumirks@gmail.com>
Tue, 10 Jan 2017 02:18:48 +0000 (20:18 -0600)
committerEric Sandeen <sandeen@redhat.com>
Tue, 10 Jan 2017 02:18:48 +0000 (20:18 -0600)
commitb6b86724ee5f3d8239cfdbd943f692c05e25a91b
tree4b8b7dccb129667269b0551612fbd2038eb612c6
parentf0d92f0494a28c6dcdad9e41aaffcfa6b8665739
fs: xfs: libxfs: constify xfs_nameops structures

Source kernel commit: cf7841c12d85d1fe0ad33fb8bc5746809a882010

Declare the structure xfs_nameops as const as it is only stored in the
m_dirnameops field of a xfs_mount structure. This field is of type
const struct xfs_nameops *, so xfs_nameops structures having this
property can be declared as const.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct xfs_nameops i@p = {...};

@ok1@
identifier r1.i;
position p;
struct xfs_mount mp;
@@
mp.m_dirnameops=&i@p

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

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct xfs_nameops i={...};

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

File size before:
text    data     bss     dec     hex filename
5302      85       0    5387    150b fs/xfs/libxfs/xfs_dir2.o

File size after:
text    data     bss     dec     hex filename
5318      69       0    5387    150b fs/xfs/libxfs/xfs_dir2.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_dir2.c