[PATCH 1/3] gpt: adjust formatting and rename a parameter: s/supported/max_n/.

Jim Meyering meyering at redhat.com
Thu Mar 5 10:03:45 UTC 2009


* 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 |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index aeaee8a..be8f264 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -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*
--
1.6.2.rc1.285.gc5f54




More information about the parted-devel mailing list