Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.

For the floppy driver, use fdcontrol to manipulate density selection.

For the CD drivers, the 'a' and 'c' suffix is without actual effect and
any applications insisting on it can be satisfied with a symlink:
	ln -s /dev/cd0 /dev/cd0a

Ongoing discussion may result in these pieces of code being removed before
the 5-stable branch as opposed to after.
This commit is contained in:
phk 2003-09-05 10:40:16 +00:00
parent 5ed65ab40c
commit c5dc1fb629
4 changed files with 52 additions and 6 deletions

View File

@ -152,7 +152,9 @@ struct cd_softc {
int bufs_left;
struct cam_periph *periph;
dev_t dev;
#ifndef BURN_BRIDGES
eventhandler_tag clonetag;
#endif
int minimum_command_size;
int outstanding_cmds;
struct task sysctl_task;
@ -341,6 +343,7 @@ struct cdchanger {
static STAILQ_HEAD(changerlist, cdchanger) changerq;
#ifndef BURN_BRIDGES
static void
cdclone(void *arg, char *name, int namelen, dev_t *dev)
{
@ -360,6 +363,7 @@ cdclone(void *arg, char *name, int namelen, dev_t *dev)
*dev = softc->dev;
return;
}
#endif
static void
cdinit(void)
@ -531,7 +535,9 @@ cdcleanup(struct cam_periph *periph)
}
devstat_remove_entry(softc->device_stats);
destroy_dev(softc->dev);
#ifndef BURN_BRIDGES
EVENTHANDLER_DEREGISTER(dev_clone, softc->clonetag);
#endif
free(softc, M_DEVBUF);
splx(s);
}
@ -776,8 +782,10 @@ cdregister(struct cam_periph *periph, void *arg)
softc->dev = make_dev(&cd_cdevsw, periph->unit_number,
UID_ROOT, GID_OPERATOR, 0640, "cd%d", periph->unit_number);
softc->dev->si_drv1 = periph;
#ifndef BURN_BRIDGES
softc->clonetag =
EVENTHANDLER_REGISTER(dev_clone, cdclone, softc, 1000);
#endif
/*
* Add an async callback so that we get

View File

@ -242,7 +242,9 @@ acd_detach(struct ata_device *atadev)
free(entry, M_ACD);
}
destroy_dev(cdp->dev);
#ifndef BURN_BRIDGES
EVENTHANDLER_DEREGISTER(dev_clone, cdp->clone_evh);
#endif
devstat_remove_entry(cdp->stats);
ata_prtdev(atadev, "WARNING - removed from configuration\n");
ata_free_name(atadev);
@ -273,6 +275,7 @@ acd_init_lun(struct ata_device *atadev)
return cdp;
}
#ifndef BURN_BRIDGES
static void
acd_clone(void *arg, char *name, int namelen, dev_t *dev)
{
@ -289,6 +292,7 @@ acd_clone(void *arg, char *name, int namelen, dev_t *dev)
if (unit == cdp->lun)
*dev = makedev(acd_cdevsw.d_maj, cdp->lun);
}
#endif
static void
acd_make_dev(struct acd_softc *cdp)
@ -300,7 +304,9 @@ acd_make_dev(struct acd_softc *cdp)
dev->si_drv1 = cdp;
cdp->dev = dev;
cdp->device->flags |= ATA_D_MEDIA_CHANGED;
#ifndef BURN_BRIDGES
cdp->clone_evh = EVENTHANDLER_REGISTER(dev_clone, acd_clone, cdp, 1000);
#endif
acd_set_ioparm(cdp);
}

View File

@ -316,9 +316,11 @@ struct fd_data {
struct callout_handle toffhandle;
struct callout_handle tohandle;
struct devstat *device_stats;
eventhandler_tag clonetag;
dev_t masterdev;
#ifndef BURN_BRIDGES
eventhandler_tag clonetag;
dev_t clonedevs[NUMDENS - 1];
#endif
device_t dev;
fdu_t fdu;
};
@ -386,7 +388,9 @@ static int fdc_detach(device_t dev);
static void fdc_add_child(device_t, const char *, int);
static int fdc_attach(device_t);
static int fdc_print_child(device_t, device_t);
#ifndef BURN_BRIDGES
static void fd_clone (void *, char *, int, dev_t *);
#endif
static int fd_probe(device_t);
static int fd_attach(device_t);
static int fd_detach(device_t);
@ -1117,6 +1121,7 @@ DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0);
#endif /* NCARD > 0 */
#ifndef BURN_BRIDGES
/*
* Create a clone device upon request by devfs.
*/
@ -1170,6 +1175,7 @@ fd_clone(void *arg, char *name, int namelen, dev_t *dev)
}
}
}
#endif
/*
* Configuration/initialization, per drive.
@ -1323,14 +1329,20 @@ static int
fd_attach(device_t dev)
{
struct fd_data *fd;
int i;
fd = device_get_softc(dev);
#ifndef BURN_BRIDGES
fd->clonetag = EVENTHANDLER_REGISTER(dev_clone, fd_clone, fd, 1000);
#endif
fd->masterdev = make_dev(&fd_cdevsw, fd->fdu << 6,
UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu);
#ifndef BURN_BRIDGES
{
int i;
for (i = 0; i < NUMDENS - 1; i++)
fd->clonedevs[i] = NODEV;
}
#endif
fd->device_stats = devstat_new_entry(device_get_name(dev),
device_get_unit(dev), 0, DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
@ -1342,16 +1354,20 @@ static int
fd_detach(device_t dev)
{
struct fd_data *fd;
int i;
fd = device_get_softc(dev);
untimeout(fd_turnoff, fd, fd->toffhandle);
devstat_remove_entry(fd->device_stats);
destroy_dev(fd->masterdev);
#ifndef BURN_BRIDGES
{
int i;
for (i = 0; i < NUMDENS - 1; i++)
if (fd->clonedevs[i] != NODEV)
destroy_dev(fd->clonedevs[i]);
EVENTHANDLER_DEREGISTER(dev_clone, fd->clonetag);
}
#endif
return (0);
}

View File

@ -316,9 +316,11 @@ struct fd_data {
struct callout_handle toffhandle;
struct callout_handle tohandle;
struct devstat *device_stats;
eventhandler_tag clonetag;
dev_t masterdev;
#ifndef BURN_BRIDGES
eventhandler_tag clonetag;
dev_t clonedevs[NUMDENS - 1];
#endif
device_t dev;
fdu_t fdu;
};
@ -386,7 +388,9 @@ static int fdc_detach(device_t dev);
static void fdc_add_child(device_t, const char *, int);
static int fdc_attach(device_t);
static int fdc_print_child(device_t, device_t);
#ifndef BURN_BRIDGES
static void fd_clone (void *, char *, int, dev_t *);
#endif
static int fd_probe(device_t);
static int fd_attach(device_t);
static int fd_detach(device_t);
@ -1117,6 +1121,7 @@ DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0);
#endif /* NCARD > 0 */
#ifndef BURN_BRIDGES
/*
* Create a clone device upon request by devfs.
*/
@ -1170,6 +1175,7 @@ fd_clone(void *arg, char *name, int namelen, dev_t *dev)
}
}
}
#endif
/*
* Configuration/initialization, per drive.
@ -1323,14 +1329,20 @@ static int
fd_attach(device_t dev)
{
struct fd_data *fd;
int i;
fd = device_get_softc(dev);
#ifndef BURN_BRIDGES
fd->clonetag = EVENTHANDLER_REGISTER(dev_clone, fd_clone, fd, 1000);
#endif
fd->masterdev = make_dev(&fd_cdevsw, fd->fdu << 6,
UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu);
#ifndef BURN_BRIDGES
{
int i;
for (i = 0; i < NUMDENS - 1; i++)
fd->clonedevs[i] = NODEV;
}
#endif
fd->device_stats = devstat_new_entry(device_get_name(dev),
device_get_unit(dev), 0, DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
@ -1342,16 +1354,20 @@ static int
fd_detach(device_t dev)
{
struct fd_data *fd;
int i;
fd = device_get_softc(dev);
untimeout(fd_turnoff, fd, fd->toffhandle);
devstat_remove_entry(fd->device_stats);
destroy_dev(fd->masterdev);
#ifndef BURN_BRIDGES
{
int i;
for (i = 0; i < NUMDENS - 1; i++)
if (fd->clonedevs[i] != NODEV)
destroy_dev(fd->clonedevs[i]);
EVENTHANDLER_DEREGISTER(dev_clone, fd->clonetag);
}
#endif
return (0);
}