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 <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-04-19 17:20:41 -04:00 committed by David Sterba
parent 4a9a8f2a8a
commit c6b160c4e4
2 changed files with 14 additions and 11 deletions

View File

@ -609,26 +609,27 @@ void write_extent_buffer(const struct extent_buffer *eb, const void *src,
memcpy((void *)eb->data + start, src, len); 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 dst_offset, unsigned long src_offset,
unsigned long len) 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) 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) 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) unsigned long nr)
{ {
return le_test_bit(nr, (u8 *)eb->data + start); return le_test_bit(nr, (u8 *)eb->data + start);

View File

@ -110,14 +110,16 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dst,
unsigned long start, unsigned long len); unsigned long start, unsigned long len);
void write_extent_buffer(const struct extent_buffer *eb, const void *src, void write_extent_buffer(const struct extent_buffer *eb, const void *src,
unsigned long start, unsigned long len); 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 dst_offset, unsigned long src_offset,
unsigned long len); 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); 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); 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); unsigned long nr);
int set_extent_buffer_dirty(struct extent_buffer *eb); int set_extent_buffer_dirty(struct extent_buffer *eb);
int clear_extent_buffer_dirty(struct extent_buffer *eb); int clear_extent_buffer_dirty(struct extent_buffer *eb);