[Pkg-libvirt-commits] [libguestfs] 20/40: resize: Simplify if-conditional in mbr_part_type function.
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 3 14:49:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.27.57-1
in repository libguestfs.
commit 49ee9a21333adec00f3f943eaf1712a8ef3273bd
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Mon Sep 29 12:07:19 2014 +0100
resize: Simplify if-conditional in mbr_part_type function.
This should be equivalent to the previous code, but it makes it easier
for the compiler to pick up errors (eg. missing cases).
This updates commit fc34e2d16c2d13d6ae7a381ba931e345ab5ae56d.
---
resize/resize.ml | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/resize/resize.ml b/resize/resize.ml
index daa8232..2090675 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -1096,11 +1096,13 @@ read the man page virt-resize(1).
calculate_target_partitions 1 start ~create_surplus:true partitions in
let mbr_part_type x =
+ match parttype, x.p_part.G.part_num <= 4_l, x.p_type with
(* for GPT, all partitions are regarded as Primary Partition. *)
- if parttype = GPT then "primary"
- else if x.p_part.G.part_num <= 4l && x.p_type <> ContentExtendedPartition then "primary"
- else if x.p_part.G.part_num <= 4l && x.p_type = ContentExtendedPartition then "extended"
- else "logical" in
+ | GPT, _, _ -> "primary"
+ | MBR, true, (ContentUnknown|ContentPV _|ContentFS _) -> "primary"
+ | MBR, true, ContentExtendedPartition -> "extended"
+ | MBR, false, _ -> "logical"
+ in
(* Now partition the target disk. *)
List.iter (
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list