OSDN Git Service

gpt: adjust formatting and rename a parameter: s/supported/max_n/.
authorJim Meyering <meyering@redhat.com>
Thu, 5 Mar 2009 10:03:45 +0000 (11:03 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 5 Mar 2009 14:57:31 +0000 (15:57 +0100)
* libparted/labels/gpt.c (gpt_get_max_supported_partition_count): Rename
parameter: s/supported/max_n/.  The latter sounds more like a number,
while "supported" sounds boolean at first.

libparted/labels/gpt.c

index aeaee8a..be8f264 100644 (file)
@@ -1501,24 +1501,24 @@ gpt_get_max_primary_partition_count (const PedDisk *disk)
  * SP = Blocksize(FirstusableLBA - 2) / SizeOfPartitoinEntry
  */
 static bool
-gpt_get_max_supported_partition_count (const PedDisk *disk, int *supported)
+gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n)
 {
        GuidPartitionTableHeader_t *pth = NULL;
-       uint8_t *pth_raw = ped_malloc (pth_get_size(disk->dev));
-
-       if(ped_device_read(disk->dev, pth_raw, 1, GPT_HEADER_SECTORS) ||
-                       ped_device_read(disk->dev, pth_raw, disk->dev->length, GPT_HEADER_SECTORS))
-               pth = pth_new_from_raw(disk->dev, pth_raw);
-       free(pth_raw);
-
-       if(pth){
-               *supported = (disk->dev->sector_size*(pth->FirstUsableLBA - 2) /
-                               pth->SizeOfPartitionEntry);
-               pth_free(pth);
-               return true;
-       }
+       uint8_t *pth_raw = ped_malloc (pth_get_size (disk->dev));
+
+       if (ped_device_read (disk->dev, pth_raw, 1, GPT_HEADER_SECTORS)
+           || ped_device_read (disk->dev, pth_raw,
+                               disk->dev->length, GPT_HEADER_SECTORS))
+               pth = pth_new_from_raw (disk->dev, pth_raw);
+       free (pth_raw);
+
+       if (pth == NULL)
+               return false;
 
-       return false;
+       *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2)
+                 / pth->SizeOfPartitionEntry);
+       pth_free (pth);
+       return true;
 }
 
 static PedConstraint*