From c6b160c4e4b1d4fd14f2e9127edb726fe9ea8f08 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 19 Apr 2023 17:20:41 -0400 Subject: [PATCH] btrfs-progs: constify the extent buffer helpers These helpers are all take const struct extent_buffer in the kernel, do the same in btrfs-progs in order to enable us to more easily sync ctree.c. Signed-off-by: Josef Bacik Signed-off-by: David Sterba --- kernel-shared/extent_io.c | 15 ++++++++------- kernel-shared/extent_io.h | 10 ++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c index 106db642..73d3bb35 100644 --- a/kernel-shared/extent_io.c +++ b/kernel-shared/extent_io.c @@ -609,26 +609,27 @@ void write_extent_buffer(const struct extent_buffer *eb, const void *src, memcpy((void *)eb->data + start, src, len); } -void copy_extent_buffer(struct extent_buffer *dst, struct extent_buffer *src, +void copy_extent_buffer(const struct extent_buffer *dst, + const struct extent_buffer *src, unsigned long dst_offset, unsigned long src_offset, unsigned long len) { - memcpy(dst->data + dst_offset, src->data + src_offset, len); + memcpy((void *)dst->data + dst_offset, src->data + src_offset, len); } -void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset, +void memmove_extent_buffer(const struct extent_buffer *dst, unsigned long dst_offset, unsigned long src_offset, unsigned long len) { - memmove(dst->data + dst_offset, dst->data + src_offset, len); + memmove((void *)dst->data + dst_offset, dst->data + src_offset, len); } -void memset_extent_buffer(struct extent_buffer *eb, char c, +void memset_extent_buffer(const struct extent_buffer *eb, char c, unsigned long start, unsigned long len) { - memset(eb->data + start, c, len); + memset((void *)eb->data + start, c, len); } -int extent_buffer_test_bit(struct extent_buffer *eb, unsigned long start, +int extent_buffer_test_bit(const struct extent_buffer *eb, unsigned long start, unsigned long nr) { return le_test_bit(nr, (u8 *)eb->data + start); diff --git a/kernel-shared/extent_io.h b/kernel-shared/extent_io.h index 8ba56eed..69133c3c 100644 --- a/kernel-shared/extent_io.h +++ b/kernel-shared/extent_io.h @@ -110,14 +110,16 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dst, unsigned long start, unsigned long len); void write_extent_buffer(const struct extent_buffer *eb, const void *src, unsigned long start, unsigned long len); -void copy_extent_buffer(struct extent_buffer *dst, struct extent_buffer *src, +void copy_extent_buffer(const struct extent_buffer *dst, + const struct extent_buffer *src, unsigned long dst_offset, unsigned long src_offset, unsigned long len); -void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset, +void memmove_extent_buffer(const struct extent_buffer *dst, + const unsigned long dst_offset, unsigned long src_offset, unsigned long len); -void memset_extent_buffer(struct extent_buffer *eb, char c, +void memset_extent_buffer(const struct extent_buffer *eb, char c, unsigned long start, unsigned long len); -int extent_buffer_test_bit(struct extent_buffer *eb, unsigned long start, +int extent_buffer_test_bit(const struct extent_buffer *eb, unsigned long start, unsigned long nr); int set_extent_buffer_dirty(struct extent_buffer *eb); int clear_extent_buffer_dirty(struct extent_buffer *eb);