diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2002-10-27 03:23:05 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2002-10-27 03:23:05 +0000 |
commit | 5d5e1c2b12c5ee4599deccf64a7c9db1e522c777 (patch) | |
tree | bb533945621b7c18ab431e6fe7b390ef9a32170c /sbin/gpt/show.c | |
parent | eb0f0a174a88295ee31e727bec7dbbeda6d02b40 (diff) | |
download | src-5d5e1c2b12c5ee4599deccf64a7c9db1e522c777.tar.gz src-5d5e1c2b12c5ee4599deccf64a7c9db1e522c777.zip |
o Add functionality to add a GPT partition,
o Use DCE compliant UUID functions and provide local
implementations if they don't exist,
o Move dumping of the map to show.c and print the
partition type,
o Some cleanups and rearrangements.
The default GPT partition type is UFS. When no starting block
or size are specified, the tool will create a partition in the
first free space it find (or that fits, depending on the size).
Notes
Notes:
svn path=/head/; revision=106013
Diffstat (limited to 'sbin/gpt/show.c')
-rw-r--r-- | sbin/gpt/show.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/sbin/gpt/show.c b/sbin/gpt/show.c index 0eff2d3b6bda..8b651b7e0d40 100644 --- a/sbin/gpt/show.c +++ b/sbin/gpt/show.c @@ -49,6 +49,62 @@ usage_show(void) exit(1); } +static void +show(int fd __unused) +{ + off_t end; + map_t *m; + struct mbr_part *part; + struct gpt_ent *ent; + char *s; + + printf(" %*s", lbawidth, "start"); + printf(" %*s", lbawidth, "end"); + printf(" %*s", lbawidth, "size"); + printf(" %s\n", "contents"); + + m = map_first(); + while (m != NULL) { + end = m->map_start + m->map_size - 1; + printf(" %*llu", lbawidth, (long long)m->map_start); + printf(" %*llu", lbawidth, (long long)end); + printf(" %*llu", lbawidth, (long long)m->map_size); + + putchar(' '); putchar(' '); + switch (m->map_type) { + case MAP_TYPE_MBR: + printf("MBR"); + break; + case MAP_TYPE_PRI_GPT_HDR: + printf("Pri GPT header"); + break; + case MAP_TYPE_SEC_GPT_HDR: + printf("Sec GPT header"); + break; + case MAP_TYPE_PRI_GPT_TBL: + printf("Pri GPT table"); + break; + case MAP_TYPE_SEC_GPT_TBL: + printf("Sec GPT table"); + break; + case MAP_TYPE_MBR_PART: + printf("MBR partition: "); + part = m->map_data; + printf("type=%d", part->part_typ); + break; + case MAP_TYPE_GPT_PART: + printf("GPT partition: "); + ent = m->map_data; + uuid_to_string(&ent->ent_type, &s, NULL); + printf("type=%s", s); + free(s); + break; + } + putchar('\n'); + m = m->map_next; + } +} + int cmd_show(int argc, char *argv[]) { @@ -71,7 +127,7 @@ cmd_show(int argc, char *argv[]) continue; } - map_dump(); + show(fd); gpt_close(fd); } |