On Fri, Aug 20, 2010 at 09:53:15AM -0700, Matthew Dempsky wrote:
> The diff below gets rid of the useless "struct dkdriver" field and its
> many "notyet" fields.
>
> I sent this diff out shortly before the release and got one or two
> oks, but didn't want to conflict with some of the changes jsing@'s
> working on. He says those changes will take a bit longer still and
> should be easy to merge with this anyway, so I thought I'd send this
> out for another round of review.
>
> I've compile tested this on amd64. If anyone could easily double
> check that it still compiles on sparc and sparc64, that would be
> great. (It also affects zaurus/gumstix, but just for dev/flash.c.)
>
> ok?
I can test compile Sparc and Sparc64 tonight. Looks good to me on
inspection.
.... Ken
>
>
> Index: ./sys/disk.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/disk.h,v
> retrieving revision 1.21
> diff -u -p -r1.21 disk.h
> --- ./sys/disk.h 3 May 2010 15:27:28 -0000 1.21
> +++ ./sys/disk.h 20 Aug 2010 16:38:35 -0000
> @@ -100,8 +100,6 @@ struct disk {
> int dk_blkshift; /* shift to convert DEV_BSIZE to blks*/
> int dk_byteshift; /* shift to convert bytes to blks */
>
> - struct dkdriver *dk_driver; /* pointer to driver */
> -
> /*
> * Disk label information. Storage for the in-core disk label
> * must be dynamically allocated, otherwise the size of this
> @@ -109,19 +107,6 @@ struct disk {
> */
> daddr64_t dk_labelsector; /* sector containing label */
> struct disklabel *dk_label; /* label */
> -};
> -
> -struct dkdriver {
> - void (*d_strategy)(struct buf *);
> -#ifdef notyet
> - int (*d_open)(dev_t dev, int ifmt, int, struct proc *);
> - int (*d_close)(dev_t dev, int, int ifmt, struct proc *);
> - int (*d_ioctl)(dev_t dev, u_long cmd, caddr_t data, int fflag,
> - struct proc *);
> - int (*d_dump)(dev_t);
> - void (*d_start)(struct buf *, daddr64_t);
> - int (*d_mklabel)(struct disk *);
> -#endif
> };
>
> /* states */
> Index: ./arch/sparc/dev/fd.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc/dev/fd.c,v
> retrieving revision 1.73
> diff -u -p -r1.73 fd.c
> --- ./arch/sparc/dev/fd.c 17 Aug 2010 20:05:06 -0000 1.73
> +++ ./arch/sparc/dev/fd.c 20 Aug 2010 16:38:35 -0000
> @@ -244,8 +244,6 @@ void fdstrategy(struct buf *);
> void fdstart(struct fd_softc *);
> int fdprint(void *, const char *);
>
> -struct dkdriver fddkdriver = { fdstrategy };
> -
> struct fd_type *fd_nvtotype(char *, int, int);
> void fd_set_motor(struct fdc_softc *fdc);
> void fd_motor_off(void *arg);
> @@ -644,7 +642,6 @@ fdattach(parent, self, aux)
> * Initialize and attach the disk structure.
> */
> fd->sc_dk.dk_name = fd->sc_dv.dv_xname;
> - fd->sc_dk.dk_driver = &fddkdriver;
> disk_attach(&fd->sc_dk);
>
> /*
> Index: ./arch/sparc/dev/presto.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc/dev/presto.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 presto.c
> --- ./arch/sparc/dev/presto.c 23 Apr 2010 15:25:21 -0000 1.16
> +++ ./arch/sparc/dev/presto.c 20 Aug 2010 16:38:35 -0000
> @@ -82,10 +82,6 @@ struct cfdriver presto_cd = {
> NULL, "presto", DV_DULL
> };
>
> -struct dkdriver presto_dk = {
> - prestostrategy,
> -};
> -
> int
> presto_match(struct device *parent, void *vcf, void *aux)
> {
> @@ -164,7 +160,6 @@ presto_attach(struct device *parent, str
> *(u_int8_t *)(sc->sc_mem + 0x0b), *(u_int8_t *)(sc->sc_mem + 0x0f));
> #endif
>
> - sc->sc_dk.dk_driver = &presto_dk;
> sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
> disk_attach(&sc->sc_dk);
> }
> Index: ./arch/sparc/dev/xd.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc/dev/xd.c,v
> retrieving revision 1.48
> diff -u -p -r1.48 xd.c
> --- ./arch/sparc/dev/xd.c 23 May 2010 10:49:19 -0000 1.48
> +++ ./arch/sparc/dev/xd.c 20 Aug 2010 16:38:35 -0000
> @@ -269,12 +269,6 @@ struct xdc_attach_args { /* this is the
> };
>
> /*
> - * dkdriver
> - */
> -
> -struct dkdriver xddkdriver = {xdstrategy};
> -
> -/*
> * start: disk label fix code (XXX)
> */
>
> @@ -562,7 +556,6 @@ xdattach(parent, self, aux)
> * to start with a clean slate.
> */
> bzero(&xd->sc_dk, sizeof(xd->sc_dk));
> - xd->sc_dk.dk_driver = &xddkdriver;
> xd->sc_dk.dk_name = xd->sc_dev.dv_xname;
>
> /* if booting, init the xd_softc */
> Index: ./arch/sparc/dev/xy.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc/dev/xy.c,v
> retrieving revision 1.45
> diff -u -p -r1.45 xy.c
> --- ./arch/sparc/dev/xy.c 23 May 2010 10:49:19 -0000 1.45
> +++ ./arch/sparc/dev/xy.c 20 Aug 2010 16:38:36 -0000
> @@ -209,12 +209,6 @@ struct xyc_attach_args { /* this is the
> };
>
> /*
> - * dkdriver
> - */
> -
> -struct dkdriver xydkdriver = { xystrategy };
> -
> -/*
> * start: disk label fix code (XXX)
> */
>
> @@ -504,7 +498,6 @@ xyattach(parent, self, aux)
> * to start with a clean slate.
> */
> bzero(&xy->sc_dk, sizeof(xy->sc_dk));
> - xy->sc_dk.dk_driver = &xydkdriver;
> xy->sc_dk.dk_name = xy->sc_dev.dv_xname;
>
> /* if booting, init the xy_softc */
> Index: ./arch/sparc64/dev/fd.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc64/dev/fd.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 fd.c
> --- ./arch/sparc64/dev/fd.c 19 May 2010 04:10:34 -0000 1.31
> +++ ./arch/sparc64/dev/fd.c 20 Aug 2010 16:38:36 -0000
> @@ -290,8 +290,6 @@ void fdstrategy(struct buf *);
> void fdstart(struct fd_softc *);
> int fdprint(void *, const char *);
>
> -struct dkdriver fddkdriver = { fdstrategy };
> -
> struct fd_type *fd_nvtotype(char *, int, int);
> void fd_set_motor(struct fdc_softc *fdc);
> void fd_motor_off(void *arg);
> @@ -670,7 +668,6 @@ fdattach(parent, self, aux)
> * Initialize and attach the disk structure.
> */
> fd->sc_dk.dk_name = fd->sc_dv.dv_xname;
> - fd->sc_dk.dk_driver = &fddkdriver;
> disk_attach(&fd->sc_dk);
>
> /* Make sure the drive motor gets turned off at shutdown time. */
> Index: ./dev/ata/wd.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ata/wd.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 wd.c
> --- ./dev/ata/wd.c 23 Jul 2010 07:47:13 -0000 1.88
> +++ ./dev/ata/wd.c 20 Aug 2010 16:38:36 -0000
> @@ -177,8 +177,6 @@ void wd_flushcache(struct wd_softc *, i
> void wd_standby(struct wd_softc *, int);
> void wd_shutdown(void *);
>
> -struct dkdriver wddkdriver = { wdstrategy };
> -
> /* XXX: these should go elsewhere */
> cdev_decl(wd);
> bdev_decl(wd);
> @@ -362,7 +360,6 @@ wdattach(struct device *parent, struct d
> /*
> * Initialize disk structures.
> */
> - wd->sc_dk.dk_driver = &wddkdriver;
> wd->sc_dk.dk_name = wd->sc_dev.dv_xname;
> wd->sc_bufq = bufq_init(BUFQ_DEFAULT);
> wd->sc_sdhook = shutdownhook_establish(wd_shutdown, wd);
> Index: ./dev/flash.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/flash.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 flash.c
> --- ./dev/flash.c 23 Apr 2010 15:25:21 -0000 1.15
> +++ ./dev/flash.c 20 Aug 2010 16:38:37 -0000
> @@ -95,8 +95,6 @@ struct cfdriver flash_cd = {
> NULL, "flash", DV_DISK
> };
>
> -struct dkdriver flashdkdriver = { flashstrategy };
> -
> void
> flashattach(struct flash_softc *sc, struct flash_ctl_tag *tag,
> void *cookie)
> @@ -158,7 +156,6 @@ flashattach(struct flash_softc *sc, stru
> /*
> * Initialize and attach the disk structure.
> */
> - sc->sc_dk.dk_driver = &flashdkdriver;
> sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
> disk_attach(&sc->sc_dk);
>
> Index: ./dev/ramdisk.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ramdisk.c,v
> retrieving revision 1.46
> diff -u -p -r1.46 ramdisk.c
> --- ./dev/ramdisk.c 23 Apr 2010 15:25:21 -0000 1.46
> +++ ./dev/ramdisk.c 20 Aug 2010 16:38:37 -0000
> @@ -126,7 +126,6 @@ struct cfattach rd_ca = {
> };
>
> void rdstrategy(struct buf *bp);
> -struct dkdriver rddkdriver = { rdstrategy };
>
> int ramdisk_ndevs;
> void *ramdisk_devs[RD_MAX_UNITS];
> @@ -205,7 +204,6 @@ rd_attach(struct device *parent, struct
> /*
> * Initialize and attach the disk structure.
> */
> - sc->sc_dk.dk_driver = &rddkdriver;
> sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
> disk_attach(&sc->sc_dk);
> }
> Index: ./dev/vnd.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/vnd.c,v
> retrieving revision 1.100
> diff -u -p -r1.100 vnd.c
> --- ./dev/vnd.c 22 Jul 2010 14:34:06 -0000 1.100
> +++ ./dev/vnd.c 20 Aug 2010 16:38:37 -0000
> @@ -153,8 +153,6 @@ struct vnd_softc {
> struct vnd_softc *vnd_softc;
> int numvnd = 0;
>
> -struct dkdriver vnddkdriver = { vndstrategy };
> -
> /* called by main() at boot time */
> void vndattach(int);
>
> @@ -867,7 +865,6 @@ vndioctl(dev_t dev, u_long cmd, caddr_t
> vnd->sc_vp, (unsigned long long)vnd->sc_size);
>
> /* Attach the disk. */
> - vnd->sc_dk.dk_driver = &vnddkdriver;
> vnd->sc_dk.dk_name = vnd->sc_dev.dv_xname;
> disk_attach(&vnd->sc_dk);
>
> Index: ./dev/isa/fd.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/isa/fd.c,v
> retrieving revision 1.85
> diff -u -p -r1.85 fd.c
> --- ./dev/isa/fd.c 18 May 2010 04:41:14 -0000 1.85
> +++ ./dev/isa/fd.c 20 Aug 2010 16:38:37 -0000
> @@ -146,8 +146,6 @@ void fdstrategy(struct buf *);
> void fdstart(struct fd_softc *);
> int fdintr(struct fdc_softc *);
>
> -struct dkdriver fddkdriver = { fdstrategy };
> -
> void fd_set_motor(struct fdc_softc *fdc, int reset);
> void fd_motor_off(void *arg);
> void fd_motor_on(void *arg);
> @@ -306,7 +304,6 @@ fdattach(parent, self, aux)
> * Initialize and attach the disk structure.
> */
> fd->sc_dk.dk_name = fd->sc_dev.dv_xname;
> - fd->sc_dk.dk_driver = &fddkdriver;
> disk_attach(&fd->sc_dk);
>
> /* Needed to power off if the motor is on when we halt. */
> Index: ./dev/isa/mcd.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/isa/mcd.c,v
> retrieving revision 1.53
> diff -u -p -r1.53 mcd.c
> --- ./dev/isa/mcd.c 23 Apr 2010 15:25:21 -0000 1.53
> +++ ./dev/isa/mcd.c 20 Aug 2010 16:38:37 -0000
> @@ -226,8 +226,6 @@ int mcdlock(struct mcd_softc *);
> void mcdunlock(struct mcd_softc *);
> void mcd_pseudointr(void *);
>
> -struct dkdriver mcddkdriver = { mcdstrategy };
> -
> #define MCD_RETRIES 3
> #define MCD_RDRETRIES 3
>
> @@ -271,7 +269,6 @@ mcdattach(parent, self, aux)
> /*
> * Initialize and attach the disk structure.
> */
> - sc->sc_dk.dk_driver = &mcddkdriver;
> sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
> disk_attach(&sc->sc_dk);
>
> Index: ./scsi/cd.c
> ===================================================================
> RCS file: /cvs/src/sys/scsi/cd.c,v
> retrieving revision 1.181
> diff -u -p -r1.181 cd.c
> --- ./scsi/cd.c 28 Jul 2010 23:47:43 -0000 1.181
> +++ ./scsi/cd.c 20 Aug 2010 16:38:37 -0000
> @@ -161,8 +161,6 @@ struct cfdriver cd_cd = {
> NULL, "cd", DV_DISK
> };
>
> -struct dkdriver cddkdriver = { cdstrategy };
> -
> const struct scsi_inquiry_pattern cd_patterns[] = {
> {T_CDROM, T_REMOV,
> "", "", ""},
> @@ -217,7 +215,6 @@ cdattach(struct device *parent, struct d
> /*
> * Initialize disk structures.
> */
> - sc->sc_dk.dk_driver = &cddkdriver;
> sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
> sc->sc_bufq = bufq_init(BUFQ_DEFAULT);
>
> Index: ./scsi/sd.c
> ===================================================================
> RCS file: /cvs/src/sys/scsi/sd.c,v
> retrieving revision 1.205
> diff -u -p -r1.205 sd.c
> --- ./scsi/sd.c 3 Aug 2010 19:37:17 -0000 1.205
> +++ ./scsi/sd.c 20 Aug 2010 16:38:37 -0000
> @@ -111,8 +111,6 @@ struct cfdriver sd_cd = {
> NULL, "sd", DV_DISK
> };
>
> -struct dkdriver sddkdriver = { sdstrategy };
> -
> const struct scsi_inquiry_pattern sd_patterns[] = {
> {T_DIRECT, T_FIXED,
> "", "", ""},
> @@ -173,7 +171,6 @@ sdattach(struct device *parent, struct d
> /*
> * Initialize disk structures.
> */
> - sc->sc_dk.dk_driver = &sddkdriver;
> sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
> sc->sc_bufq = bufq_init(BUFQ_DEFAULT);