diff options
author | Jacob Malevich <jam@daterainc.com> | 2014-11-14 11:24:02 -0800 |
---|---|---|
committer | Jacob Malevich <jam@daterainc.com> | 2014-11-14 11:24:02 -0800 |
commit | 4603dcf36b07230277474c6db76d76a128edaa5a (patch) | |
tree | f9fb372acc3f8921a6ffc697b4ffb4b0338683d5 /bcache.c | |
parent | 28271115d7ce70933e3366e9c2b050c975660bcf (diff) |
Option for returning only the uuid of the dev when doing a
query-dev
Change-Id: Ia055da0516bc7baac836642fa1405b77adfc5139
Signed-off-by: Jacob Malevich <jam@daterainc.com>
Diffstat (limited to 'bcache.c')
-rw-r--r-- | bcache.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -718,6 +718,12 @@ static void print_encode(char *in) printf("%%%x", *pos); } +static void show_uuid_only(struct cache_sb *sb) { + char uuid[40]; + uuid_unparse(sb->uuid.b, uuid); + printf("%s\n", uuid); +} + static void show_super_common(struct cache_sb *sb, bool force_csum) { char uuid[40]; @@ -864,7 +870,8 @@ void show_super_cache(struct cache_sb *sb, bool force_csum) show_cache_member(sb, sb->nr_this_dev); } -struct cache_sb *query_dev(char *dev, bool force_csum, bool print_sb) +struct cache_sb *query_dev(char *dev, bool force_csum, + bool print_sb, bool uuid_only) { struct cache_sb sb_stack, *sb = &sb_stack; size_t bytes = sizeof(*sb); @@ -890,6 +897,11 @@ struct cache_sb *query_dev(char *dev, bool force_csum, bool print_sb) } } + if(uuid_only) { + show_uuid_only(sb); + return sb; + } + if(print_sb) { if (!SB_IS_BDEV(sb)) show_super_cache(sb, force_csum); |