Add a partition type for nandfs to the apm, bsd, gpt and vtoc8 schemes.

The gpart alias for these partition types is "freebsd-nandfs".
This commit is contained in:
Marcel Moolenaar 2012-05-25 20:33:34 +00:00
parent 3c52150e70
commit f24a8224b2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236023
10 changed files with 35 additions and 2 deletions

View File

@ -83,6 +83,7 @@ struct g_part_alias_list {
{ "fat32", G_PART_ALIAS_MS_FAT32 },
{ "freebsd", G_PART_ALIAS_FREEBSD },
{ "freebsd-boot", G_PART_ALIAS_FREEBSD_BOOT },
{ "freebsd-nandfs", G_PART_ALIAS_FREEBSD_NANDFS },
{ "freebsd-swap", G_PART_ALIAS_FREEBSD_SWAP },
{ "freebsd-ufs", G_PART_ALIAS_FREEBSD_UFS },
{ "freebsd-vinum", G_PART_ALIAS_FREEBSD_VINUM },

View File

@ -46,6 +46,7 @@ enum g_part_alias {
G_PART_ALIAS_EFI, /* A EFI system partition entry. */
G_PART_ALIAS_FREEBSD, /* A BSD labeled partition entry. */
G_PART_ALIAS_FREEBSD_BOOT, /* A FreeBSD boot partition entry. */
G_PART_ALIAS_FREEBSD_NANDFS, /* A FreeBSD nandfs partition entry. */
G_PART_ALIAS_FREEBSD_SWAP, /* A swap partition entry. */
G_PART_ALIAS_FREEBSD_UFS, /* A UFS/UFS2 file system entry. */
G_PART_ALIAS_FREEBSD_VINUM, /* A Vinum partition entry. */

View File

@ -159,6 +159,11 @@ apm_parse_type(const char *type, char *buf, size_t bufsz)
strcpy(buf, APM_ENT_TYPE_FREEBSD);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_NANDFS);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_FREEBSD_NANDFS);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_FREEBSD_SWAP);
@ -485,6 +490,8 @@ g_part_apm_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
return (g_part_alias_name(G_PART_ALIAS_APPLE_UFS));
if (!strcmp(type, APM_ENT_TYPE_FREEBSD))
return (g_part_alias_name(G_PART_ALIAS_FREEBSD));
if (!strcmp(type, APM_ENT_TYPE_FREEBSD_NANDFS))
return (g_part_alias_name(G_PART_ALIAS_FREEBSD_NANDFS));
if (!strcmp(type, APM_ENT_TYPE_FREEBSD_SWAP))
return (g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP));
if (!strcmp(type, APM_ENT_TYPE_FREEBSD_UFS))

View File

@ -126,6 +126,11 @@ 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;
@ -450,6 +455,8 @@ g_part_bsd_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
entry = (struct g_part_bsd_entry *)baseentry;
type = entry->part.p_fstype;
if (type == FS_NANDFS)
return (g_part_alias_name(G_PART_ALIAS_FREEBSD_NANDFS));
if (type == FS_SWAP)
return (g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP));
if (type == FS_BSDFFS)

View File

@ -155,6 +155,7 @@ static struct uuid gpt_uuid_bios_boot = GPT_ENT_TYPE_BIOS_BOOT;
static struct uuid gpt_uuid_efi = GPT_ENT_TYPE_EFI;
static struct uuid gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD;
static struct uuid gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
static struct uuid gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS;
static struct uuid gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
static struct uuid gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
static struct uuid gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
@ -195,6 +196,7 @@ static struct g_part_uuid_alias {
{ &gpt_uuid_efi, G_PART_ALIAS_EFI, 0xee },
{ &gpt_uuid_freebsd, G_PART_ALIAS_FREEBSD, 0xa5 },
{ &gpt_uuid_freebsd_boot, G_PART_ALIAS_FREEBSD_BOOT, 0 },
{ &gpt_uuid_freebsd_nandfs, G_PART_ALIAS_FREEBSD_NANDFS, 0 },
{ &gpt_uuid_freebsd_swap, G_PART_ALIAS_FREEBSD_SWAP, 0 },
{ &gpt_uuid_freebsd_ufs, G_PART_ALIAS_FREEBSD_UFS, 0 },
{ &gpt_uuid_freebsd_vinum, G_PART_ALIAS_FREEBSD_VINUM, 0 },

View File

@ -114,6 +114,11 @@ vtoc8_parse_type(const char *type, uint16_t *tag)
*tag = (uint16_t)lt;
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_NANDFS);
if (!strcasecmp(type, alias)) {
*tag = VTOC_TAG_FREEBSD_NANDFS;
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP);
if (!strcasecmp(type, alias)) {
*tag = VTOC_TAG_FREEBSD_SWAP;
@ -487,6 +492,8 @@ g_part_vtoc8_type(struct g_part_table *basetable, struct g_part_entry *entry,
table = (struct g_part_vtoc8_table *)basetable;
tag = be16dec(&table->vtoc.part[entry->gpe_index - 1].tag);
if (tag == VTOC_TAG_FREEBSD_NANDFS)
return (g_part_alias_name(G_PART_ALIAS_FREEBSD_NANDFS));
if (tag == VTOC_TAG_FREEBSD_SWAP)
return (g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP));
if (tag == VTOC_TAG_FREEBSD_UFS)

View File

@ -56,6 +56,7 @@ struct apm_ent {
#define APM_ENT_TYPE_UNUSED "Apple_Free"
#define APM_ENT_TYPE_FREEBSD "FreeBSD"
#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs"
#define APM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap"
#define APM_ENT_TYPE_FREEBSD_UFS "FreeBSD-UFS"
#define APM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum"

View File

@ -232,6 +232,7 @@ static const char *dktypenames[] = {
#define FS_UDF 24 /* UDF */
#define FS_EFS 26 /* SGI's Extent File system */
#define FS_ZFS 27 /* Sun's ZFS */
#define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */
#ifdef FSTYPENAMES
static const char *fstypenames[] = {
@ -263,6 +264,9 @@ static const char *fstypenames[] = {
"?",
"EFS",
"ZFS",
"?",
"?",
"nandfs",
NULL
};
#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)

View File

@ -79,6 +79,10 @@ struct gpt_ent {
{0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}}
#define GPT_ENT_TYPE_FREEBSD \
{0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_BOOT \
{0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}
#define GPT_ENT_TYPE_FREEBSD_NANDFS \
{0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}}
#define GPT_ENT_TYPE_FREEBSD_SWAP \
{0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_UFS \
@ -87,8 +91,6 @@ struct gpt_ent {
{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_ZFS \
{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_BOOT \
{0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}
/*
* The following are unused but documented here to avoid reuse.

View File

@ -51,6 +51,7 @@
#define VTOC_TAG_FREEBSD_UFS 0x0902
#define VTOC_TAG_FREEBSD_VINUM 0x0903
#define VTOC_TAG_FREEBSD_ZFS 0x0904
#define VTOC_TAG_FREEBSD_NANDFS 0x0905
#define VTOC_FLAG_UNMNT 0x01 /* unmountable partition */
#define VTOC_FLAG_RDONLY 0x10 /* partition is read/only */