Lines Matching +full:32 +full:- +full:bits

1 /* SPDX-License-Identifier: GPL-2.0 */
57 #define DECLARE_BTRFS_SETGET_BITS(bits) \ argument
58 u##bits btrfs_get_token_##bits(struct btrfs_map_token *token, \
60 void btrfs_set_token_##bits(struct btrfs_map_token *token, \
62 u##bits val); \
63 u##bits btrfs_get_##bits(const struct extent_buffer *eb, \
65 void btrfs_set_##bits(const struct extent_buffer *eb, void *ptr, \
66 unsigned long off, u##bits val);
70 DECLARE_BTRFS_SETGET_BITS(32)
73 #define BTRFS_SETGET_FUNCS(name, type, member, bits) \ argument
74 static inline u##bits btrfs_##name(const struct extent_buffer *eb, \
77 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
78 return btrfs_get_##bits(eb, s, offsetof(type, member)); \
81 u##bits val) \
83 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
84 btrfs_set_##bits(eb, s, offsetof(type, member), val); \
86 static inline u##bits btrfs_token_##name(struct btrfs_map_token *token, \
89 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
90 return btrfs_get_token_##bits(token, s, offsetof(type, member));\
93 type *s, u##bits val) \
95 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
96 btrfs_set_token_##bits(token, s, offsetof(type, member), val); \
99 #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ argument
100 static inline u##bits btrfs_##name(const struct extent_buffer *eb) \
102 const type *p = folio_address(eb->folios[0]) + \
103 offset_in_page(eb->start); \
104 return get_unaligned_le##bits(&p->member); \
107 u##bits val) \
109 type *p = folio_address(eb->folios[0]) + offset_in_page(eb->start); \
110 put_unaligned_le##bits(val, &p->member); \
113 #define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits) \ argument
114 static inline u##bits btrfs_##name(const type *s) \
116 return get_unaligned_le##bits(&s->member); \
118 static inline void btrfs_set_##name(type *s, u##bits val) \
120 put_unaligned_le##bits(val, &s->member); \
134 WARN_ON(!IS_ALIGNED(val, eb->fs_info->sectorsize)); in btrfs_set_device_total_bytes()
140 BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32);
141 BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32);
143 BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32);
145 BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32);
156 io_align, 32);
158 io_width, 32);
160 sector_size, 32);
162 BTRFS_SETGET_STACK_FUNCS(stack_device_group, struct btrfs_dev_item, dev_group, 32);
183 BTRFS_SETGET_FUNCS(chunk_io_align, struct btrfs_chunk, io_align, 32);
184 BTRFS_SETGET_FUNCS(chunk_io_width, struct btrfs_chunk, io_width, 32);
185 BTRFS_SETGET_FUNCS(chunk_sector_size, struct btrfs_chunk, sector_size, 32);
201 BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_align, struct btrfs_chunk, io_align, 32);
202 BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_width, struct btrfs_chunk, io_width, 32);
204 sector_size, 32);
268 extent_count, 32);
269 BTRFS_SETGET_FUNCS(free_space_flags, struct btrfs_free_space_info, flags, 32);
291 BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
292 BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
293 BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
294 BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
307 BTRFS_SETGET_STACK_FUNCS(stack_inode_nlink, struct btrfs_inode_item, nlink, 32);
308 BTRFS_SETGET_STACK_FUNCS(stack_inode_uid, struct btrfs_inode_item, uid, 32);
309 BTRFS_SETGET_STACK_FUNCS(stack_inode_gid, struct btrfs_inode_item, gid, 32);
310 BTRFS_SETGET_STACK_FUNCS(stack_inode_mode, struct btrfs_inode_item, mode, 32);
314 BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
316 BTRFS_SETGET_STACK_FUNCS(stack_timespec_nsec, struct btrfs_timespec, nsec, 32);
363 BTRFS_SETGET_FUNCS(extent_data_ref_count, struct btrfs_extent_data_ref, count, 32);
365 BTRFS_SETGET_FUNCS(shared_data_ref_count, struct btrfs_shared_data_ref, count, 32);
456 BTRFS_SETGET_FUNCS(raw_item_offset, struct btrfs_item, offset, 32);
457 BTRFS_SETGET_FUNCS(raw_item_size, struct btrfs_item, size, 32);
458 BTRFS_SETGET_STACK_FUNCS(stack_item_offset, struct btrfs_item, offset, 32);
459 BTRFS_SETGET_STACK_FUNCS(stack_item_size, struct btrfs_item, size, 32);
485 struct btrfs_item *item = btrfs_item_nr(token->eb, slot); \
491 struct btrfs_item *item = btrfs_item_nr(token->eb, slot); \
593 * Optimized helpers for little-endian architectures where CPU and on-disk
639 cpu->offset = le64_to_cpu(disk->offset); in btrfs_disk_key_to_cpu()
640 cpu->type = disk->type; in btrfs_disk_key_to_cpu()
641 cpu->objectid = le64_to_cpu(disk->objectid); in btrfs_disk_key_to_cpu()
647 disk->offset = cpu_to_le64(cpu->offset); in btrfs_cpu_key_to_disk()
648 disk->type = cpu->type; in btrfs_cpu_key_to_disk()
649 disk->objectid = cpu_to_le64(cpu->objectid); in btrfs_cpu_key_to_disk()
686 BTRFS_SETGET_HEADER_FUNCS(header_nritems, struct btrfs_header, nritems, 32);
692 BTRFS_SETGET_STACK_FUNCS(stack_header_nritems, struct btrfs_header, nritems, 32);
737 BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32);
746 BTRFS_SETGET_STACK_FUNCS(root_refs, struct btrfs_root_item, refs, 32);
860 struct btrfs_super_block, sys_chunk_array_size, 32);
877 sectorsize, 32);
879 nodesize, 32);
881 stripesize, 32);