diff options
author | Gu Jinxiang <gujx@cn.fujitsu.com> | 2017-06-28 17:59:24 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-09-08 16:15:05 +0200 |
commit | c0d783347f7e1763e1a13d3e13ab95a81f8718e6 (patch) | |
tree | 064047b202d51cd70756300f04ca17ca2e4ab817 /mkfs/common.h | |
parent | fb0d53a9377351d2875bde422e11b1213caf0b48 (diff) |
btrfs-progs: mkfs: Replace number with enum
For code maintainability and scalability,
replace hardcoded constant with a meaningful enum.
Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
[ add MKFS_ prefix ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs/common.h')
-rw-r--r-- | mkfs/common.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mkfs/common.h b/mkfs/common.h index 666a75b3..dee0ea97 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -28,6 +28,20 @@ #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M #define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G +/* + * Tree root blocks created during mkfs + */ +enum btrfs_mkfs_block { + MKFS_SUPER_BLOCK = 0, + MKFS_ROOT_TREE, + MKFS_EXTENT_TREE, + MKFS_CHUNK_TREE, + MKFS_DEV_TREE, + MKFS_FS_TREE, + MKFS_CSUM_TREE, + MKFS_BLOCK_COUNT +}; + struct btrfs_mkfs_config { /* Label of the new filesystem */ const char *label; @@ -43,7 +57,7 @@ struct btrfs_mkfs_config { /* Output fields, set during creation */ /* Logical addresses of superblock [0] and other tree roots */ - u64 blocks[8]; + u64 blocks[MKFS_BLOCK_COUNT + 1]; char fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE]; |