summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-09-15 16:39:36 +0100
committerRichard Jones <rjones@redhat.com>2010-09-15 17:16:51 +0100
commitffd4820ffe953b0583e3a9357e37d74bed3a2320 (patch)
treef092d285f9c29c7bec17efdbe2cd16a55d168179 /generator
parentff38fea645e69e8f4d84f2691dac3116d9bac1c4 (diff)
downloadlibguestfs-ffd4820ffe953b0583e3a9357e37d74bed3a2320.tar.gz
libguestfs-ffd4820ffe953b0583e3a9357e37d74bed3a2320.tar.xz
libguestfs-ffd4820ffe953b0583e3a9357e37d74bed3a2320.zip
New API: part-to-dev: Convert partition name to device name.
This adds a formal API for going from a partition to the containing device, eg. /dev/sda1 -> /dev/sda
Diffstat (limited to 'generator')
-rw-r--r--generator/generator_actions.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index 014687d1..52c2b7f1 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -5064,6 +5064,20 @@ with the given C<path> name.
See also C<guestfs_stat>.");
+ ("part_to_dev", (RString "device", [Device "partition"]), 272, [],
+ [InitPartition, Always, TestOutputDevice (
+ [["part_to_dev"; "/dev/sda1"]], "/dev/sda");
+ InitEmpty, Always, TestLastFail (
+ [["part_to_dev"; "/dev/sda"]])],
+ "convert partition name to device name",
+ "\
+This function takes a partition name (eg. \"/dev/sdb1\") and
+removes the partition number, returning the device name
+(eg. \"/dev/sdb\").
+
+The named partition must exist, for example as a string returned
+from C<guestfs_list_partitions>.");
+
]
let all_functions = non_daemon_functions @ daemon_functions