1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

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)
This commit is contained in:
Marcel Moolenaar 2002-11-30 22:51:46 +00:00
parent 0c920c0de8
commit b103cd4113
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107427

View File

@ -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: