]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: constify xfs_name_dotdot
authorDarrick J. Wong <djwong@kernel.org>
Fri, 6 May 2022 19:22:35 +0000 (15:22 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 6 May 2022 19:22:35 +0000 (15:22 -0400)
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>
libxfs/xfs_dir2.c
libxfs/xfs_dir2.h

index 36956e547a92bdc4570d62e6f13d37f1e96da6f8..9018cc09c7c853770462f7dfc230412f2ffd4986 100644 (file)
 #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
index 55e0557000db5e027d87e98e999fe7480a512af6..b6df3c34b26afb8a703aece814770a283619915b 100644 (file)
@@ -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