From 6eda7defcedbe8337d7cb4dd4b3d04244a7b6698 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 24 Jul 2016 20:44:38 +0200 Subject: [PATCH] block: include mountpoint in info output Signed-off-by: Daniel Golle --- block.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/block.c b/block.c index 2e95c03..b8ef430 100644 --- a/block.c +++ b/block.c @@ -526,25 +526,6 @@ static void cache_load(int mtd) _cache_load("/dev/mapper/*"); } -static int print_block_info(struct blkid_struct_probe *pr) -{ - printf("%s:", pr->dev); - if (pr->uuid[0]) - printf(" UUID=\"%s\"", pr->uuid); - - if (pr->label[0]) - printf(" LABEL=\"%s\"", pr->label); - - if (pr->name[0]) - printf(" NAME=\"%s\"", pr->name); - - if (pr->version[0]) - printf(" VERSION=\"%s\"", pr->version); - - printf(" TYPE=\"%s\"\n", pr->id->name); - - return 0; -} static int print_block_uci(struct blkid_struct_probe *pr) { @@ -676,6 +657,34 @@ static char* find_mount_point(char *block) return point; } +static int print_block_info(struct blkid_struct_probe *pr) +{ + static char *mp; + + mp = find_mount_point(pr->dev); + printf("%s:", pr->dev); + if (pr->uuid[0]) + printf(" UUID=\"%s\"", pr->uuid); + + if (pr->label[0]) + printf(" LABEL=\"%s\"", pr->label); + + if (pr->name[0]) + printf(" NAME=\"%s\"", pr->name); + + if (pr->version[0]) + printf(" VERSION=\"%s\"", pr->version); + + if (mp) { + printf(" MOUNT=\"%s\"", mp); + free(mp); + } + + printf(" TYPE=\"%s\"\n", pr->id->name); + + return 0; +} + static void mkdir_p(char *dir) { char *l = strrchr(dir, '/'); -- 2.25.1