[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v2 04/13] resize: introduce filter_part



Signed-off-by: Hu Tao <hutao cn fujitsu com>
---
 resize/resize.ml | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index e69e486..660ac86 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -453,14 +453,19 @@ read the man page virt-resize(1).
       error (f_"the source disk has no partitions");
 
     (* Filter out logical partitions.  See note above. *)
-    let parts =
+    let filter_part part_type parts =
       match parttype with
       | GPT -> parts
       | MBR ->
-        List.filter (function
-        | { G.part_num = part_num } when part_num >= 5_l -> false
-        | _ -> true
-        ) parts in
+        match part_type with
+        | PrimaryPartition ->
+          List.filter (function
+          | { G.part_num = part_num } when part_num >= 5_l -> false
+          | _ -> true
+          ) parts
+    in
+
+    let parts = filter_part PrimaryPartition parts in
 
     let partitions =
       List.map (
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]