diff options
author | Karel Zak | 2010-12-17 01:28:59 +0100 |
---|---|---|
committer | Karel Zak | 2010-12-17 01:28:59 +0100 |
commit | 6bec87105cb4f2e5baf9cde14174bee8376e3b32 (patch) | |
tree | f40751962fab339e540c13bbce243171af1d7434 /fdisk/sfdisk.c | |
parent | swpaon: use canonicalized devnames on -s output (diff) | |
download | kernel-qcow2-util-linux-6bec87105cb4f2e5baf9cde14174bee8376e3b32.tar.gz kernel-qcow2-util-linux-6bec87105cb4f2e5baf9cde14174bee8376e3b32.tar.xz kernel-qcow2-util-linux-6bec87105cb4f2e5baf9cde14174bee8376e3b32.zip |
fdisk: use canonicalized names for -l (and sfdisk -d)
.. no more /dev/dm-X in "fdisk -l" and "sfdisk -d" output, always use
/dev/mapper/<name>.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisk/sfdisk.c')
-rw-r--r-- | fdisk/sfdisk.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 958faaebf..d99bf3c3c 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -54,6 +54,8 @@ #include "common.h" #include "wholedisk.h" #include "gpt.h" +#include "pathnames.h" +#include "canonicalize.h" /* * Table of contents: @@ -2423,8 +2425,6 @@ is_ide_cdrom_or_tape(char *device) { return is_ide; } -#define PROC_PARTITIONS "/proc/partitions" - static char * nextproc(FILE *procf) { static char devname[256]; @@ -2441,7 +2441,7 @@ nextproc(FILE *procf) { snprintf(devname, sizeof(devname), "/dev/%s", ptname); if (!is_whole_disk(devname)) continue; - return devname; + return canonicalize_path(devname); } return NULL; @@ -2608,22 +2608,23 @@ main(int argc, char **argv) { /* try all known devices */ total_size = 0; - procf = fopen(PROC_PARTITIONS, "r"); + procf = fopen(_PATH_PROC_PARTITIONS, "r"); if (!procf) - fprintf(stderr, _("cannot open %s\n"), PROC_PARTITIONS); + fprintf(stderr, _("cannot open %s\n"), _PATH_PROC_PARTITIONS); else { while ((dev = nextproc(procf)) != NULL) { - if (is_ide_cdrom_or_tape(dev)) - continue; - gpt_warning(dev, 1); - if (opt_out_geom) - do_geom(dev, 1); - if (opt_out_pt_geom) - do_pt_geom(dev, 1); - if (opt_size) - do_size(dev, 1); - if (opt_list || verify) - do_list(dev, 1); + if (!is_ide_cdrom_or_tape(dev)) { + gpt_warning(dev, 1); + if (opt_out_geom) + do_geom(dev, 1); + if (opt_out_pt_geom) + do_pt_geom(dev, 1); + if (opt_size) + do_size(dev, 1); + if (opt_list || verify) + do_list(dev, 1); + } + free(dev); } fclose(procf); } |