]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: constify feature checks
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Feb 2025 18:21:56 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:16:00 +0000 (09:16 -0800)
Source kernel commit: 183d988ae9e7ada9d7d4333e2289256e74a5ab5b

They will eventually be needed to be const for zoned growfs, but even
now having such simpler helpers as const as possible is a good thing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
include/xfs_mount.h
libxfs/xfs_rtgroup.c

index efe7738bcb416a4a08abf2fb1930fe13e1aec0b3..383cba7d6e3fee676aefb1b9bdcf674f87c1cf14 100644 (file)
@@ -207,7 +207,7 @@ typedef struct xfs_mount {
 #define XFS_FEAT_METADIR       (1ULL << 28)    /* metadata directory tree */
 
 #define __XFS_HAS_FEAT(name, NAME) \
-static inline bool xfs_has_ ## name (struct xfs_mount *mp) \
+static inline bool xfs_has_ ## name (const struct xfs_mount *mp) \
 { \
        return mp->m_features & XFS_FEAT_ ## NAME; \
 }
@@ -253,25 +253,25 @@ __XFS_HAS_FEAT(exchange_range, EXCHANGE_RANGE)
 __XFS_HAS_FEAT(metadir, METADIR)
 
 
-static inline bool xfs_has_rtgroups(struct xfs_mount *mp)
+static inline bool xfs_has_rtgroups(const struct xfs_mount *mp)
 {
        /* all metadir file systems also allow rtgroups */
        return xfs_has_metadir(mp);
 }
 
-static inline bool xfs_has_rtsb(struct xfs_mount *mp)
+static inline bool xfs_has_rtsb(const struct xfs_mount *mp)
 {
        /* all rtgroups filesystems with an rt section have an rtsb */
        return xfs_has_rtgroups(mp) && xfs_has_realtime(mp);
 }
 
-static inline bool xfs_has_rtrmapbt(struct xfs_mount *mp)
+static inline bool xfs_has_rtrmapbt(const struct xfs_mount *mp)
 {
        return xfs_has_rtgroups(mp) && xfs_has_realtime(mp) &&
               xfs_has_rmapbt(mp);
 }
 
-static inline bool xfs_has_rtreflink(struct xfs_mount *mp)
+static inline bool xfs_has_rtreflink(const struct xfs_mount *mp)
 {
        return xfs_has_metadir(mp) && xfs_has_realtime(mp) &&
               xfs_has_reflink(mp);
@@ -279,7 +279,7 @@ static inline bool xfs_has_rtreflink(struct xfs_mount *mp)
 
 /* Kernel mount features that we don't support */
 #define __XFS_UNSUPP_FEAT(name) \
-static inline bool xfs_has_ ## name (struct xfs_mount *mp) \
+static inline bool xfs_has_ ## name (const struct xfs_mount *mp) \
 { \
        return false; \
 }
index ba1a38633a6eadc9368dcc13d1e12f4eabd2afa6..24fb160b806757e1da52aea2473fb6e81e611248 100644 (file)
@@ -335,7 +335,7 @@ struct xfs_rtginode_ops {
        unsigned int            fmt_mask; /* all valid data fork formats */
 
        /* Does the fs have this feature? */
-       bool                    (*enabled)(struct xfs_mount *mp);
+       bool                    (*enabled)(const struct xfs_mount *mp);
 
        /* Create this rtgroup metadata inode and initialize it. */
        int                     (*create)(struct xfs_rtgroup *rtg,