diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-05-06 15:22:35 -0400 |
---|---|---|
committer | Eric Sandeen <sandeen@sandeen.net> | 2022-05-06 15:22:35 -0400 |
commit | f040050e37cd905b2437b74eb69693908d0a7907 (patch) | |
tree | 0c5478622342b8ada4a7c0970fe115384b63e16d | |
parent | c331b65484d5500ab39073c49aae193e5879a12d (diff) | |
download | xfsprogs-dev-f040050e37cd905b2437b74eb69693908d0a7907.tar.gz |
xfs: constify xfs_name_dotdot
Source kernel commit: 744e6c8ada5d612353a42ce8cd8323dd2364a70d
The symbol xfs_name_dotdot is a global variable that the xfs codebase
uses here and there to look up directory dotdot entries. Currently it's
a non-const variable, which means that it's a mutable global variable.
So far nobody's abused this to cause problems, but let's use the
compiler to enforce that.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r-- | libxfs/xfs_dir2.c | 6 | ||||
-rw-r--r-- | libxfs/xfs_dir2.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index 36956e547a..9018cc09c7 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -18,7 +18,11 @@ #include "xfs_errortag.h" #include "xfs_trace.h" -struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR }; +const struct xfs_name xfs_name_dotdot = { + .name = (const unsigned char *)"..", + .len = 2, + .type = XFS_DIR3_FT_DIR, +}; /* * Convert inode mode to directory entry filetype diff --git a/libxfs/xfs_dir2.h b/libxfs/xfs_dir2.h index 55e0557000..b6df3c34b2 100644 --- a/libxfs/xfs_dir2.h +++ b/libxfs/xfs_dir2.h @@ -21,7 +21,7 @@ struct xfs_dir2_data_unused; struct xfs_dir3_icfree_hdr; struct xfs_dir3_icleaf_hdr; -extern struct xfs_name xfs_name_dotdot; +extern const struct xfs_name xfs_name_dotdot; /* * Convert inode mode to directory entry filetype |