1995-04-28 23:57:04 +00:00
|
|
|
/*
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
2002-03-25 13:52:45 +00:00
|
|
|
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
|
1995-04-28 23:57:04 +00:00
|
|
|
* can do whatever you want with this stuff. If we meet some day, and you think
|
|
|
|
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2001-09-30 21:16:57 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1995-04-28 23:57:04 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <string.h>
|
2002-10-29 12:13:36 +00:00
|
|
|
#include <inttypes.h>
|
2001-04-01 11:32:56 +00:00
|
|
|
#include <err.h>
|
2000-06-23 14:01:06 +00:00
|
|
|
#include <sys/sysctl.h>
|
2002-10-29 12:13:36 +00:00
|
|
|
#include <sys/stdint.h>
|
1995-04-28 23:57:04 +00:00
|
|
|
#include <sys/types.h>
|
1995-04-29 04:50:39 +00:00
|
|
|
#include <sys/stat.h>
|
1995-04-28 23:57:04 +00:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/disklabel.h>
|
2002-11-02 12:14:04 +00:00
|
|
|
#include <sys/uuid.h>
|
|
|
|
#include <sys/gpt.h>
|
2000-06-28 22:28:50 +00:00
|
|
|
#include <paths.h>
|
1995-04-28 23:57:04 +00:00
|
|
|
#include "libdisk.h"
|
|
|
|
|
2002-10-19 16:39:28 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <assert.h>
|
2002-11-02 12:14:04 +00:00
|
|
|
#include <uuid.h>
|
2002-10-19 16:39:28 +00:00
|
|
|
|
2003-04-30 17:14:58 +00:00
|
|
|
const enum platform platform =
|
|
|
|
#if defined (P_DEBUG)
|
|
|
|
P_DEBUG
|
|
|
|
#elif defined (PC98)
|
|
|
|
p_pc98
|
|
|
|
#elif defined(__i386__)
|
|
|
|
p_i386
|
|
|
|
#elif defined(__alpha__)
|
|
|
|
p_alpha
|
|
|
|
#elif defined(__sparc64__)
|
|
|
|
p_sparc64
|
|
|
|
#elif defined(__ia64__)
|
|
|
|
p_ia64
|
|
|
|
#elif defined(__ppc__)
|
|
|
|
p_ppc
|
2003-04-30 21:03:16 +00:00
|
|
|
#elif defined(__amd64__)
|
|
|
|
p_amd64
|
2003-04-30 17:14:58 +00:00
|
|
|
#else
|
|
|
|
IHAVENOIDEA
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
2002-10-29 12:13:36 +00:00
|
|
|
const char *
|
|
|
|
chunk_name(chunk_e type)
|
|
|
|
{
|
|
|
|
switch(type) {
|
|
|
|
case unused: return ("unused");
|
|
|
|
case mbr: return ("mbr");
|
|
|
|
case part: return ("part");
|
|
|
|
case gpt: return ("gpt");
|
|
|
|
case pc98: return ("pc98");
|
|
|
|
case sun: return ("sun");
|
|
|
|
case freebsd: return ("freebsd");
|
|
|
|
case fat: return ("fat");
|
|
|
|
case spare: return ("spare");
|
2002-11-10 20:53:10 +00:00
|
|
|
case efi: return ("efi");
|
2004-04-21 23:21:13 +00:00
|
|
|
case apple: return ("apple");
|
2002-10-29 12:13:36 +00:00
|
|
|
default: return ("??");
|
|
|
|
}
|
2004-05-16 22:08:17 +00:00
|
|
|
}
|
1995-05-03 17:38:00 +00:00
|
|
|
|
1995-04-28 23:57:04 +00:00
|
|
|
struct disk *
|
1996-03-24 18:55:39 +00:00
|
|
|
Open_Disk(const char *name)
|
1995-04-28 23:57:04 +00:00
|
|
|
{
|
2003-11-02 08:39:08 +00:00
|
|
|
char *conftxt;
|
2002-10-29 12:13:36 +00:00
|
|
|
size_t txtsize;
|
2003-11-02 08:39:08 +00:00
|
|
|
int error;
|
2002-10-29 12:13:36 +00:00
|
|
|
|
|
|
|
error = sysctlbyname("kern.geom.conftxt", NULL, &txtsize, NULL, 0);
|
2002-10-19 16:39:28 +00:00
|
|
|
if (error) {
|
2002-10-29 12:13:36 +00:00
|
|
|
warn("kern.geom.conftxt sysctl not available, giving up!");
|
|
|
|
return (NULL);
|
2002-10-19 16:39:28 +00:00
|
|
|
}
|
2003-11-02 08:39:08 +00:00
|
|
|
conftxt = malloc(txtsize+1);
|
2002-10-29 12:13:36 +00:00
|
|
|
if (conftxt == NULL) {
|
2003-11-02 08:39:08 +00:00
|
|
|
warn("cannot malloc memory for conftxt");
|
2002-10-29 12:13:36 +00:00
|
|
|
return (NULL);
|
2002-10-19 16:39:28 +00:00
|
|
|
}
|
2002-10-29 12:13:36 +00:00
|
|
|
error = sysctlbyname("kern.geom.conftxt", conftxt, &txtsize, NULL, 0);
|
2002-10-19 16:39:28 +00:00
|
|
|
if (error) {
|
2003-11-02 08:39:08 +00:00
|
|
|
warn("error reading kern.geom.conftxt from the system");
|
2002-10-29 12:13:36 +00:00
|
|
|
free(conftxt);
|
|
|
|
return (NULL);
|
2002-10-19 16:39:28 +00:00
|
|
|
}
|
2002-10-29 12:13:36 +00:00
|
|
|
conftxt[txtsize] = '\0'; /* in case kernel bug is still there */
|
2002-10-19 16:39:28 +00:00
|
|
|
|
2003-11-02 08:39:08 +00:00
|
|
|
return Int_Open_Disk(name, conftxt);
|
1995-04-28 23:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Debug_Disk(struct disk *d)
|
|
|
|
{
|
2002-11-15 13:24:29 +00:00
|
|
|
|
2001-04-01 12:18:20 +00:00
|
|
|
printf("Debug_Disk(%s)", d->name);
|
2003-11-02 08:39:08 +00:00
|
|
|
|
|
|
|
#ifndef __ia64__
|
1996-11-27 22:44:43 +00:00
|
|
|
printf(" bios_geom=%lu/%lu/%lu = %lu\n",
|
2001-04-01 12:18:20 +00:00
|
|
|
d->bios_cyl, d->bios_hd, d->bios_sect,
|
|
|
|
d->bios_cyl * d->bios_hd * d->bios_sect);
|
2002-10-31 05:51:25 +00:00
|
|
|
#if defined(PC98)
|
|
|
|
printf(" boot1=%p, boot2=%p, bootipl=%p, bootmenu=%p\n",
|
|
|
|
d->boot1, d->boot2, d->bootipl, d->bootmenu);
|
2003-04-30 21:03:16 +00:00
|
|
|
#elif defined(__i386__) || defined(__amd64__)
|
1995-04-30 06:09:29 +00:00
|
|
|
printf(" boot1=%p, boot2=%p, bootmgr=%p\n",
|
2001-04-01 12:18:20 +00:00
|
|
|
d->boot1, d->boot2, d->bootmgr);
|
1998-10-06 11:57:08 +00:00
|
|
|
#elif defined(__alpha__)
|
|
|
|
printf(" boot1=%p, bootmgr=%p\n",
|
2001-04-01 12:18:20 +00:00
|
|
|
d->boot1, d->bootmgr);
|
2002-10-27 00:21:02 +00:00
|
|
|
#else
|
|
|
|
/* Should be: error "Debug_Disk: unknown arch"; */
|
1998-10-06 11:57:08 +00:00
|
|
|
#endif
|
2003-11-02 08:39:08 +00:00
|
|
|
#else /* __ia64__ */
|
|
|
|
printf(" media size=%lu, sector size=%lu\n", d->media_size,
|
|
|
|
d->sector_size);
|
|
|
|
#endif
|
|
|
|
|
1995-04-28 23:57:04 +00:00
|
|
|
Debug_Chunk(d->chunks);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Free_Disk(struct disk *d)
|
|
|
|
{
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->chunks)
|
|
|
|
Free_Chunk(d->chunks);
|
|
|
|
if (d->name)
|
|
|
|
free(d->name);
|
2000-08-12 14:20:31 +00:00
|
|
|
#ifdef PC98
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->bootipl)
|
|
|
|
free(d->bootipl);
|
|
|
|
if (d->bootmenu)
|
|
|
|
free(d->bootmenu);
|
2000-08-12 14:20:31 +00:00
|
|
|
#else
|
2002-10-27 00:21:02 +00:00
|
|
|
#if !defined(__ia64__)
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->bootmgr)
|
|
|
|
free(d->bootmgr);
|
2000-08-12 14:20:31 +00:00
|
|
|
#endif
|
2002-10-27 00:21:02 +00:00
|
|
|
#endif
|
|
|
|
#if !defined(__ia64__)
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->boot1)
|
|
|
|
free(d->boot1);
|
2002-10-27 00:21:02 +00:00
|
|
|
#endif
|
2003-04-30 21:03:16 +00:00
|
|
|
#if defined(__i386__) || defined(__amd64__)
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->boot2)
|
|
|
|
free(d->boot2);
|
1998-10-06 11:57:08 +00:00
|
|
|
#endif
|
1995-04-28 23:57:04 +00:00
|
|
|
free(d);
|
|
|
|
}
|
|
|
|
|
1995-06-11 19:33:05 +00:00
|
|
|
#if 0
|
1995-04-28 23:57:04 +00:00
|
|
|
void
|
|
|
|
Collapse_Disk(struct disk *d)
|
|
|
|
{
|
|
|
|
|
2002-11-15 13:24:29 +00:00
|
|
|
while (Collapse_Chunk(d, d->chunks))
|
1995-04-28 23:57:04 +00:00
|
|
|
;
|
|
|
|
}
|
1995-06-11 19:33:05 +00:00
|
|
|
#endif
|
1995-04-29 04:50:39 +00:00
|
|
|
|
2002-10-23 20:15:10 +00:00
|
|
|
static int
|
|
|
|
qstrcmp(const void* a, const void* b)
|
|
|
|
{
|
2004-03-30 01:39:00 +00:00
|
|
|
const char *str1 = *(char* const*)a;
|
|
|
|
const char *str2 = *(char* const*)b;
|
2002-11-15 13:24:29 +00:00
|
|
|
|
2001-12-23 21:43:48 +00:00
|
|
|
return strcmp(str1, str2);
|
|
|
|
}
|
|
|
|
|
1995-04-29 04:50:39 +00:00
|
|
|
char **
|
|
|
|
Disk_Names()
|
|
|
|
{
|
2002-10-23 20:15:10 +00:00
|
|
|
int disk_cnt;
|
|
|
|
static char **disks;
|
|
|
|
int error;
|
|
|
|
size_t listsize;
|
|
|
|
char *disklist;
|
|
|
|
|
|
|
|
error = sysctlbyname("kern.disks", NULL, &listsize, NULL, 0);
|
|
|
|
if (error) {
|
|
|
|
warn("kern.disks sysctl not available");
|
|
|
|
return NULL;
|
1995-04-29 04:50:39 +00:00
|
|
|
}
|
2002-10-23 20:15:10 +00:00
|
|
|
|
2003-06-07 20:02:56 +00:00
|
|
|
if (listsize == 0)
|
|
|
|
return (NULL);
|
|
|
|
|
2002-10-23 20:15:10 +00:00
|
|
|
disks = malloc(sizeof *disks * (1 + MAX_NO_DISKS));
|
|
|
|
if (disks == NULL)
|
|
|
|
return NULL;
|
|
|
|
disklist = (char *)malloc(listsize + 1);
|
|
|
|
if (disklist == NULL) {
|
|
|
|
free(disks);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
memset(disks,0,sizeof *disks * (1 + MAX_NO_DISKS));
|
|
|
|
memset(disklist, 0, listsize + 1);
|
|
|
|
error = sysctlbyname("kern.disks", disklist, &listsize, NULL, 0);
|
2003-06-07 20:02:56 +00:00
|
|
|
if (error || disklist[0] == 0) {
|
2002-10-23 20:15:10 +00:00
|
|
|
free(disklist);
|
|
|
|
free(disks);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (disk_cnt = 0; disk_cnt < MAX_NO_DISKS; disk_cnt++) {
|
|
|
|
disks[disk_cnt] = strsep(&disklist, " ");
|
|
|
|
if (disks[disk_cnt] == NULL)
|
|
|
|
break;
|
2002-11-15 13:24:29 +00:00
|
|
|
}
|
2002-10-23 20:15:10 +00:00
|
|
|
qsort(disks, disk_cnt, sizeof(char*), qstrcmp);
|
|
|
|
return disks;
|
1995-04-29 04:50:39 +00:00
|
|
|
}
|
|
|
|
|
2002-10-31 05:51:25 +00:00
|
|
|
#ifdef PC98
|
|
|
|
void
|
|
|
|
Set_Boot_Mgr(struct disk *d, const u_char *bootipl, const size_t bootipl_size,
|
|
|
|
const u_char *bootmenu, const size_t bootmenu_size)
|
|
|
|
#else
|
1995-04-29 04:50:39 +00:00
|
|
|
void
|
2000-07-12 18:05:18 +00:00
|
|
|
Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s)
|
2002-10-31 05:51:25 +00:00
|
|
|
#endif
|
1995-04-29 04:50:39 +00:00
|
|
|
{
|
2002-10-27 00:21:02 +00:00
|
|
|
#if !defined(__ia64__)
|
2000-08-12 14:20:31 +00:00
|
|
|
#ifdef PC98
|
2002-12-26 15:50:45 +00:00
|
|
|
if (d->sector_size == 0)
|
|
|
|
return;
|
2001-05-13 20:08:54 +00:00
|
|
|
if (bootipl_size % d->sector_size != 0)
|
2000-08-12 14:20:31 +00:00
|
|
|
return;
|
|
|
|
if (d->bootipl)
|
|
|
|
free(d->bootipl);
|
|
|
|
if (!bootipl) {
|
|
|
|
d->bootipl = NULL;
|
|
|
|
} else {
|
|
|
|
d->bootipl_size = bootipl_size;
|
|
|
|
d->bootipl = malloc(bootipl_size);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (!d->bootipl)
|
|
|
|
return;
|
2001-04-01 12:18:20 +00:00
|
|
|
memcpy(d->bootipl, bootipl, bootipl_size);
|
2000-08-12 14:20:31 +00:00
|
|
|
}
|
|
|
|
|
2001-05-13 20:08:54 +00:00
|
|
|
if (bootmenu_size % d->sector_size != 0)
|
2000-08-12 14:20:31 +00:00
|
|
|
return;
|
|
|
|
if (d->bootmenu)
|
|
|
|
free(d->bootmenu);
|
|
|
|
if (!bootmenu) {
|
|
|
|
d->bootmenu = NULL;
|
|
|
|
} else {
|
|
|
|
d->bootmenu_size = bootmenu_size;
|
|
|
|
d->bootmenu = malloc(bootmenu_size);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (!d->bootmenu)
|
|
|
|
return;
|
2001-04-01 12:18:20 +00:00
|
|
|
memcpy(d->bootmenu, bootmenu, bootmenu_size);
|
2000-08-12 14:20:31 +00:00
|
|
|
}
|
|
|
|
#else
|
2002-12-26 15:50:45 +00:00
|
|
|
if (d->sector_size == 0)
|
|
|
|
return;
|
2001-05-13 20:08:54 +00:00
|
|
|
if (s % d->sector_size != 0)
|
2000-07-12 18:05:18 +00:00
|
|
|
return;
|
1995-04-29 04:50:39 +00:00
|
|
|
if (d->bootmgr)
|
1995-05-30 08:29:07 +00:00
|
|
|
free(d->bootmgr);
|
1995-04-30 22:51:05 +00:00
|
|
|
if (!b) {
|
2000-07-12 18:05:18 +00:00
|
|
|
d->bootmgr = NULL;
|
1995-04-30 22:51:05 +00:00
|
|
|
} else {
|
2000-07-12 18:05:18 +00:00
|
|
|
d->bootmgr_size = s;
|
|
|
|
d->bootmgr = malloc(s);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (!d->bootmgr)
|
|
|
|
return;
|
2001-04-01 12:18:20 +00:00
|
|
|
memcpy(d->bootmgr, b, s);
|
1995-04-30 22:51:05 +00:00
|
|
|
}
|
2000-03-29 15:10:28 +00:00
|
|
|
#endif
|
2002-10-27 00:21:02 +00:00
|
|
|
#endif
|
1995-04-29 04:50:39 +00:00
|
|
|
}
|
|
|
|
|
2001-05-13 20:08:54 +00:00
|
|
|
int
|
1996-03-24 18:55:39 +00:00
|
|
|
Set_Boot_Blocks(struct disk *d, const u_char *b1, const u_char *b2)
|
1995-04-29 04:50:39 +00:00
|
|
|
{
|
2003-04-30 21:03:16 +00:00
|
|
|
#if defined(__i386__) || defined(__amd64__)
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->boot1)
|
|
|
|
free(d->boot1);
|
1995-04-29 04:50:39 +00:00
|
|
|
d->boot1 = malloc(512);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (!d->boot1)
|
|
|
|
return -1;
|
2001-04-01 12:18:20 +00:00
|
|
|
memcpy(d->boot1, b1, 512);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->boot2)
|
|
|
|
free(d->boot2);
|
2001-04-01 12:18:20 +00:00
|
|
|
d->boot2 = malloc(15 * 512);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (!d->boot2)
|
|
|
|
return -1;
|
2001-04-01 12:18:20 +00:00
|
|
|
memcpy(d->boot2, b2, 15 * 512);
|
1998-10-06 11:57:08 +00:00
|
|
|
#elif defined(__alpha__)
|
2002-11-15 13:24:29 +00:00
|
|
|
if (d->boot1)
|
|
|
|
free(d->boot1);
|
2001-04-01 12:18:20 +00:00
|
|
|
d->boot1 = malloc(15 * 512);
|
2002-11-15 13:24:29 +00:00
|
|
|
if (!d->boot1)
|
|
|
|
return -1;
|
2001-04-01 12:18:20 +00:00
|
|
|
memcpy(d->boot1, b1, 15 * 512);
|
2002-10-31 04:25:17 +00:00
|
|
|
#elif defined(__sparc64__)
|
|
|
|
if (d->boot1 != NULL)
|
|
|
|
free(d->boot1);
|
|
|
|
d->boot1 = malloc(16 * 512);
|
|
|
|
if (d->boot1 == NULL)
|
|
|
|
return (-1);
|
|
|
|
memcpy(d->boot1, b1, 16 * 512);
|
2002-10-27 00:21:02 +00:00
|
|
|
#elif defined(__ia64__)
|
|
|
|
/* nothing */
|
|
|
|
#else
|
|
|
|
/* Should be: #error "Set_Boot_Blocks: unknown arch"; */
|
1998-10-06 11:57:08 +00:00
|
|
|
#endif
|
2001-05-13 20:08:54 +00:00
|
|
|
return 0;
|
1995-04-29 04:50:39 +00:00
|
|
|
}
|
1997-01-23 06:29:01 +00:00
|
|
|
|
2002-10-31 05:51:25 +00:00
|
|
|
#ifdef PC98
|
|
|
|
const char *
|
|
|
|
slice_type_name( int type, int subtype )
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (type) {
|
2002-11-08 15:25:15 +00:00
|
|
|
case whole:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "whole";
|
2002-11-08 15:25:15 +00:00
|
|
|
case fat:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "fat";
|
2002-11-08 15:25:15 +00:00
|
|
|
case freebsd:
|
2002-10-31 05:51:25 +00:00
|
|
|
switch (subtype) {
|
|
|
|
case 0xc494: return "freebsd";
|
|
|
|
default: return "unknown";
|
|
|
|
}
|
2002-11-08 15:25:15 +00:00
|
|
|
case unused:
|
|
|
|
return "unused";
|
2002-10-31 05:51:25 +00:00
|
|
|
default:
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else /* PC98 */
|
1997-01-23 06:29:01 +00:00
|
|
|
const char *
|
|
|
|
slice_type_name( int type, int subtype )
|
|
|
|
{
|
2002-10-31 05:51:25 +00:00
|
|
|
|
1997-01-23 06:29:01 +00:00
|
|
|
switch (type) {
|
2002-11-08 15:25:15 +00:00
|
|
|
case whole:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "whole";
|
2002-11-08 15:25:15 +00:00
|
|
|
case mbr:
|
2002-10-31 05:51:25 +00:00
|
|
|
switch (subtype) {
|
|
|
|
case 1: return "fat (12-bit)";
|
|
|
|
case 2: return "XENIX /";
|
|
|
|
case 3: return "XENIX /usr";
|
|
|
|
case 4: return "fat (16-bit,<=32Mb)";
|
|
|
|
case 5: return "extended DOS";
|
|
|
|
case 6: return "fat (16-bit,>32Mb)";
|
|
|
|
case 7: return "NTFS/HPFS/QNX";
|
|
|
|
case 8: return "AIX bootable";
|
|
|
|
case 9: return "AIX data";
|
|
|
|
case 10: return "OS/2 bootmgr";
|
|
|
|
case 11: return "fat (32-bit)";
|
|
|
|
case 12: return "fat (32-bit,LBA)";
|
|
|
|
case 14: return "fat (16-bit,>32Mb,LBA)";
|
|
|
|
case 15: return "extended DOS, LBA";
|
|
|
|
case 18: return "Compaq Diagnostic";
|
|
|
|
case 84: return "OnTrack diskmgr";
|
|
|
|
case 100: return "Netware 2.x";
|
|
|
|
case 101: return "Netware 3.x";
|
|
|
|
case 115: return "SCO UnixWare";
|
|
|
|
case 128: return "Minix 1.1";
|
|
|
|
case 129: return "Minix 1.5";
|
|
|
|
case 130: return "linux_swap";
|
|
|
|
case 131: return "ext2fs";
|
|
|
|
case 166: return "OpenBSD FFS"; /* 0xA6 */
|
|
|
|
case 169: return "NetBSD FFS"; /* 0xA9 */
|
|
|
|
case 182: return "OpenBSD"; /* dedicated */
|
|
|
|
case 183: return "bsd/os";
|
|
|
|
case 184: return "bsd/os swap";
|
|
|
|
case 238: return "EFI GPT";
|
|
|
|
case 239: return "EFI Sys. Part.";
|
|
|
|
default: return "unknown";
|
|
|
|
}
|
2002-11-08 15:25:15 +00:00
|
|
|
case fat:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "fat";
|
2002-11-08 15:25:15 +00:00
|
|
|
case freebsd:
|
2002-10-31 05:51:25 +00:00
|
|
|
switch (subtype) {
|
|
|
|
case 165: return "freebsd";
|
1997-01-23 06:29:01 +00:00
|
|
|
default: return "unknown";
|
2002-10-31 05:51:25 +00:00
|
|
|
}
|
2002-11-08 15:25:15 +00:00
|
|
|
case extended:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "extended";
|
2002-11-08 15:25:15 +00:00
|
|
|
case part:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "part";
|
2002-11-10 20:53:10 +00:00
|
|
|
case efi:
|
|
|
|
return "efi";
|
2002-11-08 15:25:15 +00:00
|
|
|
case unused:
|
2002-10-31 05:51:25 +00:00
|
|
|
return "unused";
|
|
|
|
default:
|
|
|
|
return "unknown";
|
1997-01-23 06:29:01 +00:00
|
|
|
}
|
|
|
|
}
|
2002-10-31 05:51:25 +00:00
|
|
|
#endif /* PC98 */
|