As discussed on tech-userlevel, add NetBSD GPT partition types for

swap, ffs, lfs, raidframe, ccd and cgd.  gpt(8) now defaults to
NetBSD ffs if no type is given, but previous FreeBSD types are
still recognized in the DKWEDGE_AUTODISCOVER code.
This commit is contained in:
riz 2007-12-28 19:53:09 +00:00
parent 716fde8fa0
commit 42a4e6ef13
6 changed files with 73 additions and 13 deletions

View File

@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
__RCSID("$NetBSD: add.c,v 1.5 2007/12/18 21:46:45 riz Exp $");
__RCSID("$NetBSD: add.c,v 1.6 2007/12/28 19:53:10 riz Exp $");
#endif
#include <sys/types.h>
@ -215,7 +215,7 @@ cmd_add(int argc, char *argv[])
/* Create UFS partitions by default. */
if (uuid_is_nil(&type, NULL)) {
uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
uuid_t ufs = GPT_ENT_TYPE_NETBSD_FFS;
type = ufs;
}

View File

@ -31,7 +31,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
#endif
#ifdef __RCSID
__RCSID("$NetBSD: gpt.c,v 1.6 2007/12/19 05:48:33 dogcow Exp $");
__RCSID("$NetBSD: gpt.c,v 1.7 2007/12/28 19:53:10 riz Exp $");
#endif
#include <sys/param.h>
@ -280,6 +280,17 @@ parse_uuid(const char *s, uuid_t *uuid)
return (0);
switch (*s) {
case 'c':
if (strcmp(s, "ccd") == 0) {
uuid_t ccd = GPT_ENT_TYPE_NETBSD_CCD;
*uuid = ccd;
return (0);
} else if (strcmp(s, "cgd") == 0) {
uuid_t cgd = GPT_ENT_TYPE_NETBSD_CGD;
*uuid = cgd;
return (0);
}
break;
case 'e':
if (strcmp(s, "efi") == 0) {
uuid_t efi = GPT_ENT_TYPE_EFI;
@ -295,22 +306,33 @@ parse_uuid(const char *s, uuid_t *uuid)
}
break;
case 'l':
if (strcmp(s, "linux") == 0) {
if (strcmp(s, "lfs") == 0) {
uuid_t lfs = GPT_ENT_TYPE_NETBSD_LFS;
*uuid = lfs;
return (0);
} else if (strcmp(s, "linux") == 0) {
uuid_t lnx = GPT_ENT_TYPE_MS_BASIC_DATA;
*uuid = lnx;
return (0);
}
break;
case 'r':
if (strcmp(s, "raid") == 0) {
uuid_t raid = GPT_ENT_TYPE_NETBSD_RAIDFRAME;
*uuid = raid;
return (0);
}
break;
case 's':
if (strcmp(s, "swap") == 0) {
uuid_t sw = GPT_ENT_TYPE_FREEBSD_SWAP;
uuid_t sw = GPT_ENT_TYPE_NETBSD_SWAP;
*uuid = sw;
return (0);
}
break;
case 'u':
if (strcmp(s, "ufs") == 0) {
uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
uuid_t ufs = GPT_ENT_TYPE_NETBSD_FFS;
*uuid = ufs;
return (0);
}

View File

@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
__RCSID("$NetBSD: show.c,v 1.3 2007/12/18 21:46:47 riz Exp $");
__RCSID("$NetBSD: show.c,v 1.4 2007/12/28 19:53:10 riz Exp $");
#endif
#include <sys/types.h>
@ -70,6 +70,12 @@ friendly(uuid_t *t)
static uuid_t swap = GPT_ENT_TYPE_FREEBSD_SWAP;
static uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
static uuid_t vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
static uuid_t nb_swap = GPT_ENT_TYPE_NETBSD_SWAP;
static uuid_t nb_ufs = GPT_ENT_TYPE_NETBSD_FFS;
static uuid_t nb_lfs = GPT_ENT_TYPE_NETBSD_LFS;
static uuid_t nb_raid = GPT_ENT_TYPE_NETBSD_RAIDFRAME;
static uuid_t nb_ccd = GPT_ENT_TYPE_NETBSD_CCD;
static uuid_t nb_cgd = GPT_ENT_TYPE_NETBSD_CGD;
static char buf[80];
char *s;
@ -78,6 +84,18 @@ friendly(uuid_t *t)
if (uuid_equal(t, &efi_slice, NULL))
return ("EFI System");
if (uuid_equal(t, &nb_swap, NULL))
return ("NetBSD swap");
if (uuid_equal(t, &nb_ufs, NULL))
return ("NetBSD UFS/UFS2");
if (uuid_equal(t, &nb_lfs, NULL))
return ("NetBSD LFS");
if (uuid_equal(t, &nb_raid, NULL))
return ("NetBSD RAIDFrame component");
if (uuid_equal(t, &nb_ccd, NULL))
return ("NetBSD ccd component");
if (uuid_equal(t, &nb_cgd, NULL))
return ("NetBSD Cryptographic Disk");
if (uuid_equal(t, &swap, NULL))
return ("FreeBSD swap");
if (uuid_equal(t, &ufs, NULL))

View File

@ -1,4 +1,4 @@
/* $NetBSD: dkwedge_gpt.c,v 1.6 2007/03/04 06:01:45 christos Exp $ */
/* $NetBSD: dkwedge_gpt.c,v 1.7 2007/12/28 19:53:10 riz Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.6 2007/03/04 06:01:45 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.7 2007/12/28 19:53:10 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -62,8 +62,14 @@ static const struct {
#if 0
{ GPT_ENT_TYPE_FREEBSD, ??? },
#endif
{ GPT_ENT_TYPE_FREEBSD_SWAP, "swap" }, /* XXX for now */
{ GPT_ENT_TYPE_FREEBSD_UFS, "ffs" }, /* XXX for now */
{ GPT_ENT_TYPE_NETBSD_SWAP, DKW_PTYPE_SWAP },
{ GPT_ENT_TYPE_FREEBSD_SWAP, DKW_PTYPE_SWAP },
{ GPT_ENT_TYPE_NETBSD_FFS, DKW_PTYPE_FFS },
{ GPT_ENT_TYPE_FREEBSD_UFS, DKW_PTYPE_FFS },
{ GPT_ENT_TYPE_NETBSD_LFS, DKW_PTYPE_LFS },
{ GPT_ENT_TYPE_NETBSD_RAIDFRAME, DKW_PTYPE_RAIDFRAME },
{ GPT_ENT_TYPE_NETBSD_CCD, DKW_PTYPE_CCD },
{ GPT_ENT_TYPE_NETBSD_CGD, DKW_PTYPE_CGD },
/* XXX What about the MS and Linux types? */

View File

@ -1,4 +1,4 @@
/* $NetBSD: disk.h,v 1.46 2007/10/08 16:41:15 ad Exp $ */
/* $NetBSD: disk.h,v 1.47 2007/12/28 19:53:10 riz Exp $ */
/*-
* Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
@ -234,6 +234,7 @@ __link_set_add_data(dkwedge_methods, name ## _ddm)
#define DKW_PTYPE_CCD "ccd"
#define DKW_PTYPE_APPLEUFS "appleufs"
#define DKW_PTYPE_NTFS "ntfs"
#define DKW_PTYPE_CGD "cgd"
/*
* Disk geometry dictionary.

View File

@ -1,4 +1,4 @@
/* $NetBSD: disklabel_gpt.h,v 1.3 2006/08/13 15:31:21 christos Exp $ */
/* $NetBSD: disklabel_gpt.h,v 1.4 2007/12/28 19:53:09 riz Exp $ */
/*
* Copyright (c) 2002 Marcel Moolenaar
@ -100,6 +100,19 @@ struct gpt_ent {
/*
* Partition types defined by other operating systems.
*/
#define GPT_ENT_TYPE_NETBSD_SWAP \
{0x49f48d32,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
#define GPT_ENT_TYPE_NETBSD_FFS \
{0x49f48d5a,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
#define GPT_ENT_TYPE_NETBSD_LFS \
{0x49f48d82,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
#define GPT_ENT_TYPE_NETBSD_RAIDFRAME \
{0x49f48daa,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
#define GPT_ENT_TYPE_NETBSD_CCD \
{0x2db519c4,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
#define GPT_ENT_TYPE_NETBSD_CGD \
{0x2db519ec,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
#define GPT_ENT_TYPE_FREEBSD \
{0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_SWAP \