diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 2f1338afd7fd..77bc4491ceb7 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1007,7 +1007,7 @@ dacleanup(struct cam_periph *periph) xpt_print_path(periph->path); printf("removing device entry\n"); if (softc->dev) { - disk_destroy(softc->dev); + disk_destroy(&softc->disk); } free(softc, M_DEVBUF); } diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 668778dc16b9..664cc72a17ff 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -411,7 +411,7 @@ aac_disk_detach(device_t dev) return(EBUSY); devstat_remove_entry(&sc->ad_stats); - disk_destroy(sc->ad_dev_t); + disk_destroy(&sc->ad_disk); #ifdef FREEBSD_4 if (--disks_registered == 0) cdevsw_remove(&aac_disk_cdevsw); diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index 1aa1fc68536d..af489b5fb075 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -300,7 +300,7 @@ amrd_detach(device_t dev) if (--disks_registered == 0) cdevsw_remove(&amrddisk_cdevsw); #else - disk_destroy(sc->amrd_dev_t); + disk_destroy(&sc->amrd_disk); #endif return(0); } diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 450011a34bbd..6478171308d3 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -255,7 +255,7 @@ ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */ bioq_remove(&adp->queue, bp); biofinish(bp, NULL, ENXIO); } - disk_destroy(adp->dev); + disk_destroy(&adp->disk); devstat_remove_entry(&adp->stats); if (flush) { if (ata_command(atadev, ATA_C_FLUSHCACHE, 0, 0, 0, ATA_WAIT_READY)) diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index 909f20fe30ec..9e6b22107bd3 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -410,7 +410,7 @@ ata_raid_delete(int array) ar_promise_write_conf(rdp); else ar_highpoint_write_conf(rdp); - disk_destroy(rdp->dev); + disk_destroy(&rdp->disk); free(rdp, M_AR); ar_table[array] = NULL; return 0; diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index b0b0f7610e5a..46118a96e41e 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -125,7 +125,7 @@ afddetach(struct ata_device *atadev) bioq_remove(&fdp->queue, bp); biofinish(bp, NULL, ENXIO); } - disk_destroy(fdp->dev); + disk_destroy(&fdp->disk); devstat_remove_entry(&fdp->stats); ata_free_name(atadev); ata_free_lun(&afd_lun_map, fdp->lun); diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index d947708b6021..5fb49c584592 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -1160,7 +1160,7 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) return (EBUSY); } - disk_destroy(cs->sc_dev); + disk_destroy(cs->sc_disk); free(cs->sc_disk, M_CCD); cs->sc_disk = NULL; /* Declare unit null and void (reset all flags) */ diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index a5ff92d6d07f..6af106fb34d8 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -275,7 +275,7 @@ mlxd_detach(device_t dev) debug_called(1); devstat_remove_entry(&sc->mlxd_stats); - disk_destroy(sc->mlxd_dev_t); + disk_destroy(&sc->mlxd_disk); return(0); } diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index e2b2508349d4..badcd390d3d8 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -635,7 +635,7 @@ raidctlioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) devstat_remove_entry(&sc->device_stats); - disk_destroy(parent_sc->sc_raiddevs[unit]); + disk_destroy(&sc->sc_dkdev); raidunlock(sc); /* XXX Need to be able to destroy the zone */ diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index d536d28415f1..95ca2a7c53e3 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -797,7 +797,7 @@ twed_detach(device_t dev) if (--disks_registered == 0) cdevsw_remove(&tweddisk_cdevsw); #else - disk_destroy(sc->twed_dev_t); + disk_destroy(&sc->twed_disk); #endif return(0); diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index d947708b6021..5fb49c584592 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1160,7 +1160,7 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) return (EBUSY); } - disk_destroy(cs->sc_dev); + disk_destroy(cs->sc_disk); free(cs->sc_disk, M_CCD); cs->sc_disk = NULL; /* Declare unit null and void (reset all flags) */ diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 1f7e8b0c69c7..7cf3c48b131d 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -364,14 +364,12 @@ disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, void * } void -disk_destroy(dev_t dev) +disk_destroy(struct disk *dp) { - struct disk *dp; struct g_geom *gp; - dp = dev->si_disk; gp = dp->d_geom; - g_free(dev); + g_free(dp->d_dev); gp->flags |= G_GEOM_WITHER; gp->softc = NULL; g_orphan_provider(LIST_FIRST(&gp->provider), ENXIO); diff --git a/sys/sys/disk.h b/sys/sys/disk.h index c9b1b854b7cb..fc098f53670a 100644 --- a/sys/sys/disk.h +++ b/sys/sys/disk.h @@ -71,7 +71,7 @@ struct disk { #define DISKFLAG_CANDELETE 0x4 dev_t disk_create(int unit, struct disk *disk, int flags, struct cdevsw *cdevsw, void *unused); -void disk_destroy(dev_t dev); +void disk_destroy(struct disk *disk); struct disk *disk_enumerate(struct disk *disk); void disk_err(struct bio *bp, const char *what, int blkdone, int nl);