dev_t bootdev;
#endif
-#define PARTITIONMASK 0x7
-#define PARTITIONSHIFT 3
-
struct nam2blk {
char *name;
int maj;
{
register struct device *dv;
register char *cp, c;
- int majdev, mindev, part;
+ int majdev, unit, part;
if (len == 0)
return (NULL);
cp = str + len - 1;
c = *cp;
- if (c >= 'a' && c <= 'h') {
+ if (c >= 'a' && (c - 'a') < MAXPARTITIONS) {
part = c - 'a';
*cp = '\0';
} else
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
+ unit = dv->dv_unit;
if (majdev < 0)
panic("parsedisk");
- mindev = (dv->dv_unit << PARTITIONSHIFT) + part;
- *devp = makedev(majdev, mindev);
+ *devp = MAKEDISKDEV(majdev, unit, part);
break;
}
#ifdef NFSCLIENT
{
register struct swdevt *swp;
register struct device *dv;
- register int len, majdev, mindev;
+ register int len, majdev, unit, part;
dev_t nrootdev, nswapdev = NODEV;
char buf[128];
dev_t temp;
nswapdev = NODEV;
break;
case DV_DISK:
- nswapdev = makedev(major(nrootdev),
- (minor(nrootdev) & ~ PARTITIONMASK) | 1);
+ nswapdev = MAKEDISKDEV(major(nrootdev),
+ DISKUNIT(nrootdev), 1);
break;
case DV_TAPE:
case DV_TTY:
* val[2] of the boot device is the partition number.
* Assume swap is on partition b.
*/
- int part = bp->val[2];
- mindev = (bootdv->dv_unit << PARTITIONSHIFT) + part;
- rootdev = makedev(majdev, mindev);
- nswapdev = dumpdev = makedev(major(rootdev),
- (minor(rootdev) & ~ PARTITIONMASK) | 1);
+ part = bp->val[2];
+ unit = bootdv->dv_unit;
+ rootdev = MAKEDISKDEV(majdev, unit, part);
+ nswapdev = dumpdev = MAKEDISKDEV(major(rootdev),
+ DISKUNIT(rootdev), 1);
} else {
/*
* Root and swap are on a net.
* rootdev/swdevt/mountroot already properly set.
*/
majdev = major(rootdev);
- mindev = minor(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
goto gotroot;
}
case DV_DISK:
mountroot = dk_mountroot;
majdev = major(rootdev);
- mindev = minor(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
printf("root on %s%c\n", bootdv->dv_xname,
- (mindev & PARTITIONMASK) + 'a');
+ part + 'a');
break;
default:
printf("can't figure root, hope your kernel is right\n");
/*
* Make the swap partition on the root drive the primary swap.
*/
- mindev &= ~PARTITIONMASK;
temp = NODEV;
for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
if (majdev == major(swp->sw_dev) &&
- mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) {
+ unit == DISKUNIT(swp->sw_dev)) {
temp = swdevt[0].sw_dev;
swdevt[0].sw_dev = swp->sw_dev;
swp->sw_dev = temp;