mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
btrfs: struct-funcs, constify readers
We have reader helpers for most of the on-disk structures that use an extent_buffer and pointer as offset into the buffer that are read-only. We should mark them as const and, in turn, allow consumers of these interfaces to mark the buffers const as well. No impact on code, but serves as documentation that a buffer is intended not to be modified. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
23d1f73788
commit
1cbb1f454e
4 changed files with 91 additions and 89 deletions
|
@ -5405,9 +5405,8 @@ unlock_exit:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void read_extent_buffer(struct extent_buffer *eb, void *dstv,
|
||||
unsigned long start,
|
||||
unsigned long len)
|
||||
void read_extent_buffer(const struct extent_buffer *eb, void *dstv,
|
||||
unsigned long start, unsigned long len)
|
||||
{
|
||||
size_t cur;
|
||||
size_t offset;
|
||||
|
@ -5436,9 +5435,9 @@ void read_extent_buffer(struct extent_buffer *eb, void *dstv,
|
|||
}
|
||||
}
|
||||
|
||||
int read_extent_buffer_to_user(struct extent_buffer *eb, void __user *dstv,
|
||||
unsigned long start,
|
||||
unsigned long len)
|
||||
int read_extent_buffer_to_user(const struct extent_buffer *eb,
|
||||
void __user *dstv,
|
||||
unsigned long start, unsigned long len)
|
||||
{
|
||||
size_t cur;
|
||||
size_t offset;
|
||||
|
@ -5478,10 +5477,10 @@ int read_extent_buffer_to_user(struct extent_buffer *eb, void __user *dstv,
|
|||
* return 1 if the item spans two pages.
|
||||
* return -EINVAL otherwise.
|
||||
*/
|
||||
int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start,
|
||||
unsigned long min_len, char **map,
|
||||
unsigned long *map_start,
|
||||
unsigned long *map_len)
|
||||
int map_private_extent_buffer(const struct extent_buffer *eb,
|
||||
unsigned long start, unsigned long min_len,
|
||||
char **map, unsigned long *map_start,
|
||||
unsigned long *map_len)
|
||||
{
|
||||
size_t offset = start & (PAGE_SIZE - 1);
|
||||
char *kaddr;
|
||||
|
@ -5515,9 +5514,8 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int memcmp_extent_buffer(struct extent_buffer *eb, const void *ptrv,
|
||||
unsigned long start,
|
||||
unsigned long len)
|
||||
int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,
|
||||
unsigned long start, unsigned long len)
|
||||
{
|
||||
size_t cur;
|
||||
size_t offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue