]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: provide more details about GPT
authorKarel Zak <kzak@redhat.com>
Fri, 12 Jul 2013 10:35:16 +0000 (12:35 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:47:08 +0000 (16:47 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c

index 59b634bb0bf78e050e467e0e66b2d7d6b5f5762f..eed7a6f06cefe1bf562b9ea0b982ceb289608f64 100644 (file)
@@ -1127,6 +1127,7 @@ static int gpt_list_disklabel(struct fdisk_context *cxt)
        int rc, trunc = TT_FL_TRUNC;
        uint32_t i;
        struct fdisk_gpt_label *gpt;
+       struct gpt_header *h;
        uint64_t fu;
        uint64_t lu;
        struct tt *tb = NULL;
@@ -1136,6 +1137,7 @@ static int gpt_list_disklabel(struct fdisk_context *cxt)
        assert(fdisk_is_disklabel(cxt, GPT));
 
        gpt = self_label(cxt);
+       h = gpt->pheader;
        fu = le64_to_cpu(gpt->pheader->first_usable_lba);
        lu = le64_to_cpu(gpt->pheader->last_usable_lba);
 
@@ -1144,9 +1146,14 @@ static int gpt_list_disklabel(struct fdisk_context *cxt)
                return -ENOMEM;
 
        /* don't trunc anything in expert mode */
-       if (fdisk_context_display_details(cxt))
+       if (fdisk_context_display_details(cxt)) {
                trunc = 0;
-
+               fdisk_info(cxt, _("First LBA: %ju"), h->first_usable_lba);
+               fdisk_info(cxt, _("Last LBA: %ju"), h->last_usable_lba);
+               fdisk_info(cxt, _("Alternative LBA: %ju"), h->alternative_lba);
+               fdisk_info(cxt, _("Partitions entries LBA: %ju"), h->partition_entry_lba);
+               fdisk_info(cxt, _("Allocated partition entries: %ju"), h->npartition_entries);
+       }
        tt_define_column(tb, _("Device"), 0.1, 0);
        tt_define_column(tb, _("Start"),   12, TT_FL_RIGHT);
        tt_define_column(tb, _("End"),     12, TT_FL_RIGHT);
@@ -1158,7 +1165,7 @@ static int gpt_list_disklabel(struct fdisk_context *cxt)
                tt_define_column(tb, _("Name"), 0.2, trunc);
        }
 
-       for (i = 0; i < le32_to_cpu(gpt->pheader->npartition_entries); i++) {
+       for (i = 0; i < le32_to_cpu(h->npartition_entries); i++) {
                struct gpt_entry *e = &gpt->ents[i];
                char *sizestr = NULL, *p;
                uint64_t start = gpt_partition_start(e);