cmd: part: list all 128 GPT partitions
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 11 Jan 2022 15:03:38 +0000 (16:03 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 15 Jan 2022 09:57:22 +0000 (10:57 +0100)
A GPT partition table typically has 128 entries. If a partition table
contains a partition 128 'part list' should be able to list it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
cmd/part.c
include/part.h

index e0463b5..9d419c9 100644 (file)
@@ -89,10 +89,10 @@ static int do_part_list(int argc, char *const argv[])
 
        if (var != NULL) {
                int p;
-               char str[512] = { '\0', };
+               char str[3 * MAX_SEARCH_PARTITIONS] = { '\0', };
                struct disk_partition info;
 
-               for (p = 1; p < MAX_SEARCH_PARTITIONS; p++) {
+               for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
                        char t[5];
                        int r = part_get_info(desc, p, &info);
 
index b66b07a..b8d8e1f 100644 (file)
@@ -50,7 +50,7 @@ struct block_drvr {
 
 #define PART_NAME_LEN 32
 #define PART_TYPE_LEN 32
-#define MAX_SEARCH_PARTITIONS 64
+#define MAX_SEARCH_PARTITIONS 128
 
 #define PART_BOOTABLE                  ((int)BIT(0))
 #define PART_EFI_SYSTEM_PARTITION      ((int)BIT(1))