Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcarm/include Bump MAXPARTITIONS from 8 to 16 usin...



details:   https://anonhg.NetBSD.org/src/rev/db275d6f740f
branches:  trunk
changeset: 756422:db275d6f740f
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jul 17 15:13:18 2010 +0000

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

diffstat:

 sys/arch/hpcarm/include/disklabel.h |  24 +++++++++++++++++++-----
 sys/arch/hpcarm/include/types.h     |   3 ++-
 2 files changed, 21 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 07ee0c1d2da4 -r db275d6f740f sys/arch/hpcarm/include/disklabel.h
--- a/sys/arch/hpcarm/include/disklabel.h       Sat Jul 17 14:15:34 2010 +0000
+++ b/sys/arch/hpcarm/include/disklabel.h       Sat Jul 17 15:13:18 2010 +0000
@@ -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
diff -r 07ee0c1d2da4 -r db275d6f740f sys/arch/hpcarm/include/types.h
--- a/sys/arch/hpcarm/include/types.h   Sat Jul 17 14:15:34 2010 +0000
+++ b/sys/arch/hpcarm/include/types.h   Sat Jul 17 15:13:18 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index