diff options
author | ae <ae@FreeBSD.org> | 2014-07-01 13:29:17 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2014-07-01 13:29:17 +0000 |
commit | b6530ab0a75df248778a68ad2c476a217ce76392 (patch) | |
tree | 0f320b4457b4886d9cb130a9a0010f5d378d8e64 /sys/geom/part/g_part_bsd.c | |
parent | a79b0da86bae072e2bc32c6dd62a668b35e0fd52 (diff) | |
download | FreeBSD-src-b6530ab0a75df248778a68ad2c476a217ce76392.zip FreeBSD-src-b6530ab0a75df248778a68ad2c476a217ce76392.tar.gz |
MFC r267355:
Add UUIDs for DragonFlyBSD's partition types.
MFC r267356:
Add DragonFlyBSD's Hammer FS types and type names.
MFC r267357:
Add aliases for DragonFlyBSD's partition types.
MFC r267358:
Allow dumping to DragonFlyBSD's swap partition.
MFC r267359:
Add disklabel64 support to GEOM_PART class.
This partitioning scheme is used in DragonFlyBSD. It is similar to
BSD disklabel, but has the following improvements:
* metadata has own dedicated place and isn't accessible through partitions;
* all offsets are 64-bit;
* supports 16 partitions by default (has reserved place for more);
* has reserved place for backup label (but not yet implemented);
* has UUIDs for partitions and partition types;
MFC r267360:
Add disklabel64 support
Relnotes: yes
Diffstat (limited to 'sys/geom/part/g_part_bsd.c')
-rw-r--r-- | sys/geom/part/g_part_bsd.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/sys/geom/part/g_part_bsd.c b/sys/geom/part/g_part_bsd.c index 487bf23..5a5eabd 100644 --- a/sys/geom/part/g_part_bsd.c +++ b/sys/geom/part/g_part_bsd.c @@ -112,12 +112,26 @@ static struct g_part_scheme g_part_bsd_scheme = { }; G_PART_SCHEME_DECLARE(g_part_bsd); +static struct g_part_bsd_alias { + uint8_t type; + int alias; +} bsd_alias_match[] = { + { FS_BSDFFS, G_PART_ALIAS_FREEBSD_UFS }, + { FS_SWAP, G_PART_ALIAS_FREEBSD_SWAP }, + { FS_ZFS, G_PART_ALIAS_FREEBSD_ZFS }, + { FS_VINUM, G_PART_ALIAS_FREEBSD_VINUM }, + { FS_NANDFS, G_PART_ALIAS_FREEBSD_NANDFS }, + { FS_HAMMER, G_PART_ALIAS_DFBSD_HAMMER }, + { FS_HAMMER2, G_PART_ALIAS_DFBSD_HAMMER2 }, +}; + static int bsd_parse_type(const char *type, uint8_t *fstype) { const char *alias; char *endp; long lt; + int i; if (type[0] == '!') { lt = strtol(type + 1, &endp, 0); @@ -126,30 +140,13 @@ bsd_parse_type(const char *type, uint8_t *fstype) *fstype = (u_int)lt; return (0); } - alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_NANDFS); - if (!strcasecmp(type, alias)) { - *fstype = FS_NANDFS; - return (0); - } - alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP); - if (!strcasecmp(type, alias)) { - *fstype = FS_SWAP; - return (0); - } - alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_UFS); - if (!strcasecmp(type, alias)) { - *fstype = FS_BSDFFS; - return (0); - } - alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_VINUM); - if (!strcasecmp(type, alias)) { - *fstype = FS_VINUM; - return (0); - } - alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_ZFS); - if (!strcasecmp(type, alias)) { - *fstype = FS_ZFS; - return (0); + for (i = 0; + i < sizeof(bsd_alias_match) / sizeof(bsd_alias_match[0]); i++) { + alias = g_part_alias_name(bsd_alias_match[i].alias); + if (strcasecmp(type, alias) == 0) { + *fstype = bsd_alias_match[i].type; + return (0); + } } return (EINVAL); } |