diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-06-13 20:36:40 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-06-13 23:07:26 +0100 |
commit | 46ed232dc2ff2f7dff91cd93a13d7ce6f2cec504 (patch) | |
tree | 7ac4657b5067f50597aa54e2ee4d74d2db6c3054 /align/scan.c | |
parent | 998ebc333dbfe40c5953e36fb42f9610727a7532 (diff) | |
download | libguestfs-46ed232dc2ff2f7dff91cd93a13d7ce6f2cec504.tar.gz libguestfs-46ed232dc2ff2f7dff91cd93a13d7ce6f2cec504.tar.xz libguestfs-46ed232dc2ff2f7dff91cd93a13d7ce6f2cec504.zip |
New API: guestfs_canonical_device_name.
This API makes device names canonical, eg. /dev/vda1 -> /dev/sda1.
Diffstat (limited to 'align/scan.c')
-rw-r--r-- | align/scan.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/align/scan.c b/align/scan.c index adc51ea2..121dc770 100644 --- a/align/scan.c +++ b/align/scan.c @@ -246,7 +246,7 @@ main (int argc, char *argv[]) void scan (size_t *worst_alignment, const char *prefix) { - char **devices; + char **devices, *p; size_t i, j; size_t alignment; uint64_t start; @@ -262,11 +262,11 @@ scan (size_t *worst_alignment, const char *prefix) exit (EXIT_FAILURE); /* Canonicalize the name of the device for printing. */ - if (STRPREFIX (devices[i], "/dev/") && - (devices[i][5] == 'h' || devices[i][5] == 'v') && - devices[i][6] == 'd' && - c_isalpha (devices[i][7])) - devices[i][5] = 's'; + p = guestfs_canonical_device_name (g, devices[i]); + if (p == NULL) + exit (EXIT_FAILURE); + free (devices[i]); + devices[i] = p; for (j = 0; j < parts->len; ++j) { /* Start offset of the partition in bytes. */ |