aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Kirk <ross.kirk@gmail.com>2013-10-01 11:59:22 +0200
committerChris Mason <chris.mason@fusionio.com>2013-10-16 08:23:11 -0400
commit33ce9a82b89486efc85c938caac968f5ee0408e1 (patch)
tree522b49dedb9d8638079fce98ac9fbd7739dbf31c
parent120e27d76fb5748db1160baf1efe0ceef59452f0 (diff)
downloadbtrfs-progs-33ce9a82b89486efc85c938caac968f5ee0408e1.tar.gz
btrfs-progs-33ce9a82b89486efc85c938caac968f5ee0408e1.tar.xz
btrfs-progs-33ce9a82b89486efc85c938caac968f5ee0408e1.zip
btrfs-progs: Make btrfs_header_fsid() return unsigned long
Internally, btrfs_header_fsid() calculates an unsigned long, but casts it to a pointer, while all callers cast it to unsigned long again. Committed to btrfs as fba6aa75654394fccf2530041e9451414c28084f Fix line length issues and match changes to kernelspace Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--chunk-recover.c5
-rw-r--r--cmds-check.c3
-rw-r--r--cmds-chunk.c6
-rw-r--r--ctree.c15
-rw-r--r--ctree.h5
-rw-r--r--disk-io.c2
-rw-r--r--print-tree.c2
-rw-r--r--utils.c4
8 files changed, 16 insertions, 26 deletions
diff --git a/chunk-recover.c b/chunk-recover.c
index 6c6db11..bcde39e 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -743,7 +743,7 @@ static int scan_one_device(struct recover_control *rc, int fd,
break;
if (memcmp_extent_buffer(buf, rc->fs_devices->fsid,
- (unsigned long)btrfs_header_fsid(),
+ btrfs_header_fsid(),
BTRFS_FSID_SIZE)) {
bytenr += rc->sectorsize;
continue;
@@ -1044,8 +1044,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans,
btrfs_set_header_backref_rev(cow, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(cow, BTRFS_CHUNK_TREE_OBJECTID);
write_extent_buffer(cow, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
write_extent_buffer(cow, root->fs_info->chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(cow),
diff --git a/cmds-check.c b/cmds-check.c
index e08b79d..c4530f7 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -5597,8 +5597,7 @@ init:
btrfs_set_header_owner(c, root->root_key.objectid);
write_extent_buffer(c, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(c),
diff --git a/cmds-chunk.c b/cmds-chunk.c
index e06881b..4c2f3ed 100644
--- a/cmds-chunk.c
+++ b/cmds-chunk.c
@@ -744,8 +744,7 @@ static int scan_one_device(struct recover_control *rc, int fd,
break;
if (memcmp_extent_buffer(buf, rc->fs_devices->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE)) {
+ btrfs_header_fsid(), BTRFS_FSID_SIZE)) {
bytenr += rc->sectorsize;
continue;
}
@@ -1047,8 +1046,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans,
btrfs_set_header_backref_rev(cow, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(cow, BTRFS_CHUNK_TREE_OBJECTID);
write_extent_buffer(cow, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
write_extent_buffer(cow, root->fs_info->chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(cow),
diff --git a/ctree.c b/ctree.c
index 8efe1ed..b54554b 100644
--- a/ctree.c
+++ b/ctree.c
@@ -118,8 +118,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
btrfs_set_header_owner(cow, new_root_objectid);
write_extent_buffer(cow, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
WARN_ON(btrfs_header_generation(buf) > trans->transid);
ret = btrfs_inc_ref(trans, new_root, cow, 0);
@@ -292,8 +291,7 @@ int __btrfs_cow_block(struct btrfs_trans_handle *trans,
btrfs_set_header_owner(cow, root->root_key.objectid);
write_extent_buffer(cow, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
WARN_ON(btrfs_header_generation(buf) > trans->transid);
@@ -1338,8 +1336,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
btrfs_set_header_owner(c, root->root_key.objectid);
write_extent_buffer(c, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(c),
@@ -1459,8 +1456,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_set_header_backref_rev(split, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(split, root->root_key.objectid);
write_extent_buffer(split, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
write_extent_buffer(split, root->fs_info->chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(split),
BTRFS_UUID_SIZE);
@@ -2020,8 +2016,7 @@ again:
btrfs_set_header_owner(right, root->root_key.objectid);
btrfs_set_header_level(right, 0);
write_extent_buffer(right, root->fs_info->fsid,
- (unsigned long)btrfs_header_fsid(),
- BTRFS_FSID_SIZE);
+ btrfs_header_fsid(), BTRFS_FSID_SIZE);
write_extent_buffer(right, root->fs_info->chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(right),
diff --git a/ctree.h b/ctree.h
index 499fea3..4e84a8f 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1777,10 +1777,9 @@ static inline void btrfs_set_header_backref_rev(struct extent_buffer *eb,
btrfs_set_header_flags(eb, flags);
}
-static inline u8 *btrfs_header_fsid(void)
+static inline unsigned long btrfs_header_fsid(void)
{
- unsigned long ptr = offsetof(struct btrfs_header, fsid);
- return (u8 *)ptr;
+ return offsetof(struct btrfs_header, fsid);
}
static inline u8 *btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
diff --git a/disk-io.c b/disk-io.c
index f0d7040..5f3f484 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -50,7 +50,7 @@ static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
fs_devices = root->fs_info->fs_devices;
while (fs_devices) {
if (!memcmp_extent_buffer(buf, fs_devices->fsid,
- (unsigned long)btrfs_header_fsid(),
+ btrfs_header_fsid(),
BTRFS_FSID_SIZE)) {
ret = 0;
break;
diff --git a/print-tree.c b/print-tree.c
index b54a067..76037fe 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -191,7 +191,7 @@ static void print_uuids(struct extent_buffer *eb)
char chunk_uuid[37];
u8 disk_uuid[BTRFS_UUID_SIZE];
- read_extent_buffer(eb, disk_uuid, (unsigned long)btrfs_header_fsid(),
+ read_extent_buffer(eb, disk_uuid, btrfs_header_fsid(),
BTRFS_FSID_SIZE);
fs_uuid[36] = '\0';
diff --git a/utils.c b/utils.c
index c6022fc..accecef 100644
--- a/utils.c
+++ b/utils.c
@@ -136,8 +136,8 @@ int make_btrfs(int fd, const char *device, const char *label,
btrfs_set_header_generation(buf, 1);
btrfs_set_header_backref_rev(buf, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(buf, BTRFS_ROOT_TREE_OBJECTID);
- write_extent_buffer(buf, super.fsid, (unsigned long)
- btrfs_header_fsid(), BTRFS_FSID_SIZE);
+ write_extent_buffer(buf, super.fsid, btrfs_header_fsid(),
+ BTRFS_FSID_SIZE);
write_extent_buffer(buf, chunk_tree_uuid, (unsigned long)
btrfs_header_chunk_tree_uuid(buf),