diff options
author | marcel <marcel@FreeBSD.org> | 2002-11-30 22:51:46 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2002-11-30 22:51:46 +0000 |
commit | 29bcc6132f1bebc06d5ce443552043e0094cab83 (patch) | |
tree | cbfde3567a903a7360c528f54528676a08be7205 /sbin/gpt | |
parent | 791bba5ef9dee4c90186e051851f629c7d59a388 (diff) | |
download | FreeBSD-src-29bcc6132f1bebc06d5ce443552043e0094cab83.zip FreeBSD-src-29bcc6132f1bebc06d5ce443552043e0094cab83.tar.gz |
Allow aliases to be used when specifying partition types. The use of
UUIDs can then be limited to those cases when an alias doesn't exist.
This greatly increases the likelyhood that a sysadmin finishes the
partitioning without intermittent mental breakdowns. Current aliases
are "efi", "swap" and "ufs".
While here, staticize global variables and expand the usage message.
Approved by: re (blanket)
Diffstat (limited to 'sbin/gpt')
-rw-r--r-- | sbin/gpt/add.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sbin/gpt/add.c b/sbin/gpt/add.c index 3a8dc6f..ee6454d 100644 --- a/sbin/gpt/add.c +++ b/sbin/gpt/add.c @@ -41,15 +41,15 @@ #include "map.h" #include "gpt.h" -off_t block, size; -uuid_t type; +static uuid_t type; +static off_t block, size; static void usage_add(void) { fprintf(stderr, - "usage: %s [-bst] device\n", getprogname()); + "usage: %s [-b lba] [-s lba] [-t uuid] device\n", getprogname()); exit(1); } @@ -164,8 +164,17 @@ cmd_add(int argc, char *argv[]) usage_add(); uuid_from_string(optarg, &type, &status); if (status != uuid_s_ok) { - /* TODO: accept aliases. */ - usage_add(); + if (strcmp(optarg, "efi") == 0) { + uuid_t efi = GPT_ENT_TYPE_EFI; + type = efi; + } else if (strcmp(optarg, "swap") == 0) { + uuid_t sw = GPT_ENT_TYPE_FREEBSD_SWAP; + type = sw; + } else if (strcmp(optarg, "ufs") == 0) { + uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS; + type = ufs; + } else + usage_add(); } break; default: |