summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2000-10-30 07:03:00 +0000
committerken <ken@FreeBSD.org>2000-10-30 07:03:00 +0000
commit3096d95ce6e01400630bc0ded7da74255683470b (patch)
treebe92620ab063976d6f91823a2a3dec149665b54c /sys/cam/scsi
parentfaf88bf19cf9c84d3e17fc84ac9c9f6691dd1894 (diff)
downloadFreeBSD-src-3096d95ce6e01400630bc0ded7da74255683470b.zip
FreeBSD-src-3096d95ce6e01400630bc0ded7da74255683470b.tar.gz
Write support for the cd(4) driver.
This allows writing to DVD-RAM, PD and similar drives that probe as CD devices. Note that these are randomly writeable devices, not sequential-only devices like CD-R drives, which are supported by cdrecord. Add a new flag value for dsopen(), DSO_COMPATLABEL. The cd(4) driver now uses this flag instead of the DSO_NOLABELS flag. The DSO_NOLABELS always used a "fake" disklabel for the entire disk, provided by the caller. With the DSO_COMPATLABEL flag, dsopen() will first search the media for a label, and if it finds a label, it will use that label. Otherwise it will use the fake disklabel provided by the caller. This provides backwards compatibility, since we will still have labels for ISO9660 media. It also provides new functionality, since you can now have a regular BSD disklabel on read-only media, or on writeable media (e.g. DVD-RAM). Bruce and I both think that we should eventually (in a few years) get away from using disklabels for ISO9660 media, and just use the whole disk device (/dev/cd0). At that point disklabel handling in the cd(4) driver could follow the "normal" model, as used in the da(4) driver. Also, clean up the path in a couple of places in cdregister(). (Thanks to Nick Hibma for catching that bug.) Reviewed by: bde
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r--sys/cam/scsi/scsi_cd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index a972e84..8025560 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -254,7 +254,7 @@ static struct cdevsw cd_cdevsw = {
/* open */ cdopen,
/* close */ cdclose,
/* read */ physread,
- /* write */ nowrite,
+ /* write */ physwrite,
/* ioctl */ cdioctl,
/* poll */ nopoll,
/* mmap */ nommap,
@@ -628,7 +628,7 @@ cdregister(struct cam_periph *periph, void *arg)
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_CD);
disk_create(periph->unit_number, &softc->disk,
- DSO_NOLABELS | DSO_ONESLICE,
+ DSO_ONESLICE | DSO_COMPATLABEL,
&cd_cdevsw, &cddisk_cdevsw);
/*
@@ -727,6 +727,7 @@ cdregister(struct cam_periph *periph, void *arg)
STAILQ_INSERT_TAIL(&nchanger->chluns,
nsoftc,changer_links);
}
+ xpt_free_path(path);
} else if (status == CAM_REQ_CMP)
xpt_free_path(path);
else {
@@ -833,6 +834,7 @@ cdregister(struct cam_periph *periph, void *arg)
STAILQ_INSERT_TAIL(&nchanger->chluns,
nsoftc, changer_links);
+ xpt_free_path(path);
} else if (status == CAM_REQ_CMP)
xpt_free_path(path);
else {
OpenPOWER on IntegriCloud