diff options
Diffstat (limited to 'stand/common/part.c')
-rw-r--r-- | stand/common/part.c | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/stand/common/part.c b/stand/common/part.c index 4ae38bfb7682..5f7bc2103c01 100644 --- a/stand/common/part.c +++ b/stand/common/part.c @@ -24,9 +24,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <stand.h> #include <sys/param.h> #include <sys/diskmbr.h> @@ -35,7 +32,6 @@ __FBSDID("$FreeBSD$"); #include <sys/gpt.h> #include <sys/stddef.h> #include <sys/queue.h> -#include <sys/vtoc.h> #include <fs/cd9660/iso.h> @@ -70,7 +66,6 @@ struct pentry { uint8_t bsd; uint8_t mbr; uuid_t gpt; - uint16_t vtoc8; } type; STAILQ_ENTRY(pentry) entry; }; @@ -519,88 +514,6 @@ out: return (table); } -#ifdef LOADER_VTOC8_SUPPORT -static enum partition_type -vtoc8_parttype(uint16_t type) -{ - - switch (type) { - case VTOC_TAG_FREEBSD_SWAP: - return (PART_FREEBSD_SWAP); - case VTOC_TAG_FREEBSD_UFS: - return (PART_FREEBSD_UFS); - case VTOC_TAG_FREEBSD_VINUM: - return (PART_FREEBSD_VINUM); - case VTOC_TAG_FREEBSD_ZFS: - return (PART_FREEBSD_ZFS); - } - return (PART_UNKNOWN); -} - -static struct ptable * -ptable_vtoc8read(struct ptable *table, void *dev, diskread_t dread) -{ - struct pentry *entry; - struct vtoc8 *dl; - uint8_t *buf; - uint16_t sum, heads, sectors; - int i; - - if (table->sectorsize != sizeof(struct vtoc8)) - return (table); - buf = malloc(table->sectorsize); - if (buf == NULL) - return (table); - if (dread(dev, buf, 1, 0) != 0) { - DPRINTF("read failed"); - ptable_close(table); - table = NULL; - goto out; - } - dl = (struct vtoc8 *)buf; - /* Check the sum */ - for (i = sum = 0; i < sizeof(struct vtoc8); i += sizeof(sum)) - sum ^= be16dec(buf + i); - if (sum != 0) { - DPRINTF("incorrect checksum"); - goto out; - } - if (be16toh(dl->nparts) != VTOC8_NPARTS) { - DPRINTF("invalid number of entries"); - goto out; - } - sectors = be16toh(dl->nsecs); - heads = be16toh(dl->nheads); - if (sectors * heads == 0) { - DPRINTF("invalid geometry"); - goto out; - } - DPRINTF("VTOC8 detected"); - for (i = 0; i < VTOC8_NPARTS; i++) { - dl->part[i].tag = be16toh(dl->part[i].tag); - if (i == VTOC_RAW_PART || - dl->part[i].tag == VTOC_TAG_UNASSIGNED) - continue; - entry = malloc(sizeof(*entry)); - if (entry == NULL) - break; - entry->part.start = be32toh(dl->map[i].cyl) * heads * sectors; - entry->part.end = be32toh(dl->map[i].nblks) + - entry->part.start - 1; - entry->part.type = vtoc8_parttype(dl->part[i].tag); - entry->part.index = i; /* starts from zero */ - entry->type.vtoc8 = dl->part[i].tag; - STAILQ_INSERT_TAIL(&table->entries, entry, entry); - DPRINTF("new VTOC8 partition added"); - } - table->type = PTABLE_VTOC8; -out: - free(buf); - return (table); - -} -#endif /* LOADER_VTOC8_SUPPORT */ - #define cdb2devb(bno) ((bno) * ISO_DEFAULT_BLOCK_SIZE / table->sectorsize) static struct ptable * @@ -678,16 +591,6 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, } else if (table->type == PTABLE_ISO9660) goto out; -#ifdef LOADER_VTOC8_SUPPORT - if (be16dec(buf + offsetof(struct vtoc8, magic)) == VTOC_MAGIC) { - if (ptable_vtoc8read(table, dev, dread) == NULL) { - /* Read error. */ - table = NULL; - goto out; - } else if (table->type == PTABLE_VTOC8) - goto out; - } -#endif /* Check the BSD label. */ if (ptable_bsdread(table, dev, dread) == NULL) { /* Read error. */ table = NULL; @@ -929,12 +832,6 @@ ptable_iterate(const struct ptable *table, void *arg, ptable_iterate_t *iter) sprintf(name, "p%d", entry->part.index); else #endif -#ifdef LOADER_VTOC8_SUPPORT - if (table->type == PTABLE_VTOC8) - sprintf(name, "%c", (uint8_t) 'a' + - entry->part.index); - else -#endif if (table->type == PTABLE_BSD) sprintf(name, "%c", (uint8_t) 'a' + entry->part.index); |