summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-04-10 13:19:43 +0100
committerRichard Jones <rjones@redhat.com>2010-04-10 13:43:35 +0100
commitb68c030adfdbefe65bc9ecdd673844c01bddb32a (patch)
treefbdb4f081db99bd9d36a4521f0b0987dae2ccee1 /src
parentcb9350019cc6382a35c98f522c9c4d221c92b605 (diff)
downloadlibguestfs-b68c030adfdbefe65bc9ecdd673844c01bddb32a.tar.gz
libguestfs-b68c030adfdbefe65bc9ecdd673844c01bddb32a.tar.xz
libguestfs-b68c030adfdbefe65bc9ecdd673844c01bddb32a.zip
New partition APIs: part_del, part_get_bootable, part_get/set_mbr_id
These APIs flesh out further the partitioning API.
Diffstat (limited to 'src')
-rw-r--r--src/MAX_PROC_NR2
-rwxr-xr-xsrc/generator.ml55
2 files changed, 56 insertions, 1 deletions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index dcb6b5ba..f1f094b1 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-230
+236
diff --git a/src/generator.ml b/src/generator.ml
index 2b833c11..50ae91d0 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4388,6 +4388,61 @@ See also L<ntfsresize(8)>.");
This rescans all block devices and rebuilds the list of LVM
physical volumes, volume groups and logical volumes.");
+ ("part_del", (RErr, [Device "device"; Int "partnum"]), 233, [],
+ [InitEmpty, Always, TestRun (
+ [["part_init"; "/dev/sda"; "mbr"];
+ ["part_add"; "/dev/sda"; "primary"; "1"; "-1"];
+ ["part_del"; "/dev/sda"; "1"]])],
+ "delete a partition",
+ "\
+This command deletes the partition numbered C<partnum> on C<device>.
+
+Note that in the case of MBR partitioning, deleting an
+extended partition also deletes any logical partitions
+it contains.");
+
+ ("part_get_bootable", (RBool "bootable", [Device "device"; Int "partnum"]), 234, [],
+ [InitEmpty, Always, TestOutputTrue (
+ [["part_init"; "/dev/sda"; "mbr"];
+ ["part_add"; "/dev/sda"; "primary"; "1"; "-1"];
+ ["part_set_bootable"; "/dev/sda"; "1"; "true"];
+ ["part_get_bootable"; "/dev/sda"; "1"]])],
+ "return true if a partition is bootable",
+ "\
+This command returns true if the partition C<partnum> on
+C<device> has the bootable flag set.
+
+See also C<guestfs_part_set_bootable>.");
+
+ ("part_get_mbr_id", (RInt "idbyte", [Device "device"; Int "partnum"]), 235, [],
+ [InitEmpty, Always, TestOutputInt (
+ [["part_init"; "/dev/sda"; "mbr"];
+ ["part_add"; "/dev/sda"; "primary"; "1"; "-1"];
+ ["part_set_mbr_id"; "/dev/sda"; "1"; "0x7f"];
+ ["part_get_mbr_id"; "/dev/sda"; "1"]], 0x7f)],
+ "get the MBR type byte (ID byte) from a partition",
+ "\
+Returns the MBR type byte (also known as the ID byte) from
+the numbered partition C<partnum>.
+
+Note that only MBR (old DOS-style) partitions have type bytes.
+You will get undefined results for other partition table
+types (see C<guestfs_part_get_parttype>).");
+
+ ("part_set_mbr_id", (RErr, [Device "device"; Int "partnum"; Int "idbyte"]), 236, [],
+ [], (* tested by part_get_mbr_id *)
+ "set the MBR type byte (ID byte) of a partition",
+ "\
+Sets the MBR type byte (also known as the ID byte) of
+the numbered partition C<partnum> to C<idbyte>. Note
+that the type bytes quoted in most documentation are
+in fact hexadecimal numbers, but usually documented
+without any leading \"0x\" which might be confusing.
+
+Note that only MBR (old DOS-style) partitions have type bytes.
+You will get undefined results for other partition table
+types (see C<guestfs_part_get_parttype>).");
+
]
let all_functions = non_daemon_functions @ daemon_functions