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

These functions initialize a key from a record, but they aren't supposed
to modify the record.  Mark it 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>
libxfs/xfs_alloc_btree.c
libxfs/xfs_bmap_btree.c
libxfs/xfs_bmap_btree.h
libxfs/xfs_btree.h
libxfs/xfs_ialloc_btree.c
libxfs/xfs_refcount_btree.c
libxfs/xfs_rmap_btree.c

index 67553183aafb685824157817126ce0ba17cbc881..fb2fdb4ae8b5e18dd2b676daf0207546d28a674e 100644 (file)
@@ -175,8 +175,8 @@ xfs_allocbt_get_maxrecs(
 
 STATIC void
 xfs_allocbt_init_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->alloc.ar_startblock = rec->alloc.ar_startblock;
        key->alloc.ar_blockcount = rec->alloc.ar_blockcount;
@@ -184,10 +184,10 @@ xfs_allocbt_init_key_from_rec(
 
 STATIC void
 xfs_bnobt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
-       __u32                   x;
+       __u32                           x;
 
        x = be32_to_cpu(rec->alloc.ar_startblock);
        x += be32_to_cpu(rec->alloc.ar_blockcount) - 1;
@@ -197,8 +197,8 @@ xfs_bnobt_init_high_key_from_rec(
 
 STATIC void
 xfs_cntbt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->alloc.ar_blockcount = rec->alloc.ar_blockcount;
        key->alloc.ar_startblock = 0;
index d72e1e7bfde0484583fb624d139bf7f072553f5e..73e387f5a654043980ccaabab64fd02400e171ac 100644 (file)
@@ -76,7 +76,7 @@ xfs_bmbt_disk_get_all(
  */
 xfs_filblks_t
 xfs_bmbt_disk_get_blockcount(
-       xfs_bmbt_rec_t  *r)
+       const struct xfs_bmbt_rec       *r)
 {
        return (xfs_filblks_t)(be64_to_cpu(r->l1) & xfs_mask64lo(21));
 }
@@ -86,7 +86,7 @@ xfs_bmbt_disk_get_blockcount(
  */
 xfs_fileoff_t
 xfs_bmbt_disk_get_startoff(
-       xfs_bmbt_rec_t  *r)
+       const struct xfs_bmbt_rec       *r)
 {
        return ((xfs_fileoff_t)be64_to_cpu(r->l0) &
                 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
@@ -350,8 +350,8 @@ xfs_bmbt_get_dmaxrecs(
 
 STATIC void
 xfs_bmbt_init_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->bmbt.br_startoff =
                cpu_to_be64(xfs_bmbt_disk_get_startoff(&rec->bmbt));
@@ -359,8 +359,8 @@ xfs_bmbt_init_key_from_rec(
 
 STATIC void
 xfs_bmbt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->bmbt.br_startoff = cpu_to_be64(
                        xfs_bmbt_disk_get_startoff(&rec->bmbt) +
index 72bf74c79fb99eacc5d0a9766c6b3ff9965c0743..209ded1eefd10a3396ec1520b1a7d321b060e0dc 100644 (file)
@@ -88,8 +88,8 @@ extern void xfs_bmdr_to_bmbt(struct xfs_inode *, xfs_bmdr_block_t *, int,
                        struct xfs_btree_block *, 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(xfs_bmbt_rec_t *r);
-extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
+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);
 
 extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
index e83836a984e40fc15a8b3be5d0a86e5620356747..c4c701fd107749e7c9065dfc5fe96daae9f7fe31 100644 (file)
@@ -130,13 +130,13 @@ struct xfs_btree_ops {
 
        /* init values of btree structures */
        void    (*init_key_from_rec)(union xfs_btree_key *key,
-                                    union xfs_btree_rec *rec);
+                                    const union xfs_btree_rec *rec);
        void    (*init_rec_from_cur)(struct xfs_btree_cur *cur,
                                     union xfs_btree_rec *rec);
        void    (*init_ptr_from_cur)(struct xfs_btree_cur *cur,
                                     union xfs_btree_ptr *ptr);
        void    (*init_high_key_from_rec)(union xfs_btree_key *key,
-                                         union xfs_btree_rec *rec);
+                                         const union xfs_btree_rec *rec);
 
        /* difference between key value and cursor value */
        int64_t (*key_diff)(struct xfs_btree_cur *cur,
index fd13ec53588da4b0b8ccae572fff091c44891849..e7b19d2af6bda574e03b3d3693d248f0ef6fc20a 100644 (file)
@@ -187,18 +187,18 @@ xfs_inobt_get_maxrecs(
 
 STATIC void
 xfs_inobt_init_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->inobt.ir_startino = rec->inobt.ir_startino;
 }
 
 STATIC void
 xfs_inobt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
-       __u32                   x;
+       __u32                           x;
 
        x = be32_to_cpu(rec->inobt.ir_startino);
        x += XFS_INODES_PER_CHUNK - 1;
index 277c766975853c54c06f34684c4a6e12de1b6d4a..04bc5816078f6f2686bbb497e1071bc2d8ac90b9 100644 (file)
@@ -134,18 +134,18 @@ xfs_refcountbt_get_maxrecs(
 
 STATIC void
 xfs_refcountbt_init_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->refc.rc_startblock = rec->refc.rc_startblock;
 }
 
 STATIC void
 xfs_refcountbt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
-       __u32                   x;
+       __u32                           x;
 
        x = be32_to_cpu(rec->refc.rc_startblock);
        x += be32_to_cpu(rec->refc.rc_blockcount) - 1;
index d27e83b9011c1f3013c2b43167cd7aebe71b9cdc..294d4a419a7a4b9d39bfcc3ec135b0b88453234e 100644 (file)
@@ -154,8 +154,8 @@ xfs_rmapbt_get_maxrecs(
 
 STATIC void
 xfs_rmapbt_init_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->rmap.rm_startblock = rec->rmap.rm_startblock;
        key->rmap.rm_owner = rec->rmap.rm_owner;
@@ -171,11 +171,11 @@ xfs_rmapbt_init_key_from_rec(
  */
 STATIC void
 xfs_rmapbt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
-       uint64_t                off;
-       int                     adj;
+       uint64_t                        off;
+       int                             adj;
 
        adj = be32_to_cpu(rec->rmap.rm_blockcount) - 1;