Use highest bit of minor as an extra bit for the partition number to

bump the maximum partition number on NetBSD-i386 to 16. (Approved by fvdl)
This commit is contained in:
tron 2001-01-02 23:06:54 +00:00
parent 3ea054452a
commit 0ce4a9a0de
3 changed files with 40 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $NetBSD: MAKEDEV,v 1.131 2000/12/19 22:39:34 hubertf Exp $
# $NetBSD: MAKEDEV,v 1.132 2001/01/02 23:06:55 tron Exp $
#
# Copyright (c) 1990 The Regents of the University of California.
# All rights reserved.
@ -119,6 +119,8 @@ dialin=0
dialout=524288 # high bit of the minor number
callunit=262144
highpartoffset=524280 # offset for partition 9 to 16
PATH=/sbin:/usr/sbin:/bin:/usr/bin
umask 77
@ -416,6 +418,14 @@ ccd*|fd*|ld*|raid*|sd*|vnd*|wd*)
mknod ${name}${unit}f b $blk $(($unit * 8 + 5))
mknod ${name}${unit}g b $blk $(($unit * 8 + 6))
mknod ${name}${unit}h b $blk $(($unit * 8 + 7))
mknod ${name}${unit}i b $blk $(($unit * 8 + $highpartoffset + 8))
mknod ${name}${unit}j b $blk $(($unit * 8 + $highpartoffset + 9))
mknod ${name}${unit}k b $blk $(($unit * 8 + $highpartoffset + 10))
mknod ${name}${unit}l b $blk $(($unit * 8 + $highpartoffset + 11))
mknod ${name}${unit}m b $blk $(($unit * 8 + $highpartoffset + 12))
mknod ${name}${unit}n b $blk $(($unit * 8 + $highpartoffset + 13))
mknod ${name}${unit}o b $blk $(($unit * 8 + $highpartoffset + 14))
mknod ${name}${unit}p b $blk $(($unit * 8 + $highpartoffset + 15))
mknod r${name}${unit}a c $chr $(($unit * 8 + 0))
mknod r${name}${unit}b c $chr $(($unit * 8 + 1))
mknod r${name}${unit}c c $chr $(($unit * 8 + 2))
@ -424,6 +434,14 @@ ccd*|fd*|ld*|raid*|sd*|vnd*|wd*)
mknod r${name}${unit}f c $chr $(($unit * 8 + 5))
mknod r${name}${unit}g c $chr $(($unit * 8 + 6))
mknod r${name}${unit}h c $chr $(($unit * 8 + 7))
mknod r${name}${unit}i c $chr $(($unit * 8 + $highpartoffset + 8))
mknod r${name}${unit}j c $chr $(($unit * 8 + $highpartoffset + 9))
mknod r${name}${unit}k c $chr $(($unit * 8 + $highpartoffset + 10))
mknod r${name}${unit}l c $chr $(($unit * 8 + $highpartoffset + 11))
mknod r${name}${unit}m c $chr $(($unit * 8 + $highpartoffset + 12))
mknod r${name}${unit}n c $chr $(($unit * 8 + $highpartoffset + 13))
mknod r${name}${unit}o c $chr $(($unit * 8 + $highpartoffset + 14))
mknod r${name}${unit}p c $chr $(($unit * 8 + $highpartoffset + 15))
chgrp operator $name$unit? r$name$unit?
chmod 640 $name$unit? r$name$unit?
;;

View File

@ -1,4 +1,4 @@
/* $NetBSD: disklabel.h,v 1.8 1999/01/27 20:54:57 thorpej Exp $ */
/* $NetBSD: disklabel.h,v 1.9 2001/01/02 23:06:54 tron 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 __I386_MAXDISKS ((1 << 20) / MAXPARTITIONS)
#define DISKUNIT(dev) ((minor(dev) / OLDMAXPARTITIONS) % __I386_MAXDISKS)
#define DISKPART(dev) ((minor(dev) % OLDMAXPARTITIONS) + \
((minor(dev) / (__I386_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
#define DISKMINOR(unit, part) \
(((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
((part) / OLDMAXPARTITIONS) * (__I386_MAXDISKS * OLDMAXPARTITIONS))
/* Pull in MBR partition definitions. */
#include <sys/disklabel_mbr.h>

View File

@ -59,10 +59,12 @@
/*
* Translate between device numbers and major/disk unit/disk partition.
*/
#ifndef __i386__
#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)
#define DISKPART(dev) (minor(dev) % MAXPARTITIONS)
#define DISKMINOR(unit, part) \
(((unit) * MAXPARTITIONS) + (part))
#endif
#define MAKEDISKDEV(maj, unit, part) \
(makedev((maj), DISKMINOR((unit), (part))))