summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-10-11 10:35:17 +0000
committerphk <phk@FreeBSD.org>2002-10-11 10:35:17 +0000
commit2c6b097f468ee8d671140ee8a2b0f5b1afd02a6d (patch)
tree2d5cdc856852d3e8fbd20cdcce832eaee38a7ba9 /sys/cam
parenta9d5f78a61879bbe16757a7bfb7285147321437a (diff)
downloadFreeBSD-src-2c6b097f468ee8d671140ee8a2b0f5b1afd02a6d.zip
FreeBSD-src-2c6b097f468ee8d671140ee8a2b0f5b1afd02a6d.tar.gz
Trapdoor access to cd%da and cd%c so they still work, but do not let them
show up in /dev.
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_cd.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index fa08511..a7af9ba 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -135,6 +135,7 @@ struct cd_softc {
int bufs_left;
struct cam_periph *periph;
dev_t dev;
+ eventhandler_tag clonetag;
};
struct cd_quirk_entry {
@@ -296,6 +297,26 @@ struct cdchanger {
static STAILQ_HEAD(changerlist, cdchanger) changerq;
static void
+cdclone(void *arg, char *name, int namelen, dev_t *dev)
+{
+ struct cd_softc *softc;
+ const char *p;
+ int l;
+
+ softc = arg;
+ p = devtoname(softc->dev);
+ l = strlen(p);
+ if (bcmp(name, p, l))
+ return;
+ if (name[l] != 'a' && name[l] != 'c')
+ return;
+ if (name[l + 1] != '\0')
+ return;
+ *dev = softc->dev;
+ return;
+}
+
+static void
cdinit(void)
{
cam_status status;
@@ -465,6 +486,7 @@ cdcleanup(struct cam_periph *periph)
}
devstat_remove_entry(&softc->device_stats);
destroy_dev(softc->dev);
+ EVENTHANDLER_DEREGISTER(dev_clone, softc->clonetag);
free(softc, M_DEVBUF);
splx(s);
}
@@ -604,6 +626,8 @@ 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;
+ softc->clonetag =
+ EVENTHANDLER_REGISTER(dev_clone, cdclone, softc, 1000);
/*
* Add an async callback so that we get
OpenPOWER on IntegriCloud