- Remove unnecessary prototype declaration of readdisklabel().

- Use DISKPART/DISKMINOR/DISKUNIT instead of dkpart/dkminor/dkunit.
This commit is contained in:
tsutsui 2000-03-07 15:35:42 +00:00
parent 020a8ac5b2
commit d9d840d522

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.3 2000/01/18 19:46:07 thorpej Exp $ */
/* $NetBSD: disksubr.c,v 1.4 2000/03/07 15:35:42 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -41,11 +41,6 @@
#include <sys/device.h>
#include <sys/disk.h>
#include <sys/disklabel.h>
#include <sys/syslog.h>
char* readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)),
register struct disklabel *lp,
struct cpu_disklabel *osdep));
/*
* Attempt to read a disk label from a device
@ -144,11 +139,6 @@ setdisklabel(olp, nlp, openmask, osdep)
return (0);
}
/* encoding of disk minor numbers, should be elsewhere... */
#define dkunit(dev) (minor(dev) >> 3)
#define dkpart(dev) (minor(dev) & 07)
#define dkminor(unit, part) (((unit) << 3) | (part))
/*
* Write disk label back to device after modification.
*/
@ -164,14 +154,14 @@ writedisklabel(dev, strat, lp, osdep)
int labelpart;
int error = 0;
labelpart = dkpart(dev);
labelpart = DISKPART(dev);
if (lp->d_partitions[labelpart].p_offset != 0) {
if (lp->d_partitions[0].p_offset != 0)
return (EXDEV); /* not quite right */
labelpart = 0;
}
bp = geteblk((int)lp->d_secsize);
bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), labelpart));
bp->b_dev = makedev(major(dev), DISKMINOR(DISKUNIT(dev), labelpart));
bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_READ;
@ -222,7 +212,7 @@ bounds_check_with_label(bp, lp, wlabel)
int wlabel;
{
struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int labelsect = lp->d_partitions[0].p_offset;
int maxsz = p->p_size;
int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;