summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-06-13 20:36:40 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-06-13 23:07:26 +0100
commit46ed232dc2ff2f7dff91cd93a13d7ce6f2cec504 (patch)
tree7ac4657b5067f50597aa54e2ee4d74d2db6c3054 /generator
parent998ebc333dbfe40c5953e36fb42f9610727a7532 (diff)
New API: guestfs_canonical_device_name.
This API makes device names canonical, eg. /dev/vda1 -> /dev/sda1.
Diffstat (limited to 'generator')
-rw-r--r--generator/generator_actions.ml30
1 files changed, 29 insertions, 1 deletions
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index f5da217a..7b2bd97f 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -1734,6 +1734,34 @@ versions of libguestfs the limit was 25.
See L<guestfs(3)/MAXIMUM NUMBER OF DISKS> for additional
information on this topic.");
+ ("canonical_device_name", (RString "canonical", [String "device"], []), -1, [],
+ [],
+ "return canonical device name",
+ "\
+This utility function is useful when displaying device names to
+the user. It takes a number of irregular device names and
+returns them in a consistent format:
+
+=over 4
+
+=item C</dev/hdX>
+
+=item C</dev/vdX>
+
+These are returned as C</dev/sdX>. Note this works for device
+names and partition names. This is approximately the reverse of
+the algorithm described in L<guestfs(3)/BLOCK DEVICE NAMING>.
+
+=item C</dev/mapper/VG-LV>
+
+=item C</dev/dm-N>
+
+Converted to C</dev/VG/LV> form using C<guestfs_lvm_canonical_lvm_name>.
+
+=back
+
+Other strings are returned unmodified.");
+
]
(* daemon_functions are any functions which cause some action
@@ -6132,7 +6160,7 @@ is converted to C</dev/VG/LV>.
This command returns an error if the C<lvname> parameter does
not refer to a logical volume.
-See also C<guestfs_is_lv>.");
+See also C<guestfs_is_lv>, C<guestfs_canonical_device_name>.");
("mkfs_opts", (RErr, [String "fstype"; Device "device"], [OInt "blocksize"; OString "features"; OInt "inode"; OInt "sectorsize"]), 278, [],
[InitEmpty, Always, TestOutput (