block: include mountpoint in info output
[project/fstools.git] / block.c
diff --git a/block.c b/block.c
index 720ecb1..b8ef430 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, '/');
@@ -1108,7 +1117,7 @@ static int check_extroot(char *path)
                                         tag, errno, strerror(errno));
                        fclose(fp);
 
-                       if (*uuid || !strcasecmp(uuid, pr->uuid))
+                       if (*uuid && !strcasecmp(uuid, pr->uuid))
                                return 0;
 
                        ULOG_ERR("extroot: UUID mismatch (root: %s, %s: %s)\n",