[parted-devel] [PATCH 2/4] parted: print disk flags

Jim Meyering jim at meyering.net
Wed Feb 1 18:11:12 UTC 2012


bcl at redhat.com wrote:
> This adds a 'Disk Flags:' line the displays the active disk flags.
> In machine mode this is appended to the disk info line, after the
> device model.
>
> * parted/parted.c (disk_print_flags): New function
> (_print_disk_info): Add Disk Flags information.

Thanks for writing this up.
I am now going through it.
I see that your new disk_print_flags copied from the partition_print_flags
just above it, but the copied-from function had several problems,
not least of which is a possible NULL-dereference bug (upon ped_malloc
failure), but I'll do that clean up separately.

However, one change is required, to avoid a compiler warning:

  - add const attribute on parameter

diff --git a/parted/parted.c b/parted/parted.c
index e4ba60a..a1b8c2f 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -901,7 +901,7 @@ partition_print (PedPartition* part)
 }

 static char*
-disk_print_flags (PedDisk* disk)
+disk_print_flags (PedDisk const *disk)
 {
         PedDiskFlag     flag;
         int             first_flag;



More information about the parted-devel mailing list