block: include mountpoint in info output
authorDaniel Golle <daniel@makrotopia.org>
Sun, 24 Jul 2016 18:44:38 +0000 (20:44 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 12 Sep 2016 00:55:53 +0000 (02:55 +0200)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
block.c

diff --git a/block.c b/block.c
index 2e95c033b53ba23b091498e396e2db41e9f0141a..b8ef430126e6dbd3ce81cd998ab78fb6306ee4fc 100644 (file)
--- 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, '/');