1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-22 15:47:37 +00:00

We don't need to pass the diskname argument all over the diskslice/label

code, we can find the name from any convenient dev_t
This commit is contained in:
Poul-Henning Kamp 1999-08-28 14:33:44 +00:00
parent f5fe620a92
commit 10af1a2b5f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50511
22 changed files with 114 additions and 124 deletions

View File

@ -65,7 +65,7 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
static void mbr_extended __P((dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
@ -151,8 +151,7 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, lp, sspp)
char *dname;
dsinit(dev, lp, sspp)
dev_t dev;
struct disklabel *lp;
struct diskslices **sspp;
@ -184,7 +183,8 @@ dsinit(dname, dev, lp, sspp)
bp->b_flags |= B_READ;
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
diskerr(bp, devtoname(bp->b_dev),
"error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
error = EIO;
@ -193,7 +193,7 @@ dsinit(dname, dev, lp, sspp)
/* Weakly verify it. */
cp = bp->b_data;
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
if (bootverbose)
@ -271,7 +271,7 @@ dsinit(dname, dev, lp, sspp)
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0
&& dp->dp_start == 0 && dp->dp_size == 0)
continue;
sname = dsname(dname, dkunit(dev), BASE_SLICE + dospart,
sname = dsname(dev, dkunit(dev), BASE_SLICE + dospart,
RAW_PART, partname);
/*
@ -334,7 +334,7 @@ dsinit(dname, dev, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, lp, ssp,
mbr_extended(bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -347,9 +347,8 @@ dsinit(dname, dev, lp, sspp)
}
void
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
mbr_extended(dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
struct diskslices *ssp;
@ -381,7 +380,8 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_flags |= B_READ;
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
diskerr(bp, devtoname(bp->b_dev),
"error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
goto done;
@ -390,7 +390,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* Weakly verify it. */
cp = bp->b_data;
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (bootverbose)
printf("%s: invalid extended partition table: no magic\n",
@ -416,7 +416,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
dp->dp_typ == DOSPTYP_EXTENDEDX) {
char buf[32];
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
@ -426,7 +426,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
ext_offsets[dospart] = base_ext_offset + dp->dp_start;
ext_sizes[dospart] = dp->dp_size;
} else {
sname = dsname(dname, dkunit(dev), slice, RAW_PART,
sname = dsname(dev, dkunit(dev), slice, RAW_PART,
partname);
check_part(sname, dp, ext_offset, nsectors, ntracks,
mbr_offset);
@ -447,7 +447,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, lp, ssp,
mbr_extended(dev, lp, ssp,
ext_offsets[dospart], ext_sizes[dospart],
base_ext_offset, nsectors, ntracks,
mbr_offset);

View File

@ -418,7 +418,7 @@ setroot()
newrootdev = makebdev(majdev, mindev);
rootdevs[0] = newrootdev;
sname = dsname(devsw(newrootdev)->d_name, unit, slice, part, partname);
sname = dsname(newrootdev, unit, slice, part, partname);
rootdevnames[0] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
sprintf(rootdevnames[0], "%s%s", sname, partname);
@ -435,7 +435,7 @@ setroot()
return;
slice = COMPATIBILITY_SLICE;
rootdevs[1] = dkmodslice(newrootdev, slice);
sname = dsname(devsw(newrootdev)->d_name, unit, slice, part, partname);
sname = dsname(newrootdev, unit, slice, part, partname);
rootdevnames[1] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
sprintf(rootdevnames[1], "%s%s", sname, partname);
}

View File

@ -956,7 +956,7 @@ cdopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_partitions[0].p_fstype = FS_OTHER;
/* Initialize slice tables. */
error = dsopen("cd", dev, fmt, DSO_NOLABELS | DSO_ONESLICE,
error = dsopen(dev, fmt, DSO_NOLABELS | DSO_ONESLICE,
&softc->cd_slices, &label);
if (error == 0) {
@ -2452,7 +2452,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
* Check to see whether we've got a disk-type ioctl. If we
* don't, dsioctl will pass back an error code of ENOIOCTL.
*/
error = dsioctl("cd", dev, cmd, addr, flag, &softc->cd_slices);
error = dsioctl(dev, cmd, addr, flag, &softc->cd_slices);
if (error != ENOIOCTL)
break;

View File

@ -380,7 +380,7 @@ daopen(dev_t dev, int flags, int fmt, struct proc *p)
}
/* Initialize slice tables. */
error = dsopen("da", dev, fmt, 0, &softc->dk_slices, &label);
error = dsopen(dev, fmt, 0, &softc->dk_slices, &label);
/*
* Check to see whether or not the blocksize is set yet.
@ -599,7 +599,7 @@ daioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
return (error); /* error code from tsleep */
}
error = dsioctl("da", dev, cmd, addr, flag, &softc->dk_slices);
error = dsioctl(dev, cmd, addr, flag, &softc->dk_slices);
if (error == ENOIOCTL)
error = cam_periph_ioctl(periph, cmd, addr, daerror);

View File

@ -146,7 +146,7 @@ flaopen(dev_t dev, int flag, int fmt, struct proc *p)
dk_dd.d_secsize = DEV_BSIZE;
dk_dd.d_secpercyl = dk_dd.d_ntracks * dk_dd.d_nsectors;
error = dsopen("fla", dev, fmt, 0, &sc->dk_slices, &dk_dd);
error = dsopen(dev, fmt, 0, &sc->dk_slices, &dk_dd);
if (error)
return (error);
return (0);
@ -178,7 +178,7 @@ flaioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
dev2udev(dev), cmd, addr, flags, p);
unit = dkunit(dev);
sc = &softc[unit];
error = dsioctl("fla", dev, cmd, addr, flags, &sc->dk_slices);
error = dsioctl(dev, cmd, addr, flags, &sc->dk_slices);
if (error == ENOIOCTL)
error = ENOTTY;
return (error);

View File

@ -302,7 +302,7 @@ printf("adopen: lun=%d adnlun=%d\n", lun, adnlun);
label.d_secpercyl = adp->sectors * adp->heads;
label.d_secperunit = adp->total_secs;
error = dsopen("ad", dev, fmt, 0, &adp->slices, &label);
error = dsopen(dev, fmt, 0, &adp->slices, &label);
adp->flags &= ~AD_F_LABELLING;
ad_sleep(adp, "adop2");
@ -336,7 +336,7 @@ adioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
return ENXIO;
ad_sleep(adp, "adioct");
error = dsioctl("sd", dev, cmd, addr, flags, &adp->slices);
error = dsioctl(dev, cmd, addr, flags, &adp->slices);
if (error != ENOIOCTL)
return error;

View File

@ -235,7 +235,7 @@ afdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
label.d_secperunit = fdp->cap.heads * fdp->cap.sectors * fdp->cap.cylinders;
/* initialize slice tables. */
return dsopen("afd", dev, fmt, 0, &fdp->slices, &label);
return dsopen(dev, fmt, 0, &fdp->slices, &label);
}
static int
@ -263,7 +263,7 @@ afdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
if (lun >= afdnlun || !(fdp = afdtab[lun]))
return ENXIO;
error = dsioctl("sd", dev, cmd, addr, flag, &fdp->slices);
error = dsioctl(dev, cmd, addr, flag, &fdp->slices);
if (error != ENOIOCTL)
return error;

View File

@ -144,7 +144,7 @@ idopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_secperunit = drv->secperunit;
/* Initialize slice tables. */
error = dsopen("id", dev, fmt, 0, &drv->slices, &label);
error = dsopen(dev, fmt, 0, &drv->slices, &label);
return (error);
}
@ -171,7 +171,7 @@ idioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
if (drv == NULL)
return (ENXIO);
error = dsioctl("id", dev, cmd, addr, flag, &drv->slices);
error = dsioctl(dev, cmd, addr, flag, &drv->slices);
if (error == ENOIOCTL)
return (ENOTTY);

View File

@ -237,8 +237,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
label.d_secperunit = vn->sc_size;
label.d_partitions[RAW_PART].p_size = vn->sc_size;
return (dsopen("vn", dev, mode, 0, &vn->sc_slices,
&label));
return (dsopen(dev, mode, 0, &vn->sc_slices, &label));
}
if (dkslice(dev) != WHOLE_DISK_SLICE ||
dkpart(dev) != RAW_PART ||
@ -393,8 +392,7 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
IFOPT(vn,VN_LABELS) {
if (vn->sc_slices != NULL) {
error = dsioctl("vn", dev, cmd, data, flag,
&vn->sc_slices);
error = dsioctl(dev, cmd, data, flag, &vn->sc_slices);
if (error != ENOIOCTL)
return (error);
}

View File

@ -418,7 +418,7 @@ setroot()
newrootdev = makebdev(majdev, mindev);
rootdevs[0] = newrootdev;
sname = dsname(devsw(newrootdev)->d_name, unit, slice, part, partname);
sname = dsname(newrootdev, unit, slice, part, partname);
rootdevnames[0] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
sprintf(rootdevnames[0], "%s%s", sname, partname);
@ -435,7 +435,7 @@ setroot()
return;
slice = COMPATIBILITY_SLICE;
rootdevs[1] = dkmodslice(newrootdev, slice);
sname = dsname(devsw(newrootdev)->d_name, unit, slice, part, partname);
sname = dsname(newrootdev, unit, slice, part, partname);
rootdevnames[1] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
sprintf(rootdevnames[1], "%s%s", sname, partname);
}

View File

@ -64,7 +64,7 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
static void mbr_extended __P((dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
@ -150,8 +150,7 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, lp, sspp)
char *dname;
dsinit(dev, lp, sspp)
dev_t dev;
struct disklabel *lp;
struct diskslices **sspp;
@ -182,7 +181,8 @@ dsinit(dname, dev, lp, sspp)
bp->b_flags |= B_READ;
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
diskerr(bp, devtoname(bp->b_dev),
"error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
error = EIO;
@ -191,7 +191,7 @@ dsinit(dname, dev, lp, sspp)
/* Weakly verify it. */
cp = bp->b_data;
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
if (bootverbose)
@ -263,7 +263,7 @@ dsinit(dname, dev, lp, sspp)
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0
&& dp->dp_start == 0 && dp->dp_size == 0)
continue;
sname = dsname(dname, dkunit(dev), BASE_SLICE + dospart,
sname = dsname(dev, dkunit(dev), BASE_SLICE + dospart,
RAW_PART, partname);
/*
@ -326,7 +326,7 @@ dsinit(dname, dev, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, lp, ssp,
mbr_extended(bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -339,9 +339,8 @@ dsinit(dname, dev, lp, sspp)
}
void
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
mbr_extended(dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
struct diskslices *ssp;
@ -371,7 +370,8 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_flags |= B_READ;
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
diskerr(bp, devtoname(bp->b_dev),
"error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
goto done;
@ -380,7 +380,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* Weakly verify it. */
cp = bp->b_data;
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (bootverbose)
printf("%s: invalid extended partition table: no magic\n",
@ -400,7 +400,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
dp->dp_typ == DOSPTYP_EXTENDEDX) {
char buf[32];
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
@ -410,7 +410,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
ext_offsets[dospart] = base_ext_offset + dp->dp_start;
ext_sizes[dospart] = dp->dp_size;
} else {
sname = dsname(dname, dkunit(dev), slice, RAW_PART,
sname = dsname(dev, dkunit(dev), slice, RAW_PART,
partname);
check_part(sname, dp, ext_offset, nsectors, ntracks,
mbr_offset);
@ -431,7 +431,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, lp, ssp, ext_offsets[dospart],
mbr_extended(dev, lp, ssp, ext_offsets[dospart],
ext_sizes[dospart], base_ext_offset,
nsectors, ntracks, mbr_offset);

View File

@ -1233,7 +1233,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_ncylinders = du->dk_dd.d_ncylinders;
label.d_secpercyl = du->dk_dd.d_secpercyl;
label.d_secperunit = du->dk_dd.d_secperunit;
error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label);
error = dsopen(dev, fmt, 0, &du->dk_slices, &label);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");
@ -1878,7 +1878,7 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
du = wddrives[lunit];
wdsleep(du->dk_ctrlr, "wdioct");
error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices);
error = dsioctl(dev, cmd, addr, flags, &du->dk_slices);
if (error != ENOIOCTL)
return (error);
switch (cmd) {

View File

@ -374,7 +374,7 @@ int wfdopen (dev_t dev, int flags, int fmt, struct proc *p)
label.d_secperunit = label.d_secpercyl * t->cap.cyls;
/* Initialize slice tables. */
errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label);
errcode = dsopen(dev, fmt, 0, &t->dk_slices, &label);
if (errcode != 0)
return errcode;
@ -627,7 +627,7 @@ int wfdioctl (dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
struct wfd *t = wfdtab[lun];
int error = 0;
error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices);
error = dsioctl(dev, cmd, addr, flag, &t->dk_slices);
if (error != ENOIOCTL)
return (error);

View File

@ -373,7 +373,7 @@ diskerr(bp, dname, what, pri, blkdone, lp)
pr = addlog;
} else
pr = printf;
sname = dsname(dname, unit, slice, part, partname);
sname = dsname(bp->b_dev, unit, slice, part, partname);
(*pr)("%s%s: %s %sing fsbn ", sname, partname, what,
bp->b_flags & B_READ ? "read" : "writ");
sn = bp->b_blkno;

View File

@ -64,7 +64,7 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
static void mbr_extended __P((dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
@ -150,8 +150,7 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, lp, sspp)
char *dname;
dsinit(dev, lp, sspp)
dev_t dev;
struct disklabel *lp;
struct diskslices **sspp;
@ -182,7 +181,8 @@ dsinit(dname, dev, lp, sspp)
bp->b_flags |= B_READ;
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
diskerr(bp, devtoname(bp->b_dev),
"error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
error = EIO;
@ -191,7 +191,7 @@ dsinit(dname, dev, lp, sspp)
/* Weakly verify it. */
cp = bp->b_data;
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
if (bootverbose)
@ -263,7 +263,7 @@ dsinit(dname, dev, lp, sspp)
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0
&& dp->dp_start == 0 && dp->dp_size == 0)
continue;
sname = dsname(dname, dkunit(dev), BASE_SLICE + dospart,
sname = dsname(dev, dkunit(dev), BASE_SLICE + dospart,
RAW_PART, partname);
/*
@ -326,7 +326,7 @@ dsinit(dname, dev, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, lp, ssp,
mbr_extended(bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -339,9 +339,8 @@ dsinit(dname, dev, lp, sspp)
}
void
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
mbr_extended(dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
struct diskslices *ssp;
@ -371,7 +370,8 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_flags |= B_READ;
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
diskerr(bp, devtoname(bp->b_dev),
"error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
goto done;
@ -380,7 +380,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* Weakly verify it. */
cp = bp->b_data;
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (bootverbose)
printf("%s: invalid extended partition table: no magic\n",
@ -400,7 +400,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
dp->dp_typ == DOSPTYP_EXTENDEDX) {
char buf[32];
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
@ -410,7 +410,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
ext_offsets[dospart] = base_ext_offset + dp->dp_start;
ext_sizes[dospart] = dp->dp_size;
} else {
sname = dsname(dname, dkunit(dev), slice, RAW_PART,
sname = dsname(dev, dkunit(dev), slice, RAW_PART,
partname);
check_part(sname, dp, ext_offset, nsectors, ntracks,
mbr_offset);
@ -431,7 +431,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, lp, ssp, ext_offsets[dospart],
mbr_extended(dev, lp, ssp, ext_offsets[dospart],
ext_sizes[dospart], base_ext_offset,
nsectors, ntracks, mbr_offset);

View File

@ -88,12 +88,8 @@ static void set_ds_bad __P((struct diskslices *ssp, int slice,
struct dkbad_intern *btp));
static void set_ds_label __P((struct diskslices *ssp, int slice,
struct disklabel *lp));
#ifdef DEVFS
static void set_ds_labeldevs __P((char *dname, dev_t dev,
struct diskslices *ssp));
static void set_ds_labeldevs_unaliased __P((char *dname, dev_t dev,
struct diskslices *ssp));
#endif
static void set_ds_labeldevs __P((dev_t dev, struct diskslices *ssp));
static void set_ds_labeldevs_unaliased __P((dev_t dev, struct diskslices *ssp));
static void set_ds_wlabel __P((struct diskslices *ssp, int slice,
int wlabel));
@ -375,8 +371,7 @@ dsgone(sspp)
* is subject to the same restriction as dsopen().
*/
int
dsioctl(dname, dev, cmd, data, flags, sspp)
char *dname;
dsioctl(dev, cmd, data, flags, sspp)
dev_t dev;
u_long cmd;
caddr_t data;
@ -476,9 +471,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp)
}
free_ds_label(ssp, slice);
set_ds_label(ssp, slice, lp);
#ifdef DEVFS
set_ds_labeldevs(dname, dev, ssp);
#endif
set_ds_labeldevs(dev, ssp);
return (0);
case DIOCSYNCSLICEINFO:
@ -502,7 +495,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp)
*sspp = NULL;
lp = malloc(sizeof *lp, M_DEVBUF, M_WAITOK);
*lp = *ssp->dss_slices[WHOLE_DISK_SLICE].ds_label;
error = dsopen(dname, dev,
error = dsopen(dev,
ssp->dss_slices[WHOLE_DISK_SLICE].ds_copenmask
& (1 << RAW_PART) ? S_IFCHR : S_IFBLK,
ssp->dss_oflags, sspp, lp);
@ -522,7 +515,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp)
part = 0; openmask; openmask >>= 1, part++) {
if (!(openmask & 1))
continue;
error = dsopen(dname,
error = dsopen(
dkmodslice(dkmodpart(dev, part),
slice),
S_IFBLK, ssp->dss_oflags, sspp,
@ -539,7 +532,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp)
part = 0; openmask; openmask >>= 1, part++) {
if (!(openmask & 1))
continue;
error = dsopen(dname,
error = dsopen(
dkmodslice(dkmodpart(dev, part),
slice),
S_IFCHR, ssp->dss_oflags, sspp,
@ -560,7 +553,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp)
return (0);
case DIOCWDINFO:
error = dsioctl(dname, dev, DIOCSDINFO, data, flags, &ssp);
error = dsioctl(dev, DIOCSDINFO, data, flags, &ssp);
if (error != 0)
return (error);
/*
@ -660,15 +653,17 @@ dsmakeslicestruct(nslices, lp)
}
char *
dsname(dname, unit, slice, part, partname)
char *dname;
dsname(dev, unit, slice, part, partname)
dev_t dev;
int unit;
int slice;
int part;
char *partname;
{
static char name[32];
char *dname;
dname = devsw(dev)->d_name;
if (strlen(dname) > 16)
dname = "nametoolong";
snprintf(name, sizeof(name), "%s%d", dname, unit);
@ -689,8 +684,7 @@ dsname(dname, unit, slice, part, partname)
* strategy routine must be special to allow activity.
*/
int
dsopen(dname, dev, mode, flags, sspp, lp)
char *dname;
dsopen(dev, mode, flags, sspp, lp)
dev_t dev;
int mode;
u_int flags;
@ -721,7 +715,7 @@ dsopen(dname, dev, mode, flags, sspp, lp)
unit = dkunit(dev);
if (lp->d_secsize % DEV_BSIZE) {
printf("%s%d: invalid sector size %lu\n", dname, unit,
printf("%s: invalid sector size %lu\n", devtoname(dev),
(u_long)lp->d_secsize);
return (EINVAL);
}
@ -744,7 +738,7 @@ dsopen(dname, dev, mode, flags, sspp, lp)
if (!(flags & DSO_ONESLICE)) {
TRACE(("dsinit\n"));
error = dsinit(dname, dev, lp, sspp);
error = dsinit(dev, lp, sspp);
if (error != 0) {
dsgone(sspp);
return (error);
@ -793,7 +787,7 @@ dsopen(dname, dev, mode, flags, sspp, lp)
)
continue;
dev1 = dkmodslice(dkmodpart(dev, RAW_PART), slice);
sname = dsname(dname, unit, slice, RAW_PART, partname);
sname = dsname(dev, unit, slice, RAW_PART, partname);
#ifdef DEVFS
if (slice != COMPATIBILITY_SLICE && sp->ds_bdev == NULL
&& sp->ds_size != 0) {
@ -850,9 +844,7 @@ dsopen(dname, dev, mode, flags, sspp, lp)
}
}
set_ds_label(ssp, slice, lp1);
#ifdef DEVFS
set_ds_labeldevs(dname, dev1, ssp);
#endif
set_ds_labeldevs(dev1, ssp);
set_ds_wlabel(ssp, slice, FALSE);
}
@ -1092,33 +1084,33 @@ set_ds_label(ssp, slice, lp)
ssp->dss_slices[COMPATIBILITY_SLICE].ds_label = lp;
}
#ifdef DEVFS
static void
set_ds_labeldevs(dname, dev, ssp)
char *dname;
set_ds_labeldevs(dev, ssp)
dev_t dev;
struct diskslices *ssp;
{
#ifdef DEVFS
int slice;
set_ds_labeldevs_unaliased(dname, dev, ssp);
set_ds_labeldevs_unaliased(dev, ssp);
if (ssp->dss_first_bsd_slice == COMPATIBILITY_SLICE)
return;
slice = dkslice(dev);
if (slice == COMPATIBILITY_SLICE)
set_ds_labeldevs_unaliased(dname,
set_ds_labeldevs_unaliased(
dkmodslice(dev, ssp->dss_first_bsd_slice), ssp);
else if (slice == ssp->dss_first_bsd_slice)
set_ds_labeldevs_unaliased(dname,
set_ds_labeldevs_unaliased(
dkmodslice(dev, COMPATIBILITY_SLICE), ssp);
#endif /* DEVFS */
}
static void
set_ds_labeldevs_unaliased(dname, dev, ssp)
char *dname;
set_ds_labeldevs_unaliased(dev, ssp)
dev_t dev;
struct diskslices *ssp;
{
#ifdef DEVFS
struct disklabel *lp;
int mynor;
int part;
@ -1137,7 +1129,7 @@ set_ds_labeldevs_unaliased(dname, dev, ssp)
pp = &lp->d_partitions[part];
if (pp->p_size == 0)
continue;
sname = dsname(dname, dkunit(dev), slice, part, partname);
sname = dsname(dev, dkunit(dev), slice, part, partname);
if (part == RAW_PART && sp->ds_bdev != NULL) {
sp->ds_bdevs[part] =
devfs_makelink(sp->ds_bdev,
@ -1157,8 +1149,8 @@ set_ds_labeldevs_unaliased(dname, dev, ssp)
"r%s%s", sname, partname);
}
}
}
#endif /* DEVFS */
}
static void
set_ds_wlabel(ssp, slice, wlabel)

View File

@ -203,7 +203,7 @@ atcompat_dsinit(dname, dev, lp, sspp)
/* Weakly verify it. */
cp = bp->b_data;
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
if (bootverbose)
@ -275,7 +275,7 @@ atcompat_dsinit(dname, dev, lp, sspp)
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0
&& dp->dp_start == 0 && dp->dp_size == 0)
continue;
sname = dsname(dname, dkunit(dev), BASE_SLICE + dospart,
sname = dsname(dev, dkunit(dev), BASE_SLICE + dospart,
RAW_PART, partname);
/*
@ -397,7 +397,7 @@ atcompat_extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* Weakly verify it. */
cp = bp->b_data;
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (bootverbose)
printf("%s: invalid extended partition table: no magic\n",
@ -417,7 +417,7 @@ atcompat_extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
dp->dp_typ == DOSPTYP_EXTENDEDX) {
char buf[32];
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
@ -427,7 +427,7 @@ atcompat_extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
ext_offsets[dospart] = base_ext_offset + dp->dp_start;
ext_sizes[dospart] = dp->dp_size;
} else {
sname = dsname(dname, dkunit(dev), slice, RAW_PART,
sname = dsname(dev, dkunit(dev), slice, RAW_PART,
partname);
check_part(sname, dp, ext_offset, nsectors, ntracks,
mbr_offset);

View File

@ -257,7 +257,7 @@ dsinit(dname, dev, lp, sspp)
/* Weakly verify it. */
cp = bp->b_data;
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
if (bootverbose)
@ -272,7 +272,7 @@ dsinit(dname, dev, lp, sspp)
*/
if ((*(cp + 512) == 0x57) && (*(cp + 513) == 0x45) &&
(*(cp + 514) == 0x56) && (*(cp + 515) == 0x82)) {
sname = dsname(dname, dkunit(dev), BASE_SLICE,
sname = dsname(dev, dkunit(dev), BASE_SLICE,
RAW_PART, partname);
free(*sspp, M_DEVBUF);
ssp = dsmakeslicestruct(MAX_SLICES, lp);
@ -296,7 +296,7 @@ dsinit(dname, dev, lp, sspp)
(*(cp + 0x1c) == 0x0) &&
((*(cp + 512) == 0xf0) || (*(cp + 512) == 0xf8)) &&
(*(cp + 513) == 0xff) && (*(cp + 514) == 0xff)) {
sname = dsname(dname, dkunit(dev), BASE_SLICE,
sname = dsname(dev, dkunit(dev), BASE_SLICE,
RAW_PART, partname);
free(*sspp, M_DEVBUF);
ssp = dsmakeslicestruct(MAX_SLICES, lp);
@ -405,14 +405,14 @@ dsinit(dname, dev, lp, sspp)
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0)
continue;
sname = dsname(dname, dkunit(dev), BASE_SLICE + dospart,
sname = dsname(dev, dkunit(dev), BASE_SLICE + dospart,
RAW_PART, partname);
#else
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0
&& dp->dp_start == 0 && dp->dp_size == 0)
continue;
sname = dsname(dname, dkunit(dev), BASE_SLICE + dospart,
sname = dsname(dev, dkunit(dev), BASE_SLICE + dospart,
RAW_PART, partname);
#endif
/*
@ -546,7 +546,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* Weakly verify it. */
cp = bp->b_data;
if (cp[0x1FE] != 0x55 || cp[0x1FF] != 0xAA) {
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART,
partname);
if (bootverbose)
printf("%s: invalid extended partition table: no magic\n",
@ -574,7 +574,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
#endif
char buf[32];
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
sname = dsname(dev, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
@ -591,7 +591,7 @@ extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
ext_sizes[dospart] = dp->dp_size;
#endif
} else {
sname = dsname(dname, dkunit(dev), slice, RAW_PART,
sname = dsname(dev, dkunit(dev), slice, RAW_PART,
partname);
check_part(sname, dp, ext_offset, nsectors, ntracks,
mbr_offset);

View File

@ -1359,7 +1359,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_ncylinders = du->dk_dd.d_ncylinders;
label.d_secpercyl = du->dk_dd.d_secpercyl;
label.d_secperunit = du->dk_dd.d_secperunit;
error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label);
error = dsopen(dev, fmt, 0, &du->dk_slices, &label);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");
@ -2099,7 +2099,7 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
du = wddrives[lunit];
wdsleep(du->dk_ctrlr, "wdioct");
error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices);
error = dsioctl(dev, cmd, addr, flags, &du->dk_slices);
if (error != ENOIOCTL)
return (error);
#ifdef PC98

View File

@ -374,7 +374,7 @@ int wfdopen (dev_t dev, int flags, int fmt, struct proc *p)
label.d_secperunit = label.d_secpercyl * t->cap.cyls;
/* Initialize slice tables. */
errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label);
errcode = dsopen(dev, fmt, 0, &t->dk_slices, &label);
if (errcode != 0)
return errcode;
@ -627,7 +627,7 @@ int wfdioctl (dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
struct wfd *t = wfdtab[lun];
int error = 0;
error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices);
error = dsioctl(dev, cmd, addr, flag, &t->dk_slices);
if (error != ENOIOCTL)
return (error);

View File

@ -95,15 +95,15 @@ struct disklabel;
int dscheck __P((struct buf *bp, struct diskslices *ssp));
void dsclose __P((dev_t dev, int mode, struct diskslices *ssp));
void dsgone __P((struct diskslices **sspp));
int dsinit __P((char *dname, dev_t dev, struct disklabel *lp,
int dsinit __P((dev_t dev, struct disklabel *lp,
struct diskslices **sspp));
int dsioctl __P((char *dname, dev_t dev, u_long cmd, caddr_t data,
int dsioctl __P((dev_t dev, u_long cmd, caddr_t data,
int flags, struct diskslices **sspp));
int dsisopen __P((struct diskslices *ssp));
struct diskslices *dsmakeslicestruct __P((int nslices, struct disklabel *lp));
char *dsname __P((char *dname, int unit, int slice, int part,
char *dsname __P((dev_t dev, int unit, int slice, int part,
char *partname));
int dsopen __P((char *dname, dev_t dev, int mode, u_int flags,
int dsopen __P((dev_t dev, int mode, u_int flags,
struct diskslices **sspp, struct disklabel *lp));
int dssize __P((dev_t dev, struct diskslices **sspp));

View File

@ -373,7 +373,7 @@ diskerr(bp, dname, what, pri, blkdone, lp)
pr = addlog;
} else
pr = printf;
sname = dsname(dname, unit, slice, part, partname);
sname = dsname(bp->b_dev, unit, slice, part, partname);
(*pr)("%s%s: %s %sing fsbn ", sname, partname, what,
bp->b_flags & B_READ ? "read" : "writ");
sn = bp->b_blkno;