btrfs-progs: Make btrfs_header_chunk_tree_uuid() return unsigned long
PATCH 1/1 btrfs-progs: Make btrfs_header_chunk_tree_uuid() return unsigned long
Internally, btrfs_header_chunk_tree_uuid() calculates an unsigned long, but casts it to a pointer, while all callers cast it to unsigned long again.
Quoted 1 line
From btrfs commit
b308bc2f05a86e728bd035e21a4974acd05f4d1e
Signed-off-by Ross Kirk <[email protected]>
--- btrfs-find-root.c | 3 +-- cmds-chunk.c | 6 ++---- ctree.c | 10 ++++------ ctree.h | 5 ++--- disk-io.c | 3 +-- print-tree.c | 3 +-- utils.c | 2 +- 7 files changed, 12 insertions(+), 20 deletions(-)
btrfs-find-root.c +1 -2
@@ -112,8 +112,7 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device) eb = fs_info->chunk_root->node;read_extent_buffer (eb, fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (eb), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (eb),BTRFS_UUID_SIZE );return fs_info->chunk_root; out_chunk:
cmds-chunk.c +2 -4
@@ -1048,8 +1048,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans, BTRFS_FSID_SIZE);write_extent_buffer (cow, root->fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (cow), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (cow),BTRFS_UUID_SIZE ); root->node = cow;btrfs_mark_buffer_dirty (cow);
@@ -1236,8 +1235,7 @@ open_ctree_with_broken_chunk(struct recover_control *rc) eb = fs_info->tree_root->node;read_extent_buffer (eb, fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (eb), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (eb),BTRFS_UUID_SIZE );return fs_info->fs_root; out_failed:
ctree.c +4 -6
@@ -173,8 +173,7 @@ init: BTRFS_FSID_SIZE);write_extent_buffer (c, root->fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (c), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (c),BTRFS_UUID_SIZE );btrfs_mark_buffer_dirty (c);
@@ -1533,8 +1532,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans, BTRFS_FSID_SIZE);write_extent_buffer (c, root->fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (c), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (c),BTRFS_UUID_SIZE );btrfs_set_node_key (c, &lower_key,0 );btrfs_set_node_blockptr (c,0 , lower->start);
@@ -1653,7 +1651,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root (unsigned long )btrfs_header_fsid (split), BTRFS_FSID_SIZE);write_extent_buffer (split, root->fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (split), +btrfs_header_chunk_tree_uuid (split),BTRFS_UUID_SIZE );
@@ -2215,7 +2213,7 @@ again: BTRFS_FSID_SIZE);write_extent_buffer (right, root->fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (right), +btrfs_header_chunk_tree_uuid (right),BTRFS_UUID_SIZE );if (split ==0 ) {
ctree.h +2 -3
@@ -1754,10 +1754,9 @@ static inline u8 *btrfs_header_fsid(struct extent_buffer *eb)return (u8 *)ptr; } -static inline u8 *btrfs_header_chunk_tree_uuid (struct extent_buffer *eb) +static inline unsigned long btrfs_header_chunk_tree_uuid (struct extent_buffer *eb) { -unsigned long ptr = offsetof(struct btrfs_header , chunk_tree_uuid); -return (u8 *)ptr; +return offsetof(struct btrfs_header , chunk_tree_uuid); }static inline u8 *btrfs_super_fsid (struct extent_buffer *eb)
disk-io.c +1 -2
@@ -1034,8 +1034,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path, eb = fs_info->chunk_root->node;read_extent_buffer (eb, fs_info->chunk_tree_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (eb), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (eb),BTRFS_UUID_SIZE ); ret =btrfs_setup_all_roots (fs_info, root_tree_bytenr, partial);if (ret)
print-tree.c +1 -2
@@ -160,8 +160,7 @@ static void print_uuids(struct extent_buffer *eb)uuid_unparse (disk_uuid, fs_uuid);read_extent_buffer (eb, disk_uuid, - (unsigned long )btrfs_header_chunk_tree_uuid (eb), -BTRFS_UUID_SIZE ); +btrfs_header_chunk_tree_uuid (eb),BTRFS_UUID_SIZE ); chunk_uuid[36 ] ='\0' ;uuid_unparse (disk_uuid, chunk_uuid);
utils.c +1 -1
@@ -144,7 +144,7 @@ int make_btrfs(int fd, const char *device, const char *label,write_extent_buffer (buf, super.fsid, (unsigned long )btrfs_header_fsid (buf),BTRFS_FSID_SIZE ); -write_extent_buffer (buf, chunk_tree_uuid, (unsigned long ) +write_extent_buffer (buf, chunk_tree_uuid,btrfs_header_chunk_tree_uuid (buf),BTRFS_UUID_SIZE );
Signature · 1 line
1.7.7.6