NetBSD Problem Report #1606
From gnats Mon Oct 9 22:39:33 1995
Received: from azathoth (slip-5-24.shore.net [198.115.180.224]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id WAA02771 for <gnats-bugs@gnats.netbsd.org>; Mon, 9 Oct 1995 22:39:21 -0400
Message-Id: <199510100236.WAA00412@azathoth>
Date: Mon, 9 Oct 1995 22:36:42 -0400
From: Mike Long <mike.long@analog.com>
Reply-To: Mike Long <mike.long@analog.com>
To: gnats-bugs@gnats.netbsd.org
Subject: redundant struct device in disk device driver softc structs
X-Send-Pr-Version: 3.95
>Number: 1606
>Category: kern
>Synopsis: redundant struct device in disk device driver softc structs
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 17 14:22:01 +0000 1995
>Closed-Date: Wed Jan 10 17:08:04 +0000 1996
>Last-Modified: Tue Sep 04 23:30:46 +0000 2001
>Originator: Mike Long
>Release: 950930
>Organization:
>Environment:
System: NetBSD azathoth 1.0A NetBSD 1.0A (AZATHOTH) #7: Mon Oct 9 03:01:23 EDT 1995 root@azathoth:/usr/src/sys/arch/i386/compile/AZATHOTH i386
>Description:
Some disk device drivers have both a struct device and a
struct dkdevice in their softc structs. The device struct is
redundant because struct dkdevice contains one already.
>How-To-Repeat:
RTFS: /sys/sys/disk.h and /sys/scsi/[cs]d.c,
/sys/dev/isa/{mc,w}d.c, and /sys/arch/i386/isa/fd.c.
>Fix:
Apply the patch below. I have tested the changes to cd.c,
sd.c, wd.c, and fd.c. I can't test mcd.c because I don't have the
hardware. I only use the i386 port, so I didn't fix some drivers for
other ports because I wouldn't be able to test 'em anyway. The fix is
simple: remove sc_dev from the structure, and replace references to it
in the code with sc_dk.dk_dev . Be careful in drivers that have
multiple softc structs, like wd.c and fd.c :-).
*** /sys/scsi/cd.c.orig Wed Sep 27 03:06:52 1995
--- /sys/scsi/cd.c Sun Oct 8 00:31:49 1995
***************
*** 77,81 ****
struct cd_softc {
- struct device sc_dev;
struct dkdevice sc_dk;
--- 77,80 ----
***************
*** 165,169 ****
cd->sc_dk.dk_driver = &cddkdriver;
#if !defined(i386) || defined(NEWCONFIG)
! dk_establish(&cd->sc_dk, &cd->sc_dev);
#endif
--- 164,168 ----
cd->sc_dk.dk_driver = &cddkdriver;
#if !defined(i386) || defined(NEWCONFIG)
! dk_establish(&cd->sc_dk, &cd->sc_dk.dk_dev);
#endif
***************
*** 529,533 ****
CDRETRIES, 30000, bp, SCSI_NOSLEEP |
((bp->b_flags & B_READ) ? SCSI_DATA_IN : SCSI_DATA_OUT)))
! printf("%s: not queued", cd->sc_dev.dv_xname);
}
}
--- 528,532 ----
CDRETRIES, 30000, bp, SCSI_NOSLEEP |
((bp->b_flags & B_READ) ? SCSI_DATA_IN : SCSI_DATA_OUT)))
! printf("%s: not queued", cd->sc_dk.dk_dev.dv_xname);
}
}
*** /sys/scsi/sd.c.orig Wed Sep 27 03:06:54 1995
--- /sys/scsi/sd.c Sun Oct 8 00:30:05 1995
***************
*** 77,81 ****
struct sd_softc {
- struct device sc_dev;
struct dkdevice sc_dk;
--- 77,80 ----
***************
*** 170,174 ****
sd->sc_dk.dk_driver = &sddkdriver;
#if !defined(i386) || defined(NEWCONFIG)
! dk_establish(&sd->sc_dk, &sd->sc_dev);
#endif
--- 169,173 ----
sd->sc_dk.dk_driver = &sddkdriver;
#if !defined(i386) || defined(NEWCONFIG)
! dk_establish(&sd->sc_dk, &sd->sc_dk.dk_dev);
#endif
***************
*** 534,538 ****
SDRETRIES, 10000, bp, SCSI_NOSLEEP |
((bp->b_flags & B_READ) ? SCSI_DATA_IN : SCSI_DATA_OUT)))
! printf("%s: not queued", sd->sc_dev.dv_xname);
}
}
--- 533,537 ----
SDRETRIES, 10000, bp, SCSI_NOSLEEP |
((bp->b_flags & B_READ) ? SCSI_DATA_IN : SCSI_DATA_OUT)))
! printf("%s: not queued", sd->sc_dk.dk_dev.dv_xname);
}
}
***************
*** 681,687 ****
* Call the generic disklabel extraction routine
*/
! if (errstring = readdisklabel(MAKESDDEV(0, sd->sc_dev.dv_unit,
RAW_PART), sdstrategy, lp, &sd->sc_dk.dk_cpulabel)) {
! printf("%s: %s\n", sd->sc_dev.dv_xname, errstring);
return;
}
--- 680,686 ----
* Call the generic disklabel extraction routine
*/
! if (errstring = readdisklabel(MAKESDDEV(0, sd->sc_dk.dk_dev.dv_unit,
RAW_PART), sdstrategy, lp, &sd->sc_dk.dk_cpulabel)) {
! printf("%s: %s\n", sd->sc_dk.dk_dev.dv_xname, errstring);
return;
}
***************
*** 783,787 ****
sizeof(scsi_cmd), (u_char *)&scsi_sense, sizeof(scsi_sense),
SDRETRIES, 6000, NULL, flags | SCSI_DATA_IN) != 0) {
! printf("%s: could not mode sense (4)", sd->sc_dev.dv_xname);
fake_it:
printf("; using fictitious geometry\n");
--- 782,786 ----
sizeof(scsi_cmd), (u_char *)&scsi_sense, sizeof(scsi_sense),
SDRETRIES, 6000, NULL, flags | SCSI_DATA_IN) != 0) {
! printf("%s: could not mode sense (4)", sd->sc_dk.dk_dev.dv_xname);
fake_it:
printf("; using fictitious geometry\n");
***************
*** 819,823 ****
if (dp->heads == 0 || dp->cyls == 0) {
printf("%s: mode sense (4) returned nonsense",
! sd->sc_dev.dv_xname);
goto fake_it;
}
--- 818,822 ----
if (dp->heads == 0 || dp->cyls == 0) {
printf("%s: mode sense (4) returned nonsense",
! sd->sc_dk.dk_dev.dv_xname);
goto fake_it;
}
*** /sys/dev/isa/wd.c.orig Sun Aug 6 16:59:50 1995
--- /sys/dev/isa/wd.c Sat Oct 7 22:36:58 1995
***************
*** 77,81 ****
struct wd_softc {
- struct device sc_dev;
struct dkdevice sc_dk;
--- 77,80 ----
***************
*** 328,332 ****
}
! printf("%s: using", wd->sc_dev.dv_xname);
if (wd->sc_mode == WDM_DMA)
printf(" dma transfers,");
--- 327,331 ----
}
! printf("%s: using", wd->sc_dk.dk_dev.dv_xname);
if (wd->sc_mode == WDM_DMA)
printf(" dma transfers,");
***************
*** 387,391 ****
#if 0
else {
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
if ((wdc->sc_flags & (WDCF_ACTIVE|WDCF_ERROR)) == 0) {
printf("wdstrategy: controller inactive\n");
--- 386,390 ----
#if 0
else {
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
if ((wdc->sc_flags & (WDCF_ACTIVE|WDCF_ERROR)) == 0) {
printf("wdstrategy: controller inactive\n");
***************
*** 412,416 ****
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
int active = wdc->sc_drives.tqh_first != 0;
--- 411,415 ----
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
int active = wdc->sc_drives.tqh_first != 0;
***************
*** 433,437 ****
struct buf *bp;
{
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
wdc->sc_flags &= ~(WDCF_SINGLE | WDCF_ERROR);
--- 432,436 ----
struct buf *bp;
{
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
wdc->sc_flags &= ~(WDCF_SINGLE | WDCF_ERROR);
***************
*** 558,562 ****
#ifdef WDDEBUG
! printf("\n%s: wdcstart %s %d@%d; map ", wd->sc_dev.dv_xname,
(bp->b_flags & B_READ) ? "read" : "write", bp->b_bcount,
bp->b_blkno);
--- 557,562 ----
#ifdef WDDEBUG
! printf("\n%s: wdcstart %s %d@%d; map ",
! wd->sc_dk.dk_dev.dv_xname,
(bp->b_flags & B_READ) ? "read" : "write", bp->b_bcount,
bp->b_blkno);
***************
*** 1020,1024 ****
if (wd->sc_state > RECAL)
wd->sc_state = RECAL;
! errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART),
wdstrategy, lp, &wd->sc_dk.dk_cpulabel);
if (errstring) {
--- 1020,1024 ----
if (wd->sc_state > RECAL)
wd->sc_state = RECAL;
! errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dk.dk_dev.dv_unit, RAW_PART),
wdstrategy, lp, &wd->sc_dk.dk_cpulabel);
if (errstring) {
***************
*** 1031,1039 ****
if (wd->sc_state > GEOMETRY)
wd->sc_state = GEOMETRY;
! errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART),
wdstrategy, lp, &wd->sc_dk.dk_cpulabel);
}
if (errstring) {
! printf("%s: %s\n", wd->sc_dev.dv_xname, errstring);
return;
}
--- 1031,1039 ----
if (wd->sc_state > GEOMETRY)
wd->sc_state = GEOMETRY;
! errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dk.dk_dev.dv_unit, RAW_PART),
wdstrategy, lp, &wd->sc_dk.dk_cpulabel);
}
if (errstring) {
! printf("%s: %s\n", wd->sc_dk.dk_dev.dv_xname, errstring);
return;
}
***************
*** 1053,1057 ****
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
switch (wd->sc_state) {
--- 1053,1057 ----
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
switch (wd->sc_state) {
***************
*** 1134,1138 ****
int cylin, head, sector, count;
{
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
int iobase = wdc->sc_iobase;
int stat;
--- 1134,1138 ----
int cylin, head, sector, count;
{
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
int iobase = wdc->sc_iobase;
int stat;
***************
*** 1194,1201 ****
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
#ifdef WDDEBUG
! printf("wd(%d,%d) C%dH%dS%d\n", wd->sc_dev.dv_unit, wd->sc_drive,
wd->sc_dk.dk_label.d_ncylinders, wd->sc_dk.dk_label.d_ntracks,
wd->sc_dk.dk_label.d_nsectors);
--- 1194,1201 ----
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
#ifdef WDDEBUG
! printf("wd(%d,%d) C%dH%dS%d\n", wd->sc_dk.dk_dev.dv_unit, wd->sc_drive,
wd->sc_dk.dk_label.d_ncylinders, wd->sc_dk.dk_label.d_ntracks,
wd->sc_dk.dk_label.d_nsectors);
***************
*** 1219,1223 ****
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
int i;
char tb[DEV_BSIZE];
--- 1219,1223 ----
struct wd_softc *wd;
{
! struct wdc_softc *wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
int i;
char tb[DEV_BSIZE];
***************
*** 1464,1468 ****
return ENXIO;
! wdc = (void *)wd->sc_dev.dv_parent;
/* Convert to disk sectors. Request must be a multiple of size. */
--- 1464,1468 ----
return ENXIO;
! wdc = (void *)wd->sc_dk.dk_dev.dv_parent;
/* Convert to disk sectors. Request must be a multiple of size. */
***************
*** 1648,1652 ****
for (unit = 0; unit < wdcd.cd_ndevs; unit++) {
struct wd_softc *wd = wdcd.cd_devs[unit];
! if (!wd || (void *)wd->sc_dev.dv_parent != wdc)
continue;
if (wd->sc_state > RECAL)
--- 1648,1652 ----
for (unit = 0; unit < wdcd.cd_ndevs; unit++) {
struct wd_softc *wd = wdcd.cd_devs[unit];
! if (!wd || (void *)wd->sc_dk.dk_dev.dv_parent != wdc)
continue;
if (wd->sc_state > RECAL)
*** /sys/dev/isa/mcd.c.orig Sun Aug 6 16:59:49 1995
--- /sys/dev/isa/mcd.c Sun Oct 8 00:01:41 1995
***************
*** 82,86 ****
#define MCD_TRACE(fmt,a,b,c,d)
#else
! #define MCD_TRACE(fmt,a,b,c,d) {if (sc->debug) {printf("%s: st=%02x: ", sc->sc_dev.dv_xname, sc->status); printf(fmt,a,b,c,d);}}
#endif
--- 82,86 ----
#define MCD_TRACE(fmt,a,b,c,d)
#else
! #define MCD_TRACE(fmt,a,b,c,d) {if (sc->debug) {printf("%s: st=%02x: ", sc->sc_dk.dk_dev.dv_xname, sc->status); printf(fmt,a,b,c,d);}}
#endif
***************
*** 107,111 ****
struct mcd_softc {
- struct device sc_dev;
struct dkdevice sc_dk;
void *sc_ih;
--- 107,110 ----
***************
*** 419,423 ****
(bp->b_bcount % sc->blksize) != 0) {
printf("%s: strategy: blkno = %d bcount = %d\n",
! sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount);
bp->b_error = EINVAL;
goto bad;
--- 418,422 ----
(bp->b_bcount % sc->blksize) != 0) {
printf("%s: strategy: blkno = %d bcount = %d\n",
! sc->sc_dk.dk_dev.dv_xname, bp->b_blkno, bp->b_bcount);
bp->b_error = EINVAL;
goto bad;
***************
*** 785,789 ****
default:
printf("%s: unrecognized drive version %c%02x; will try to use it anyway\n",
! sc->sc_dev.dv_xname,
mbx.res.data.continfo.code, mbx.res.data.continfo.version);
sc->type = 0;
--- 784,788 ----
default:
printf("%s: unrecognized drive version %c%02x; will try to use it anyway\n",
! sc->sc_dk.dk_dev.dv_xname,
mbx.res.data.continfo.code, mbx.res.data.continfo.version);
sc->type = 0;
***************
*** 836,840 ****
if (sc->debug)
! printf("%s: mcd_getresult: %d", sc->sc_dev.dv_xname,
res->length);
--- 835,839 ----
if (sc->debug)
! printf("%s: mcd_getresult: %d", sc->sc_dk.dk_dev.dv_xname,
res->length);
***************
*** 843,847 ****
printf(" timeout\n");
else
! printf("%s: timeout in getresult\n", sc->sc_dev.dv_xname);
return EIO;
}
--- 842,847 ----
printf(" timeout\n");
else
! printf("%s: timeout in getresult\n",
! sc->sc_dk.dk_dev.dv_xname);
return EIO;
}
***************
*** 859,863 ****
printf(" timeout\n");
else
! printf("%s: timeout in getresult\n", sc->sc_dev.dv_xname);
return EIO;
}
--- 859,864 ----
printf(" timeout\n");
else
! printf("%s: timeout in getresult\n",
! sc->sc_dk.dk_dev.dv_xname);
return EIO;
}
***************
*** 875,879 ****
x = inb(sc->iobase + MCD_STATUS);
printf("%s: got extra byte %02x during getstatus\n",
! sc->sc_dev.dv_xname, (u_int)x);
delay(10);
}
--- 876,880 ----
x = inb(sc->iobase + MCD_STATUS);
printf("%s: got extra byte %02x during getstatus\n",
! sc->sc_dk.dk_dev.dv_xname, (u_int)x);
delay(10);
}
***************
*** 893,901 ****
MCD_ST_DSKIN) {
if ((sc->status & MCD_ST_DOOROPEN) != 0)
! printf("%s: door open\n", sc->sc_dev.dv_xname);
else if ((sc->status & MCD_ST_DSKIN) == 0)
! printf("%s: no disk present\n", sc->sc_dev.dv_xname);
else if ((sc->status & MCD_ST_DSKCHNG) != 0)
! printf("%s: media change\n", sc->sc_dev.dv_xname);
sc->flags &= ~MCDF_LOADED;
}
--- 894,904 ----
MCD_ST_DSKIN) {
if ((sc->status & MCD_ST_DOOROPEN) != 0)
! printf("%s: door open\n", sc->sc_dk.dk_dev.dv_xname);
else if ((sc->status & MCD_ST_DSKIN) == 0)
! printf("%s: no disk present\n",
! sc->sc_dk.dk_dev.dv_xname);
else if ((sc->status & MCD_ST_DSKCHNG) != 0)
! printf("%s: media change\n",
! sc->sc_dk.dk_dev.dv_xname);
sc->flags &= ~MCDF_LOADED;
}
***************
*** 918,922 ****
if (sc->debug) {
! printf("%s: mcd_send: %d %02x", sc->sc_dev.dv_xname,
mbx->cmd.length, (u_int)mbx->cmd.opcode);
for (i = 0; i < mbx->cmd.length; i++)
--- 921,925 ----
if (sc->debug) {
! printf("%s: mcd_send: %d %02x", sc->sc_dk.dk_dev.dv_xname,
mbx->cmd.length, (u_int)mbx->cmd.opcode);
for (i = 0; i < mbx->cmd.length; i++)
***************
*** 1091,1095 ****
#if 0
printf("%s: got status byte %02x during read\n",
! sc->sc_dev.dv_xname, (u_int)sc->status);
#endif
goto loop;
--- 1094,1098 ----
#if 0
printf("%s: got status byte %02x during read\n",
! sc->sc_dk.dk_dev.dv_xname, (u_int)sc->status);
#endif
goto loop;
***************
*** 1120,1129 ****
if (mbx->count-- < 0) {
printf("%s: timeout in state %d",
! sc->sc_dev.dv_xname, mbx->state);
goto readerr;
}
#if 0
! printf("%s: sleep in state %d\n", sc->sc_dev.dv_xname,
mbx->state);
#endif
--- 1123,1132 ----
if (mbx->count-- < 0) {
printf("%s: timeout in state %d",
! sc->sc_dk.dk_dev.dv_xname, mbx->state);
goto readerr;
}
#if 0
! printf("%s: sleep in state %d\n", sc->sc_dk.dk_dev.dv_xname,
mbx->state);
#endif
***************
*** 1150,1154 ****
#ifdef notyet
! printf("%s: unit timeout; resetting\n", sc->sc_dev.dv_xname);
outb(mbx->iobase + MCD_RESET, MCD_CMDRESET);
delay(300000);
--- 1153,1157 ----
#ifdef notyet
! printf("%s: unit timeout; resetting\n", sc->sc_dk.dk_dev.dv_xname);
outb(mbx->iobase + MCD_RESET, MCD_CMDRESET);
delay(300000);
***************
*** 1198,1202 ****
return 0;
if (sc->debug)
! printf("%s: setting mode to %d\n", sc->sc_dev.dv_xname, mode);
sc->lastmode = MCD_MD_UNKNOWN;
--- 1201,1206 ----
return 0;
if (sc->debug)
! printf("%s: setting mode to %d\n",
! sc->sc_dk.dk_dev.dv_xname, mode);
sc->lastmode = MCD_MD_UNKNOWN;
***************
*** 1223,1227 ****
return 0;
if (sc->debug)
! printf("%s: setting upc to %d\n", sc->sc_dev.dv_xname, upc);
sc->lastupc = MCD_UPC_UNKNOWN;
--- 1227,1232 ----
return 0;
if (sc->debug)
! printf("%s: setting upc to %d\n",
! sc->sc_dk.dk_dev.dv_xname, upc);
sc->lastupc = MCD_UPC_UNKNOWN;
***************
*** 1246,1250 ****
if (sc->debug)
printf("%s: mcd_toc_header: reading toc header\n",
! sc->sc_dev.dv_xname);
th->len = msf2hsg(sc->volinfo.vol_msf, 0);
--- 1251,1255 ----
if (sc->debug)
printf("%s: mcd_toc_header: reading toc header\n",
! sc->sc_dk.dk_dev.dv_xname);
th->len = msf2hsg(sc->volinfo.vol_msf, 0);
***************
*** 1271,1275 ****
if (sc->debug)
printf("%s: read_toc: reading qchannel info\n",
! sc->sc_dev.dv_xname);
for (trk = th.starting_track; trk <= th.ending_track; trk++)
--- 1276,1280 ----
if (sc->debug)
printf("%s: read_toc: reading qchannel info\n",
! sc->sc_dk.dk_dev.dv_xname);
for (trk = th.starting_track; trk <= th.ending_track; trk++)
***************
*** 1383,1387 ****
if (sc->debug)
! printf("%s: mcd_stop: stopping play\n", sc->sc_dev.dv_xname);
mbx.cmd.opcode = MCD_CMDSTOPAUDIO;
--- 1388,1393 ----
if (sc->debug)
! printf("%s: mcd_stop: stopping play\n",
! sc->sc_dk.dk_dev.dv_xname);
mbx.cmd.opcode = MCD_CMDSTOPAUDIO;
***************
*** 1441,1445 ****
if (sc->debug)
! printf("%s: subchan: af=%d df=%d\n", sc->sc_dev.dv_xname,
ch->address_format, ch->data_format);
--- 1447,1451 ----
if (sc->debug)
! printf("%s: subchan: af=%d df=%d\n", sc->sc_dk.dk_dev.dv_xname,
ch->address_format, ch->data_format);
***************
*** 1520,1524 ****
if (sc->debug)
printf("%s: playtracks: from %d:%d to %d:%d\n",
! sc->sc_dev.dv_xname,
a, p->start_index, z, p->end_index);
--- 1526,1530 ----
if (sc->debug)
printf("%s: playtracks: from %d:%d to %d:%d\n",
! sc->sc_dk.dk_dev.dv_xname,
a, p->start_index, z, p->end_index);
***************
*** 1556,1560 ****
if (sc->debug)
printf("%s: playmsf: from %d:%d.%d to %d:%d.%d\n",
! sc->sc_dev.dv_xname,
p->start_m, p->start_s, p->start_f,
p->end_m, p->end_s, p->end_f);
--- 1562,1566 ----
if (sc->debug)
printf("%s: playmsf: from %d:%d.%d to %d:%d.%d\n",
! sc->sc_dk.dk_dev.dv_xname,
p->start_m, p->start_s, p->start_f,
p->end_m, p->end_s, p->end_f);
***************
*** 1590,1594 ****
if (sc->debug)
printf("%s: playblocks: blkno %d length %d\n",
! sc->sc_dev.dv_xname, p->blk, p->len);
if (p->blk > sc->disksize || p->len > sc->disksize ||
--- 1596,1600 ----
if (sc->debug)
printf("%s: playblocks: blkno %d length %d\n",
! sc->sc_dk.dk_dev.dv_xname, p->blk, p->len);
if (p->blk > sc->disksize || p->len > sc->disksize ||
***************
*** 1618,1622 ****
if (sc->audio_status != CD_AS_PLAY_IN_PROGRESS) {
printf("%s: pause: attempted when not playing\n",
! sc->sc_dev.dv_xname);
return EINVAL;
}
--- 1624,1628 ----
if (sc->audio_status != CD_AS_PLAY_IN_PROGRESS) {
printf("%s: pause: attempted when not playing\n",
! sc->sc_dk.dk_dev.dv_xname);
return EINVAL;
}
*** /sys/arch/i386/isa/fd.c.orig Mon Aug 21 02:57:59 1995
--- /sys/arch/i386/isa/fd.c Sun Oct 8 00:35:41 1995
***************
*** 149,153 ****
/* software state, per disk (with up to 4 disks per ctlr) */
struct fd_softc {
- struct device sc_dev;
struct dkdevice sc_dk;
--- 149,152 ----
***************
*** 407,411 ****
#ifdef NEWCONFIG
/* XXX Need to do some more fiddling with sc_dk. */
! dk_establish(&fd->sc_dk, &fd->sc_dev);
#endif
}
--- 406,410 ----
#ifdef NEWCONFIG
/* XXX Need to do some more fiddling with sc_dk. */
! dk_establish(&fd->sc_dk, &fd->sc_dk.dk_dev);
#endif
}
***************
*** 511,515 ****
#ifdef DIAGNOSTIC
else {
! struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
if (fdc->sc_state == DEVIDLE) {
printf("fdstrategy: controller inactive\n");
--- 510,514 ----
#ifdef DIAGNOSTIC
else {
! struct fdc_softc *fdc = (void *)fd->sc_dk.dk_dev.dv_parent;
if (fdc->sc_state == DEVIDLE) {
printf("fdstrategy: controller inactive\n");
***************
*** 532,536 ****
struct fd_softc *fd;
{
! struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
int active = fdc->sc_drives.tqh_first != 0;
--- 531,535 ----
struct fd_softc *fd;
{
! struct fdc_softc *fdc = (void *)fd->sc_dk.dk_dev.dv_parent;
int active = fdc->sc_drives.tqh_first != 0;
***************
*** 549,553 ****
struct buf *bp;
{
! struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
/*
--- 548,552 ----
struct buf *bp;
{
! struct fdc_softc *fdc = (void *)fd->sc_dk.dk_dev.dv_parent;
/*
***************
*** 622,626 ****
s = splbio();
fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
! fd_set_motor((struct fdc_softc *)fd->sc_dev.dv_parent, 0);
splx(s);
}
--- 621,625 ----
s = splbio();
fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
! fd_set_motor((struct fdc_softc *)fd->sc_dk.dk_dev.dv_parent, 0);
splx(s);
}
***************
*** 631,635 ****
{
struct fd_softc *fd = arg;
! struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
int s;
--- 630,634 ----
{
struct fd_softc *fd = arg;
! struct fdc_softc *fdc = (void *)fd->sc_dk.dk_dev.dv_parent;
int s;
***************
*** 790,794 ****
s = splbio();
! fdcstatus(&fd->sc_dev, 0, "timeout");
if (fd->sc_q.b_actf)
--- 789,793 ----
s = splbio();
! fdcstatus(&fd->sc_dk.dk_dev, 0, "timeout");
if (fd->sc_q.b_actf)
***************
*** 955,959 ****
cyl != bp->b_cylin * fd->sc_type->step) {
#ifdef FD_DEBUG
! fdcstatus(&fd->sc_dev, 2, "seek failed");
#endif
fdcretry(fdc);
--- 954,958 ----
cyl != bp->b_cylin * fd->sc_type->step) {
#ifdef FD_DEBUG
! fdcstatus(&fd->sc_dk.dk_dev, 2, "seek failed");
#endif
fdcretry(fdc);
***************
*** 984,988 ****
#endif
#ifdef FD_DEBUG
! fdcstatus(&fd->sc_dev, 7, bp->b_flags & B_READ ?
"read failed" : "write failed");
printf("blkno %d nblks %d\n",
--- 983,987 ----
#endif
#ifdef FD_DEBUG
! fdcstatus(&fd->sc_dk.dk_dev, 7, bp->b_flags & B_READ ?
"read failed" : "write failed");
printf("blkno %d nblks %d\n",
***************
*** 1051,1055 ****
if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) {
#ifdef FD_DEBUG
! fdcstatus(&fd->sc_dev, 2, "recalibrate failed");
#endif
fdcretry(fdc);
--- 1050,1054 ----
if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) {
#ifdef FD_DEBUG
! fdcstatus(&fd->sc_dk.dk_dev, 2, "recalibrate failed");
#endif
fdcretry(fdc);
***************
*** 1065,1069 ****
default:
! fdcstatus(&fd->sc_dev, 0, "stray interrupt");
return 1;
}
--- 1064,1068 ----
default:
! fdcstatus(&fd->sc_dk.dk_dev, 0, "stray interrupt");
return 1;
}
>Release-Note:
>Audit-Trail:
From: Jason Thorpe <thorpej@nas.nasa.gov>
To: Mike Long <mike.long@analog.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/1606: redundant struct device in disk device driver softc structs
Date: Tue, 17 Oct 1995 19:07:47 -0700
On Mon, 9 Oct 1995 22:36:42 -0400
Mike Long <mike.long@analog.com> wrote:
> *** /sys/scsi/cd.c.orig Wed Sep 27 03:06:52 1995
> --- /sys/scsi/cd.c Sun Oct 8 00:31:49 1995
> ***************
> *** 77,81 ****
>
> struct cd_softc {
> - struct device sc_dev;
> struct dkdevice sc_dk;
Actually, probably the better solution is to remove the "struct device"
from "struct dkdevice" ... The patch is smaller, and it maintains
consistency with the other drivers in the tree... (which have a struct
device first in their softc's...)
--------------------------------------------------------------------------
Jason R. Thorpe thorpej@nas.nasa.gov
NASA Ames Research Center Home: 408.866.1912
NAS: M/S 258-6 Work: 415.604.0935
Moffett Field, CA 94035 Pager: 415.428.6939
State-Changed-From-To: open->closed
State-Changed-By: pk
State-Changed-When: Wed Jan 10 12:08:04 EST 1996
State-Changed-Why:
This should be fixed by Jason's disk statistics code that went into the
tree around 01/07/96.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.