Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jun 2014 10:19:11 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267357 - head/sys/geom/part
Message-ID:  <201406111019.s5BAJBjW085880@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Jun 11 10:19:11 2014
New Revision: 267357
URL: http://svnweb.freebsd.org/changeset/base/267357

Log:
  Add aliases for DragonFlyBSD's partition types.
  
  MFC after:	2 weeks

Modified:
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part.h
  head/sys/geom/part/g_part_bsd.c
  head/sys/geom/part/g_part_gpt.c

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Wed Jun 11 10:14:40 2014	(r267356)
+++ head/sys/geom/part/g_part.c	Wed Jun 11 10:19:11 2014	(r267357)
@@ -108,6 +108,15 @@ struct g_part_alias_list {
 	{ "vmware-vmkdiag", G_PART_ALIAS_VMKDIAG },
 	{ "vmware-reserved", G_PART_ALIAS_VMRESERVED },
 	{ "vmware-vsanhdr", G_PART_ALIAS_VMVSANHDR },
+	{ "dragonfly-label32", G_PART_ALIAS_DFBSD },
+	{ "dragonfly-label64", G_PART_ALIAS_DFBSD64 },
+	{ "dragonfly-swap", G_PART_ALIAS_DFBSD_SWAP },
+	{ "dragonfly-ufs", G_PART_ALIAS_DFBSD_UFS },
+	{ "dragonfly-vinum", G_PART_ALIAS_DFBSD_VINUM },
+	{ "dragonfly-ccd", G_PART_ALIAS_DFBSD_CCD },
+	{ "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY },
+	{ "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER },
+	{ "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 },
 };
 
 SYSCTL_DECL(_kern_geom);

Modified: head/sys/geom/part/g_part.h
==============================================================================
--- head/sys/geom/part/g_part.h	Wed Jun 11 10:14:40 2014	(r267356)
+++ head/sys/geom/part/g_part.h	Wed Jun 11 10:19:11 2014	(r267357)
@@ -75,6 +75,15 @@ enum g_part_alias {
 	G_PART_ALIAS_VMKDIAG,		/* A VMware vmkDiagnostic partition entry */
 	G_PART_ALIAS_VMRESERVED,	/* A VMware reserved partition entry */
 	G_PART_ALIAS_VMVSANHDR,		/* A VMware vSAN header partition entry */
+	G_PART_ALIAS_DFBSD,		/* A DfBSD label32 partition entry */
+	G_PART_ALIAS_DFBSD64,		/* A DfBSD label64 partition entry */
+	G_PART_ALIAS_DFBSD_SWAP,	/* A DfBSD swap partition entry */
+	G_PART_ALIAS_DFBSD_UFS,		/* A DfBSD UFS partition entry */
+	G_PART_ALIAS_DFBSD_VINUM,	/* A DfBSD Vinum partition entry */
+	G_PART_ALIAS_DFBSD_CCD,		/* A DfBSD CCD partition entry */
+	G_PART_ALIAS_DFBSD_LEGACY,	/* A DfBSD legacy partition entry */
+	G_PART_ALIAS_DFBSD_HAMMER,	/* A DfBSD HAMMER FS partition entry */
+	G_PART_ALIAS_DFBSD_HAMMER2,	/* A DfBSD HAMMER2 FS partition entry */
 	/* Keep the following last */
 	G_PART_ALIAS_COUNT
 };

Modified: head/sys/geom/part/g_part_bsd.c
==============================================================================
--- head/sys/geom/part/g_part_bsd.c	Wed Jun 11 10:14:40 2014	(r267356)
+++ head/sys/geom/part/g_part_bsd.c	Wed Jun 11 10:19:11 2014	(r267357)
@@ -112,12 +112,26 @@ static struct g_part_scheme g_part_bsd_s
 };
 G_PART_SCHEME_DECLARE(g_part_bsd);
 
+static struct g_part_bsd_alias {
+	uint8_t		type;
+	int		alias;
+} bsd_alias_match[] = {
+	{ FS_BSDFFS,	G_PART_ALIAS_FREEBSD_UFS },
+	{ FS_SWAP,	G_PART_ALIAS_FREEBSD_SWAP },
+	{ FS_ZFS,	G_PART_ALIAS_FREEBSD_ZFS },
+	{ FS_VINUM,	G_PART_ALIAS_FREEBSD_VINUM },
+	{ FS_NANDFS,	G_PART_ALIAS_FREEBSD_NANDFS },
+	{ FS_HAMMER,	G_PART_ALIAS_DFBSD_HAMMER },
+	{ FS_HAMMER2,	G_PART_ALIAS_DFBSD_HAMMER2 },
+};
+
 static int
 bsd_parse_type(const char *type, uint8_t *fstype)
 {
 	const char *alias;
 	char *endp;
 	long lt;
+	int i;
 
 	if (type[0] == '!') {
 		lt = strtol(type + 1, &endp, 0);
@@ -126,30 +140,13 @@ bsd_parse_type(const char *type, uint8_t
 		*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;
-		return (0);
-	}
-	alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_UFS);
-	if (!strcasecmp(type, alias)) {
-		*fstype = FS_BSDFFS;
-		return (0);
-	}
-	alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_VINUM);
-	if (!strcasecmp(type, alias)) {
-		*fstype = FS_VINUM;
-		return (0);
-	}
-	alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_ZFS);
-	if (!strcasecmp(type, alias)) {
-		*fstype = FS_ZFS;
-		return (0);
+	for (i = 0;
+	    i < sizeof(bsd_alias_match) / sizeof(bsd_alias_match[0]); i++) {
+		alias = g_part_alias_name(bsd_alias_match[i].alias);
+		if (strcasecmp(type, alias) == 0) {
+			*fstype = bsd_alias_match[i].type;
+			return (0);
+		}
 	}
 	return (EINVAL);
 }

Modified: head/sys/geom/part/g_part_gpt.c
==============================================================================
--- head/sys/geom/part/g_part_gpt.c	Wed Jun 11 10:14:40 2014	(r267356)
+++ head/sys/geom/part/g_part_gpt.c	Wed Jun 11 10:19:11 2014	(r267357)
@@ -181,6 +181,15 @@ static struct uuid gpt_uuid_netbsd_raid 
 static struct uuid gpt_uuid_netbsd_swap = GPT_ENT_TYPE_NETBSD_SWAP;
 static struct uuid gpt_uuid_mbr = GPT_ENT_TYPE_MBR;
 static struct uuid gpt_uuid_unused = GPT_ENT_TYPE_UNUSED;
+static struct uuid gpt_uuid_dfbsd_swap = GPT_ENT_TYPE_DRAGONFLY_SWAP;
+static struct uuid gpt_uuid_dfbsd_ufs1 = GPT_ENT_TYPE_DRAGONFLY_UFS1;
+static struct uuid gpt_uuid_dfbsd_vinum = GPT_ENT_TYPE_DRAGONFLY_VINUM;
+static struct uuid gpt_uuid_dfbsd_ccd = GPT_ENT_TYPE_DRAGONFLY_CCD;
+static struct uuid gpt_uuid_dfbsd_legacy = GPT_ENT_TYPE_DRAGONFLY_LEGACY;
+static struct uuid gpt_uuid_dfbsd_hammer = GPT_ENT_TYPE_DRAGONFLY_HAMMER;
+static struct uuid gpt_uuid_dfbsd_hammer2 = GPT_ENT_TYPE_DRAGONFLY_HAMMER2;
+static struct uuid gpt_uuid_dfbsd_label32 = GPT_ENT_TYPE_DRAGONFLY_LABEL32;
+static struct uuid gpt_uuid_dfbsd_label64 = GPT_ENT_TYPE_DRAGONFLY_LABEL64;
 
 static struct g_part_uuid_alias {
 	struct uuid *uuid;
@@ -222,6 +231,15 @@ static struct g_part_uuid_alias {
 	{ &gpt_uuid_netbsd_lfs,		G_PART_ALIAS_NETBSD_LFS,	 0 },
 	{ &gpt_uuid_netbsd_raid,	G_PART_ALIAS_NETBSD_RAID,	 0 },
 	{ &gpt_uuid_netbsd_swap,	G_PART_ALIAS_NETBSD_SWAP,	 0 },
+	{ &gpt_uuid_dfbsd_swap,		G_PART_ALIAS_DFBSD_SWAP,	 0 },
+	{ &gpt_uuid_dfbsd_ufs1,		G_PART_ALIAS_DFBSD_UFS,		 0 },
+	{ &gpt_uuid_dfbsd_vinum,	G_PART_ALIAS_DFBSD_VINUM,	 0 },
+	{ &gpt_uuid_dfbsd_ccd,		G_PART_ALIAS_DFBSD_CCD,		 0 },
+	{ &gpt_uuid_dfbsd_legacy,	G_PART_ALIAS_DFBSD_LEGACY,	 0 },
+	{ &gpt_uuid_dfbsd_hammer,	G_PART_ALIAS_DFBSD_HAMMER,	 0 },
+	{ &gpt_uuid_dfbsd_hammer2,	G_PART_ALIAS_DFBSD_HAMMER2,	 0 },
+	{ &gpt_uuid_dfbsd_label32,	G_PART_ALIAS_DFBSD,		 0xa5 },
+	{ &gpt_uuid_dfbsd_label64,	G_PART_ALIAS_DFBSD64,		 0xa5 },
 	{ NULL, 0, 0 }
 };
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406111019.s5BAJBjW085880>