diff options
author | Zach Brown <zab@redhat.com> | 2013-02-19 19:55:13 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-20 13:00:01 -0500 |
commit | cdb4c5748cb3ac533889a6b0b95aa10651e68785 (patch) | |
tree | 1c1ca874a564e824fd4b824c29a04ed7ec4936a6 /fs/btrfs/volumes.c | |
parent | a8bfd4abea3da0e28f215e2a2b8c2f1ca27ebe80 (diff) |
btrfs: define BTRFS_MAGIC as a u64 value
super.magic is an le64 but it's treated as an unterminated string when
compared against BTRFS_MAGIC which is defined as a string. Instead
define BTRFS_MAGIC as a normal hex value and use endian helpers to
compare it to the super's magic.
I tested this by mounting an fs made before the change and made sure
that it didn't introduce sparse errors. This matches a similar cleanup
that is pending in btrfs-progs. David Sterba pointed out that we should
fix the kernel side as well :).
Signed-off-by: Zach Brown <zab@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 567076542d1d..72b1cf1b2b5e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -855,8 +855,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, | |||
855 | disk_super = p + (bytenr & ~PAGE_CACHE_MASK); | 855 | disk_super = p + (bytenr & ~PAGE_CACHE_MASK); |
856 | 856 | ||
857 | if (btrfs_super_bytenr(disk_super) != bytenr || | 857 | if (btrfs_super_bytenr(disk_super) != bytenr || |
858 | strncmp((char *)(&disk_super->magic), BTRFS_MAGIC, | 858 | disk_super->magic != cpu_to_le64(BTRFS_MAGIC)) |
859 | sizeof(disk_super->magic))) | ||
860 | goto error_unmap; | 859 | goto error_unmap; |
861 | 860 | ||
862 | devid = btrfs_stack_device_id(&disk_super->dev_item); | 861 | devid = btrfs_stack_device_id(&disk_super->dev_item); |