bug-parted
[Top][All Lists]
Advanced

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

Patch to print the partition type in machine mode


From: Corey Minyard
Subject: Patch to print the partition type in machine mode
Date: Thu, 10 Jun 2010 13:31:43 -0500
User-agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)

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;");
                 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]