Add aliases for DragonFlyBSD's partition types.
MFC after: 2 weeks
This commit is contained in:
parent
12ef67a4d8
commit
0640b71dfe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=267357
@ -108,6 +108,15 @@ struct g_part_alias_list {
|
||||
{ "vmware-vmkdiag", G_PART_ALIAS_VMKDIAG },
|
||||
{ "vmware-reserved", G_PART_ALIAS_VMRESERVED },
|
||||
{ "vmware-vsanhdr", G_PART_ALIAS_VMVSANHDR },
|
||||
{ "dragonfly-label32", G_PART_ALIAS_DFBSD },
|
||||
{ "dragonfly-label64", G_PART_ALIAS_DFBSD64 },
|
||||
{ "dragonfly-swap", G_PART_ALIAS_DFBSD_SWAP },
|
||||
{ "dragonfly-ufs", G_PART_ALIAS_DFBSD_UFS },
|
||||
{ "dragonfly-vinum", G_PART_ALIAS_DFBSD_VINUM },
|
||||
{ "dragonfly-ccd", G_PART_ALIAS_DFBSD_CCD },
|
||||
{ "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY },
|
||||
{ "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER },
|
||||
{ "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 },
|
||||
};
|
||||
|
||||
SYSCTL_DECL(_kern_geom);
|
||||
|
@ -75,6 +75,15 @@ enum g_part_alias {
|
||||
G_PART_ALIAS_VMKDIAG, /* A VMware vmkDiagnostic partition entry */
|
||||
G_PART_ALIAS_VMRESERVED, /* A VMware reserved partition entry */
|
||||
G_PART_ALIAS_VMVSANHDR, /* A VMware vSAN header partition entry */
|
||||
G_PART_ALIAS_DFBSD, /* A DfBSD label32 partition entry */
|
||||
G_PART_ALIAS_DFBSD64, /* A DfBSD label64 partition entry */
|
||||
G_PART_ALIAS_DFBSD_SWAP, /* A DfBSD swap partition entry */
|
||||
G_PART_ALIAS_DFBSD_UFS, /* A DfBSD UFS partition entry */
|
||||
G_PART_ALIAS_DFBSD_VINUM, /* A DfBSD Vinum partition entry */
|
||||
G_PART_ALIAS_DFBSD_CCD, /* A DfBSD CCD partition entry */
|
||||
G_PART_ALIAS_DFBSD_LEGACY, /* A DfBSD legacy partition entry */
|
||||
G_PART_ALIAS_DFBSD_HAMMER, /* A DfBSD HAMMER FS partition entry */
|
||||
G_PART_ALIAS_DFBSD_HAMMER2, /* A DfBSD HAMMER2 FS partition entry */
|
||||
/* Keep the following last */
|
||||
G_PART_ALIAS_COUNT
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -181,6 +181,15 @@ static struct uuid gpt_uuid_netbsd_raid = GPT_ENT_TYPE_NETBSD_RAID;
|
||||
static struct uuid gpt_uuid_netbsd_swap = GPT_ENT_TYPE_NETBSD_SWAP;
|
||||
static struct uuid gpt_uuid_mbr = GPT_ENT_TYPE_MBR;
|
||||
static struct uuid gpt_uuid_unused = GPT_ENT_TYPE_UNUSED;
|
||||
static struct uuid gpt_uuid_dfbsd_swap = GPT_ENT_TYPE_DRAGONFLY_SWAP;
|
||||
static struct uuid gpt_uuid_dfbsd_ufs1 = GPT_ENT_TYPE_DRAGONFLY_UFS1;
|
||||
static struct uuid gpt_uuid_dfbsd_vinum = GPT_ENT_TYPE_DRAGONFLY_VINUM;
|
||||
static struct uuid gpt_uuid_dfbsd_ccd = GPT_ENT_TYPE_DRAGONFLY_CCD;
|
||||
static struct uuid gpt_uuid_dfbsd_legacy = GPT_ENT_TYPE_DRAGONFLY_LEGACY;
|
||||
static struct uuid gpt_uuid_dfbsd_hammer = GPT_ENT_TYPE_DRAGONFLY_HAMMER;
|
||||
static struct uuid gpt_uuid_dfbsd_hammer2 = GPT_ENT_TYPE_DRAGONFLY_HAMMER2;
|
||||
static struct uuid gpt_uuid_dfbsd_label32 = GPT_ENT_TYPE_DRAGONFLY_LABEL32;
|
||||
static struct uuid gpt_uuid_dfbsd_label64 = GPT_ENT_TYPE_DRAGONFLY_LABEL64;
|
||||
|
||||
static struct g_part_uuid_alias {
|
||||
struct uuid *uuid;
|
||||
@ -222,6 +231,15 @@ static struct g_part_uuid_alias {
|
||||
{ &gpt_uuid_netbsd_lfs, G_PART_ALIAS_NETBSD_LFS, 0 },
|
||||
{ &gpt_uuid_netbsd_raid, G_PART_ALIAS_NETBSD_RAID, 0 },
|
||||
{ &gpt_uuid_netbsd_swap, G_PART_ALIAS_NETBSD_SWAP, 0 },
|
||||
{ &gpt_uuid_dfbsd_swap, G_PART_ALIAS_DFBSD_SWAP, 0 },
|
||||
{ &gpt_uuid_dfbsd_ufs1, G_PART_ALIAS_DFBSD_UFS, 0 },
|
||||
{ &gpt_uuid_dfbsd_vinum, G_PART_ALIAS_DFBSD_VINUM, 0 },
|
||||
{ &gpt_uuid_dfbsd_ccd, G_PART_ALIAS_DFBSD_CCD, 0 },
|
||||
{ &gpt_uuid_dfbsd_legacy, G_PART_ALIAS_DFBSD_LEGACY, 0 },
|
||||
{ &gpt_uuid_dfbsd_hammer, G_PART_ALIAS_DFBSD_HAMMER, 0 },
|
||||
{ &gpt_uuid_dfbsd_hammer2, G_PART_ALIAS_DFBSD_HAMMER2, 0 },
|
||||
{ &gpt_uuid_dfbsd_label32, G_PART_ALIAS_DFBSD, 0xa5 },
|
||||
{ &gpt_uuid_dfbsd_label64, G_PART_ALIAS_DFBSD64, 0xa5 },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user