1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

NO_GEOM cleanup:

Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.
This commit is contained in:
Poul-Henning Kamp 2003-02-21 15:13:26 +00:00
parent e859833529
commit b82ff75854
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111216
13 changed files with 14 additions and 16 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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))

View File

@ -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;

View File

@ -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);

View File

@ -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) */

View File

@ -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);
}

View File

@ -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 */

View File

@ -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);

View File

@ -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) */

View File

@ -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);

View File

@ -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);