Module Name:    src
Committed By:   tsutsui
Date:           Sat Jul 17 15:13:18 UTC 2010

Modified Files:
        src/sys/arch/hpcarm/include: disklabel.h types.h

Log Message:
Bump MAXPARTITIONS from 8 to 16 using __HAVE_OLD_DISKLABEL compat method
as i386 and hpcmips. PR port-hpcarm/18256


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hpcarm/include/disklabel.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hpcarm/include/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hpcarm/include/disklabel.h
diff -u src/sys/arch/hpcarm/include/disklabel.h:1.7 src/sys/arch/hpcarm/include/disklabel.h:1.8
--- src/sys/arch/hpcarm/include/disklabel.h:1.7	Mon Nov 23 13:40:09 2009
+++ src/sys/arch/hpcarm/include/disklabel.h	Sat Jul 17 15:13:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.h,v 1.7 2009/11/23 13:40:09 pooka Exp $	*/
+/*	$NetBSD: disklabel.h,v 1.8 2010/07/17 15:13:18 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -33,10 +33,24 @@
 #ifndef _MACHINE_DISKLABEL_H_
 #define _MACHINE_DISKLABEL_H_
 
-#define	LABELSECTOR	1		/* sector containing label */
-#define	LABELOFFSET	0		/* offset of label in sector */
-#define	MAXPARTITIONS	8		/* number of partitions */
-#define	RAW_PART	3		/* raw partition: XX?d (XXX) */
+#define	LABELSECTOR		1	/* sector containing label */
+#define	LABELOFFSET		0	/* offset of label in sector */
+#define	MAXPARTITIONS		16	/* number of partitions */
+#define	OLDMAXPARTITIONS 	8	/* number of partitions before 1.6 */
+#define	RAW_PART		3	/* raw partition: XX?d (XXX) */
+
+/*
+ * We use the highest bit of the minor number for the partition number.
+ * This maintains backward compatibility with device nodes created before
+ * MAXPARTITIONS was increased.
+ */
+#define	__HPCARM_MAXDISKS	((1 << 20) / MAXPARTITIONS)
+#define	DISKUNIT(dev)	((minor(dev) / OLDMAXPARTITIONS) % __HPCARM_MAXDISKS)
+#define	DISKPART(dev)	((minor(dev) % OLDMAXPARTITIONS) + \
+    ((minor(dev) / (__HPCARM_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
+#define	DISKMINOR(unit, part) \
+    (((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
+     ((part) / OLDMAXPARTITIONS) * (__HPCARM_MAXDISKS * OLDMAXPARTITIONS))
 
 /* Pull in MBR partition definitions. */
 #if HAVE_NBTOOL_CONFIG_H

Index: src/sys/arch/hpcarm/include/types.h
diff -u src/sys/arch/hpcarm/include/types.h:1.13 src/sys/arch/hpcarm/include/types.h:1.14
--- src/sys/arch/hpcarm/include/types.h:1.13	Sun Jan 20 18:09:06 2008
+++ src/sys/arch/hpcarm/include/types.h	Sat Jul 17 15:13:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.13 2008/01/20 18:09:06 joerg Exp $ */
+/* $NetBSD: types.h,v 1.14 2010/07/17 15:13:18 tsutsui Exp $ */
 
 #ifndef _HPCARM_TYPES_H_
 #define	_HPCARM_TYPES_H_
@@ -6,6 +6,7 @@
 #include <arm/arm32/types.h>
 
 #define	__HAVE_DEVICE_REGISTER
+#define	__HAVE_OLD_DISKLABEL
 #define	__GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
 
 #endif

Reply via email to