diff options
author | Daniel Golle <daniel@makrotopia.org> | 2016-07-24 20:44:38 +0200 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2016-09-12 02:55:53 +0200 |
commit | 6eda7defcedbe8337d7cb4dd4b3d04244a7b6698 (patch) | |
tree | da7a1c8e79752d161cae65f5e7062b17cb840129 | |
parent | 7874d580ff965bebbe19ea157353749d9f007b39 (diff) | |
download | fstools-6eda7defcedbe8337d7cb4dd4b3d04244a7b6698.tar.gz |
block: include mountpoint in info output
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r-- | block.c | 47 |
1 files changed, 28 insertions, 19 deletions
@@ -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, '/'); |