1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Add a DSO_BAD144 flag which indicates that the driver actually understand

BAD144 handling.

Reject DIOCSBAD and labels with BAD144 tables if the driver cannot grok it.

Reviewed by:    bde
This commit is contained in:
Poul-Henning Kamp 1999-09-20 17:04:39 +00:00
parent 624aff9227
commit 81f7c76af5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51467
4 changed files with 12 additions and 3 deletions

View File

@ -1210,7 +1210,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(dev, fmt, 0, &du->dk_slices, &label);
error = dsopen(dev, fmt, DSO_BAD144, &du->dk_slices, &label);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");

View File

@ -429,6 +429,8 @@ dsioctl(dev, cmd, data, flags, sspp)
return (0);
case DIOCSBAD:
if ((ssp->dss_oflags & DSO_BAD144) == 0)
return (ENODEV);
if (slice == WHOLE_DISK_SLICE)
return (ENODEV);
if (!(flags & FWRITE))
@ -829,11 +831,17 @@ dsopen(dev, mode, flags, sspp, lp)
continue;
}
if (lp1->d_flags & D_BADSECT) {
if ((flags & DSO_BAD144) == 0) {
log(LOG_ERR,
"%s: bad sector table no supported\n",
sname);
continue;
}
btp = malloc(sizeof *btp, M_DEVBUF, M_WAITOK);
TRACE(("readbad144\n"));
msg = readbad144(dev1, lp1, btp);
if (msg != NULL) {
log(LOG_WARNING,
log(LOG_ERR,
"%s: cannot find bad sector table (%s)\n",
sname, msg);
free(btp, M_DEVBUF);

View File

@ -1336,7 +1336,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(dev, fmt, 0, &du->dk_slices, &label);
error = dsopen(dev, fmt, DSO_BAD144, &du->dk_slices, &label);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");

View File

@ -85,6 +85,7 @@ struct diskslices {
/* Flags for dsopen(). */
#define DSO_NOLABELS 1
#define DSO_ONESLICE 2
#define DSO_BAD144 4
#define dsgetbad(dev, ssp) (ssp->dss_slices[dkslice(dev)].ds_bad)
#define dsgetlabel(dev, ssp) (ssp->dss_slices[dkslice(dev)].ds_label)