diff options
author | Anand Jain <anand.jain@oracle.com> | 2013-11-04 15:17:41 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-01-31 08:22:03 -0800 |
commit | 1ecefced86538306d581b05105a93d1268ce0028 (patch) | |
tree | 2c056cfa051e67a6773add9f2b5b550470f1fdcd /cmds-filesystem.c | |
parent | 457b1286dd9976efbfec25bb286ddc8cec410aa1 (diff) |
btrfs-progs: define BTRFS_UUID_UNPARSE_SIZE for uuid unparse buf size
we use 37 as the allocation size to hold the uuid_unparse, here
it defines BTRFS_UUID_UNPARSE_SIZE for the same.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r-- | cmds-filesystem.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 67834389..8296fa1e 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -251,10 +251,10 @@ static int cmd_df(int argc, char **argv) static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label, char *search) { - char uuidbuf[37]; + char uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; int search_len = strlen(search); - search_len = min(search_len, 37); + search_len = min(search_len, BTRFS_UUID_UNPARSED_SIZE); uuid_unparse(fsid, uuidbuf); if (!strncmp(uuidbuf, search, search_len)) return 1; @@ -270,12 +270,12 @@ static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label, static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search) { - char uuidbuf[37]; + char uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; struct list_head *cur; struct btrfs_device *device; int search_len = strlen(search); - search_len = min(search_len, 37); + search_len = min(search_len, BTRFS_UUID_UNPARSED_SIZE); uuid_unparse(fs_devices->fsid, uuidbuf); if (!strncmp(uuidbuf, search, search_len)) return 1; @@ -306,7 +306,7 @@ static int cmp_device_id(void *priv, struct list_head *a, static void print_one_uuid(struct btrfs_fs_devices *fs_devices) { - char uuidbuf[37]; + char uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; struct list_head *cur; struct btrfs_device *device; u64 devs_found = 0; @@ -363,7 +363,7 @@ static int print_one_fs(struct btrfs_ioctl_fs_info_args *fs_info, char *label, char *path) { int i; - char uuidbuf[37]; + char uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; struct btrfs_ioctl_dev_info_args *tmp_dev_info; int ret; @@ -421,7 +421,8 @@ static int check_arg_type(char *input) return BTRFS_ARG_UNKNOWN; } - if (strlen(input) == 36 && !uuid_parse(input, out)) + if (strlen(input) == (BTRFS_UUID_UNPARSED_SIZE - 1) && + !uuid_parse(input, out)) return BTRFS_ARG_UUID; return BTRFS_ARG_UNKNOWN; |