Module Name: src
Committed By: jnemeth
Date: Mon Dec 9 01:35:02 UTC 2013
Modified Files:
src/sbin/gpt: gpt.8 show.c
Log Message:
For the "show -i <entry>" subcommand, print Start and Size both in
terms of number of sectors and bytes.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.13 -r1.14 src/sbin/gpt/show.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.23 src/sbin/gpt/gpt.8:1.24
--- src/sbin/gpt/gpt.8:1.23 Sun Dec 8 09:32:51 2013
+++ src/sbin/gpt/gpt.8 Mon Dec 9 01:35:02 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.23 2013/12/08 09:32:51 jnemeth Exp $
+.\" $NetBSD: gpt.8,v 1.24 2013/12/09 01:35:02 jnemeth Exp $
.\"
.\" Copyright (c) 2002 Marcel Moolenaar
.\" All rights reserved.
@@ -365,6 +365,7 @@ user friendly form.
With the
.Fl i
option, all the details of a particular GPT partition will be displayed.
+The format of this display is subject to change.
None of the options have any effect on non-GPT partitions.
The order of precedence for the options are:
.Fl i ,
Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.13 src/sbin/gpt/show.c:1.14
--- src/sbin/gpt/show.c:1.13 Sun Dec 8 08:30:01 2013
+++ src/sbin/gpt/show.c Mon Dec 9 01:35:02 2013
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.13 2013/12/08 08:30:01 jnemeth Exp $");
+__RCSID("$NetBSD: show.c,v 1.14 2013/12/09 01:35:02 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -223,7 +223,7 @@ show_one(void)
map_t *m;
struct gpt_ent *ent;
const char *s1;
- char *s2;
+ char *s2, human_num[5];
for (m = map_first(); m != NULL; m = m->map_next)
if (entry == m->map_index)
@@ -236,8 +236,21 @@ show_one(void)
ent = m->map_data;
printf("Details for index %d:\n", entry);
- printf("Start: %llu\n", (long long)m->map_start);
- printf("Size: %llu\n", (long long)m->map_size);
+ if (humanize_number(human_num, 5, (int64_t)(m->map_start * secsz),
+ "", HN_AUTOSCALE, HN_NOSPACE|HN_B) < 0)
+ human_num[0] = '\0';
+ if (human_num[0] != '\0')
+ printf("Start: %llu (%s)\n", (long long)m->map_start,
+ human_num);
+ else
+ printf("Start: %llu\n", (long long)m->map_start);
+ if (humanize_number(human_num, 5, (int64_t)(m->map_size * secsz),
+ "", HN_AUTOSCALE, HN_NOSPACE|HN_B) < 0)
+ human_num[0] = '\0';
+ if (human_num[0] != '\0')
+ printf("Size: %llu (%s)\n", (long long)m->map_size, human_num);
+ else
+ printf("Size: %llu\n", (long long)m->map_size);
le_uuid_dec(ent->ent_type, &type);
s1 = friendly(&type);