Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jun 2010 13:20:40 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209536 - in head/sys: geom/part sys
Message-ID:  <201006261320.o5QDKeiS041502@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Sat Jun 26 13:20:40 2010
New Revision: 209536
URL: http://svn.freebsd.org/changeset/base/209536

Log:
  Add NTFS partition type to GEOM_MBR.

Modified:
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part.h
  head/sys/geom/part/g_part_mbr.c
  head/sys/sys/diskmbr.h

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Sat Jun 26 08:34:22 2010	(r209535)
+++ head/sys/geom/part/g_part.c	Sat Jun 26 13:20:40 2010	(r209536)
@@ -91,6 +91,7 @@ struct g_part_alias_list {
 	{ "ms-ldm-data", G_PART_ALIAS_MS_LDM_DATA },
 	{ "ms-ldm-metadata", G_PART_ALIAS_MS_LDM_METADATA },
 	{ "ms-reserved", G_PART_ALIAS_MS_RESERVED },
+	{ "ntfs", G_PART_ALIAS_MS_NTFS },
 	{ "netbsd-ccd", G_PART_ALIAS_NETBSD_CCD },
 	{ "netbsd-cgd", G_PART_ALIAS_NETBSD_CGD },
 	{ "netbsd-ffs", G_PART_ALIAS_NETBSD_FFS },

Modified: head/sys/geom/part/g_part.h
==============================================================================
--- head/sys/geom/part/g_part.h	Sat Jun 26 08:34:22 2010	(r209535)
+++ head/sys/geom/part/g_part.h	Sat Jun 26 13:20:40 2010	(r209536)
@@ -59,6 +59,7 @@ enum g_part_alias {
 	G_PART_ALIAS_MS_LDM_DATA,	/* A Microsoft LDM Data part. entry. */
 	G_PART_ALIAS_MS_LDM_METADATA,	/* A Microsoft LDM Metadata entry. */
 	G_PART_ALIAS_MS_RESERVED,	/* A Microsoft Reserved part. entry. */
+	G_PART_ALIAS_MS_NTFS,		/* A Microsoft NTFS partition entry */
 	G_PART_ALIAS_NETBSD_CCD,	/* A NetBSD CCD partition entry. */
 	G_PART_ALIAS_NETBSD_CGD,	/* A NetBSD CGD partition entry. */
 	G_PART_ALIAS_NETBSD_FFS,	/* A NetBSD FFS partition entry. */

Modified: head/sys/geom/part/g_part_mbr.c
==============================================================================
--- head/sys/geom/part/g_part_mbr.c	Sat Jun 26 08:34:22 2010	(r209535)
+++ head/sys/geom/part/g_part_mbr.c	Sat Jun 26 13:20:40 2010	(r209536)
@@ -127,6 +127,11 @@ mbr_parse_type(const char *type, u_char 
 		*dp_typ = DOSPTYP_386BSD;
 		return (0);
 	}
+	alias = g_part_alias_name(G_PART_ALIAS_MS_NTFS);
+	if (!strcasecmp(type, alias)) {
+		*dp_typ = DOSPTYP_NTFS;
+		return (0);
+	}
 	return (EINVAL);
 }
 
@@ -509,9 +514,14 @@ g_part_mbr_type(struct g_part_table *bas
 
 	entry = (struct g_part_mbr_entry *)baseentry;
 	type = entry->ent.dp_typ;
-	if (type == DOSPTYP_386BSD)
+	switch (type) {
+	case DOSPTYP_386BSD:
 		return (g_part_alias_name(G_PART_ALIAS_FREEBSD));
-	snprintf(buf, bufsz, "!%d", type);
+	case DOSPTYP_NTFS:
+		return (g_part_alias_name(G_PART_ALIAS_MS_NTFS));
+	default:
+		snprintf(buf, bufsz, "!%d", type);
+	}
 	return (buf);
 }
 

Modified: head/sys/sys/diskmbr.h
==============================================================================
--- head/sys/sys/diskmbr.h	Sat Jun 26 08:34:22 2010	(r209535)
+++ head/sys/sys/diskmbr.h	Sat Jun 26 13:20:40 2010	(r209536)
@@ -49,6 +49,7 @@
 #define	DOSPTYP_PMBR	0xee	/* GPT Protective MBR */
 #define	DOSPTYP_EXT	5	/* DOS extended partition */
 #define	DOSPTYP_EXTLBA	15	/* DOS extended partition */
+#define	DOSPTYP_NTFS	0x07	/* NTFS partition */
 
 struct dos_partition {
 	unsigned char	dp_flag;	/* bootstrap flags */



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