From: Darrick J. Wong <djwong@xxxxxxxxxx> 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@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- include/xfs_arch.h | 10 +++++----- libxfs/xfs_bmap_btree.c | 2 +- libxfs/xfs_bmap_btree.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/xfs_arch.h b/include/xfs_arch.h index 7f973249..d46ae470 100644 --- a/include/xfs_arch.h +++ b/include/xfs_arch.h @@ -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); diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index acaf2941..9e2e9926 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -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); diff --git a/libxfs/xfs_bmap_btree.h b/libxfs/xfs_bmap_btree.h index 209ded1e..eda85512 100644 --- a/libxfs/xfs_bmap_btree.h +++ b/libxfs/xfs_bmap_btree.h @@ -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);