Changeset View
Changeset View
Standalone View
Standalone View
head/stand/common/part.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
#ifdef LOADER_GPT_SUPPORT | #ifdef LOADER_GPT_SUPPORT | ||||
#define MAXTBLSZ 64 | #define MAXTBLSZ 64 | ||||
static const uuid_t gpt_uuid_unused = GPT_ENT_TYPE_UNUSED; | static const uuid_t gpt_uuid_unused = GPT_ENT_TYPE_UNUSED; | ||||
static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; | static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; | ||||
static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; | static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; | ||||
static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; | static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; | ||||
static const uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; | static const uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; | ||||
static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; | static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; | ||||
static const uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS; | |||||
static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; | static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; | ||||
static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; | static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; | ||||
static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; | static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; | ||||
#endif | #endif | ||||
struct pentry { | struct pentry { | ||||
struct ptable_entry part; | struct ptable_entry part; | ||||
uint64_t flags; | uint64_t flags; | ||||
Show All 17 Lines | |||||
static struct parttypes { | static struct parttypes { | ||||
enum partition_type type; | enum partition_type type; | ||||
const char *desc; | const char *desc; | ||||
} ptypes[] = { | } ptypes[] = { | ||||
{ PART_UNKNOWN, "Unknown" }, | { PART_UNKNOWN, "Unknown" }, | ||||
{ PART_EFI, "EFI" }, | { PART_EFI, "EFI" }, | ||||
{ PART_FREEBSD, "FreeBSD" }, | { PART_FREEBSD, "FreeBSD" }, | ||||
{ PART_FREEBSD_BOOT, "FreeBSD boot" }, | { PART_FREEBSD_BOOT, "FreeBSD boot" }, | ||||
{ PART_FREEBSD_NANDFS, "FreeBSD nandfs" }, | |||||
{ PART_FREEBSD_UFS, "FreeBSD UFS" }, | { PART_FREEBSD_UFS, "FreeBSD UFS" }, | ||||
{ PART_FREEBSD_ZFS, "FreeBSD ZFS" }, | { PART_FREEBSD_ZFS, "FreeBSD ZFS" }, | ||||
{ PART_FREEBSD_SWAP, "FreeBSD swap" }, | { PART_FREEBSD_SWAP, "FreeBSD swap" }, | ||||
{ PART_FREEBSD_VINUM, "FreeBSD vinum" }, | { PART_FREEBSD_VINUM, "FreeBSD vinum" }, | ||||
{ PART_LINUX, "Linux" }, | { PART_LINUX, "Linux" }, | ||||
{ PART_LINUX_SWAP, "Linux swap" }, | { PART_LINUX_SWAP, "Linux swap" }, | ||||
{ PART_DOS, "DOS/Windows" }, | { PART_DOS, "DOS/Windows" }, | ||||
{ PART_ISO9660, "ISO9660" }, | { PART_ISO9660, "ISO9660" }, | ||||
Show All 33 Lines | gpt_parttype(uuid_t type) | ||||
else if (uuid_equal(&type, &gpt_uuid_freebsd_ufs, NULL)) | else if (uuid_equal(&type, &gpt_uuid_freebsd_ufs, NULL)) | ||||
return (PART_FREEBSD_UFS); | return (PART_FREEBSD_UFS); | ||||
else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL)) | else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL)) | ||||
return (PART_FREEBSD_ZFS); | return (PART_FREEBSD_ZFS); | ||||
else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL)) | else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL)) | ||||
return (PART_FREEBSD_SWAP); | return (PART_FREEBSD_SWAP); | ||||
else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL)) | else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL)) | ||||
return (PART_FREEBSD_VINUM); | return (PART_FREEBSD_VINUM); | ||||
else if (uuid_equal(&type, &gpt_uuid_freebsd_nandfs, NULL)) | |||||
return (PART_FREEBSD_NANDFS); | |||||
else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL)) | else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL)) | ||||
return (PART_FREEBSD); | return (PART_FREEBSD); | ||||
return (PART_UNKNOWN); | return (PART_UNKNOWN); | ||||
} | } | ||||
static struct gpt_hdr * | static struct gpt_hdr * | ||||
gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last, | gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last, | ||||
uint16_t sectorsize) | uint16_t sectorsize) | ||||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
#endif /* LOADER_MBR_SUPPORT */ | #endif /* LOADER_MBR_SUPPORT */ | ||||
static enum partition_type | static enum partition_type | ||||
bsd_parttype(uint8_t type) | bsd_parttype(uint8_t type) | ||||
{ | { | ||||
switch (type) { | switch (type) { | ||||
case FS_NANDFS: | |||||
return (PART_FREEBSD_NANDFS); | |||||
case FS_SWAP: | case FS_SWAP: | ||||
return (PART_FREEBSD_SWAP); | return (PART_FREEBSD_SWAP); | ||||
case FS_BSDFFS: | case FS_BSDFFS: | ||||
return (PART_FREEBSD_UFS); | return (PART_FREEBSD_UFS); | ||||
case FS_VINUM: | case FS_VINUM: | ||||
return (PART_FREEBSD_VINUM); | return (PART_FREEBSD_VINUM); | ||||
case FS_ZFS: | case FS_ZFS: | ||||
return (PART_FREEBSD_ZFS); | return (PART_FREEBSD_ZFS); | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
#ifdef LOADER_VTOC8_SUPPORT | #ifdef LOADER_VTOC8_SUPPORT | ||||
static enum partition_type | static enum partition_type | ||||
vtoc8_parttype(uint16_t type) | vtoc8_parttype(uint16_t type) | ||||
{ | { | ||||
switch (type) { | switch (type) { | ||||
case VTOC_TAG_FREEBSD_NANDFS: | |||||
return (PART_FREEBSD_NANDFS); | |||||
case VTOC_TAG_FREEBSD_SWAP: | case VTOC_TAG_FREEBSD_SWAP: | ||||
return (PART_FREEBSD_SWAP); | return (PART_FREEBSD_SWAP); | ||||
case VTOC_TAG_FREEBSD_UFS: | case VTOC_TAG_FREEBSD_UFS: | ||||
return (PART_FREEBSD_UFS); | return (PART_FREEBSD_UFS); | ||||
case VTOC_TAG_FREEBSD_VINUM: | case VTOC_TAG_FREEBSD_VINUM: | ||||
return (PART_FREEBSD_VINUM); | return (PART_FREEBSD_VINUM); | ||||
case VTOC_TAG_FREEBSD_ZFS: | case VTOC_TAG_FREEBSD_ZFS: | ||||
return (PART_FREEBSD_ZFS); | return (PART_FREEBSD_ZFS); | ||||
▲ Show 20 Lines • Show All 410 Lines • Show Last 20 Lines |