Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2007 05:16:41 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 130077 for review
Message-ID:  <200712030516.lB35Gftr089785@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130077

Change 130077 by marcel@marcel_cluster on 2007/12/03 05:15:41

	Add support for BSD disklabels to g_part. BSD disklabels
	with 8-20 (incl) partitions is supported. No bootcode
	support as of yet.
	
	Compile-tested only.

Affected files ...

.. //depot/projects/ia64/sys/conf/NOTES#118 edit
.. //depot/projects/ia64/sys/conf/files#159 edit
.. //depot/projects/ia64/sys/conf/options#109 edit
.. //depot/projects/ia64/sys/geom/part/g_part.c#4 edit
.. //depot/projects/ia64/sys/geom/part/g_part.h#4 edit
.. //depot/projects/ia64/sys/geom/part/g_part_bsd.c#1 add
.. //depot/projects/ia64/sys/ia64/conf/DEFAULTS#9 edit

Differences ...

==== //depot/projects/ia64/sys/conf/NOTES#118 (text+ko) ====

@@ -146,6 +146,7 @@
 options 	GEOM_MULTIPATH		# Disk multipath
 options 	GEOM_NOP		# Test class.
 options 	GEOM_PART_APM		# Apple partitioning
+options 	GEOM_PART_BSD		# BSD disklabel
 options 	GEOM_PART_GPT		# GPT partitioning
 options 	GEOM_PART_MBR		# MBR partitioning
 options 	GEOM_PC98		# NEC PC9800 partitioning

==== //depot/projects/ia64/sys/conf/files#159 (text+ko) ====

@@ -1294,6 +1294,7 @@
 geom/part/g_part.c		standard
 geom/part/g_part_if.m		standard
 geom/part/g_part_apm.c		optional geom_part_apm
+geom/part/g_part_bsd.c		optional geom_part_bsd
 geom/part/g_part_gpt.c		optional geom_part_gpt
 geom/part/g_part_mbr.c		optional geom_part_mbr
 geom/raid3/g_raid3.c		optional geom_raid3

==== //depot/projects/ia64/sys/conf/options#109 (text+ko) ====

@@ -88,6 +88,7 @@
 GEOM_MULTIPATH	opt_geom.h
 GEOM_NOP	opt_geom.h
 GEOM_PART_APM	opt_geom.h
+GEOM_PART_BSD	opt_geom.h
 GEOM_PART_GPT	opt_geom.h
 GEOM_PART_MBR	opt_geom.h
 GEOM_PC98	opt_geom.h

==== //depot/projects/ia64/sys/geom/part/g_part.c#4 (text+ko) ====

@@ -664,6 +664,14 @@
 	error = g_getattr("PART::depth", cp, &attr);
 	table->gpt_depth = (!error) ? attr + 1 : 0;
 
+	/* If we're nested, get the absolute sector offset on disk. */
+	if (table->gpt_depth) {
+		error = g_getattr("PART::offset", cp, &attr);
+		if (error)
+			goto fail;
+		table->gpt_offset = attr;
+	}
+
 	/*
 	 * Synthesize a disk geometry. Some partitioning schemes
 	 * depend on it and since some file systems need it even
@@ -1329,7 +1337,15 @@
 		goto fail;
 
 	table = gp->softc;
-	
+
+	/* If we're nested, get the absolute sector offset on disk. */
+	if (table->gpt_depth) {
+		error = g_getattr("PART::offset", cp, &attr);
+		if (error)
+			goto fail;
+		table->gpt_offset = attr;
+	}
+
 	/*
 	 * Synthesize a disk geometry. Some partitioning schemes
 	 * depend on it and since some file systems need it even
@@ -1505,6 +1521,9 @@
 			return;
 		if (g_handleattr_int(bp, "PART::depth", table->gpt_depth))
 			return;
+		if (g_handleattr_int(bp, "PART::offset",
+		    table->gpt_offset + entry->gpe_offset))
+			return;
 		if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) {
 			/*
 			 * Check that the partition is suitable for kernel

==== //depot/projects/ia64/sys/geom/part/g_part.h#4 (text+ko) ====

@@ -99,6 +99,13 @@
 	 */
 	uint32_t	gpt_sectors;
 	uint32_t	gpt_heads;
+	/*
+	 * gpt_offset holds the absolute block address of the scheme
+	 * on disk. Some partitioning schemes (historically) use
+	 * absolute addressing. Relative addresses are obtained by
+	 * subtracting gpt_offset from the absolute addresses.
+	 */
+	uint64_t	gpt_offset;
 
 	int		gpt_depth;	/* Sub-partitioning level. */
 	int		gpt_isleaf:1;	/* Cannot be sub-partitioned. */

==== //depot/projects/ia64/sys/ia64/conf/DEFAULTS#9 (text+ko) ====

@@ -14,7 +14,7 @@
 # UART chips on this platform
 device		uart_ns8250
 
-options 	GEOM_BSD
+options 	GEOM_PART_BSD
 options 	GEOM_PART_GPT
 options 	GEOM_PART_MBR
 



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