]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: mark the record passed into xchk_btree functions as const
authorDarrick J. Wong <djwong@kernel.org>
Mon, 31 Jan 2022 20:25:48 +0000 (15:25 -0500)
committerEric Sandeen <sandeen@redhat.com>
Mon, 31 Jan 2022 20:25:48 +0000 (15:25 -0500)
Source kernel commit: 22ece4e836beff1df528ee09cf21ca5fab7235f5

xchk_btree calls a user-supplied function to validate each btree record
that it finds.  Those functions are not supposed to change the record
data, so mark the parameter const.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/xfs_arch.h
libxfs/xfs_bmap_btree.c
libxfs/xfs_bmap_btree.h

index 7f97324974e166dc0524a1dd5b327f4824af7c68..d46ae47094ae75cc93232cd1294d2dd51222130f 100644 (file)
@@ -232,19 +232,19 @@ static inline void be64_add_cpu(__be64 *a, __s64 b)
        *a = cpu_to_be64(be64_to_cpu(*a) + b);
 }
 
-static inline uint16_t get_unaligned_be16(void *p)
+static inline uint16_t get_unaligned_be16(const void *p)
 {
-       uint8_t *__p = p;
+       const uint8_t *__p = p;
        return __p[0] << 8 | __p[1];
 }
 
-static inline uint32_t get_unaligned_be32(void *p)
+static inline uint32_t get_unaligned_be32(const void *p)
 {
-       uint8_t *__p = p;
+       const uint8_t *__p = p;
         return (uint32_t)__p[0] << 24 | __p[1] << 16 | __p[2] << 8 | __p[3];
 }
 
-static inline uint64_t get_unaligned_be64(void *p)
+static inline uint64_t get_unaligned_be64(const void *p)
 {
        return (uint64_t)get_unaligned_be32(p) << 32 |
                           get_unaligned_be32(p + 4);
index acaf2941cd5acf9b36ba86a6a0fa7e0fbcfcf355..9e2e9926a19d908b10285a284bbc65ad85e1b8ab 100644 (file)
@@ -56,7 +56,7 @@ xfs_bmdr_to_bmbt(
 
 void
 xfs_bmbt_disk_get_all(
-       struct xfs_bmbt_rec     *rec,
+       const struct xfs_bmbt_rec *rec,
        struct xfs_bmbt_irec    *irec)
 {
        uint64_t                l0 = get_unaligned_be64(&rec->l0);
index 209ded1eefd10a3396ec1520b1a7d321b060e0dc..eda855123ee2a6db8c77b7f5bd06d7f231f69b8f 100644 (file)
@@ -90,7 +90,8 @@ extern void xfs_bmdr_to_bmbt(struct xfs_inode *, xfs_bmdr_block_t *, int,
 void xfs_bmbt_disk_set_all(struct xfs_bmbt_rec *r, struct xfs_bmbt_irec *s);
 extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(const struct xfs_bmbt_rec *r);
 extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(const struct xfs_bmbt_rec *r);
-extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
+void xfs_bmbt_disk_get_all(const struct xfs_bmbt_rec *r,
+               struct xfs_bmbt_irec *s);
 
 extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
                        xfs_bmdr_block_t *, int);