I'm working on a partitioner front-end to parted, and I noticed that in machine mode parted doesn't print the partition type (primary, extended, logical) when listing the partitions. The field is printed in normal mode. The attached patch adds that to the end of the partition information.

I'm not sure this is the right position to put the item, but adding at the end seemed safest. You really need that information, and I'd prefer to not have to dump it in normal mode to get this one item and then dump it in machine mode to get everything else.

Thanks,

-corey
The machine mode did not print out the partition type if it was an
extended partition.  It does print this information in normal mode.
This patch adds printing of the "primary", "extended", or "logical"
as a new field at the end of extended mode.

Index: parted-2.3/parted/parted.c
===================================================================
--- parted-2.3.orig/parted/parted.c
+++ parted-2.3/parted/parted.c
@@ -1685,9 +1685,14 @@ do_print (PedDevice** dev)
                         putchar (':');
 
                     char *flags = partition_print_flags (part);
-                    printf ("%s;\n", flags);
+                    printf ("%s:", flags);
                     free (flags);
 
+		    if (has_extended) {
+			name = ped_partition_type_get_name (part->type);
+			printf ("%s;\n", name);
+		    } else
+			fputs (";\n", stdout);
                 } else {
                     puts ("free;");
                 }
_______________________________________________
bug-parted mailing list
bug-parted@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to