Age | Commit message (Collapse) | Author |
|
|
|
|
|
implement an ioctl to get a spoofed label even for disks that have
a label on them.
|
|
for temporary storage of CD table of contents
|
|
|
|
|
|
should also fix some cdio problems with SCSI cdroms.
|
|
|
|
|
|
|
|
* Use scsi_do_ioctl() in cd.c and uk.c again.
|
|
reference for making transferral of meta-information possible from
readdisklabel to bounds_check_with_label. The first (and maybe only)
thing that will use this is the multi-disklabel-format code on the
alpha where the labelsector is passed via cpu_disklabel so the label
write-protection can work correctly no matter what label was found.
Also use a new macro DKBAD to get at the dkbad field of the cpu_disklabel
implementations that contain it. This too is for multi-disklabel
architectures where the "bad" field can be inside a union. Use this
macro as a means for a driver to check if an architecture supports
dkbad constructs.
Remove proto of bounds_check_with_label from all MD disklabel.h as it
is in sys/disklabel.h.
I have not been able to test the changes everywhere, if I break anything
I apologize, and promise to fix it as soon as I become aware of it.
|
|
to:
* New changer driver.
* Better optical support.
* Different `done' semantics.
* New quirks for SCSI QIC tape driver, SCSI floppy drives.
* Better support for SCSI-I devices.
Everybody needs to test this.
|
|
NetBSD PR#3409 from Koji Imada <koji@imada.math.human.nagoya-u.ac.jp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Implemented NetBSD PR#2529, adding ZIP 100.
* Added MTIOCTOP support to acd, cd, and sd.
* Implemented eject on close for acd, cd, and sd.
`mt -f /dev/rcd0d offline' now ejects a mounted {acd|cd|sd} when it is
unmounted.
|
|
|
|
allow CDDA disks to be read.
not tested, anyone w/ SCSI CD is ought to.
here is the test program (not tested too ;):
#define CDDA
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/scsiio.h>
#include <sys/cdio.h>
#include <scsi/scsi_all.h>
#include <scsi/scsi_cd.h>
#include <scsi/scsi_disk.h>
extern int errno;
void
usage()
{
fprintf(stderr, "usage: cdda -d device -b blkcnt -o offset >output\n");
exit(1);
}
char databuf[CD_DA_BLKSIZ];
main(int argc, char *argv[])
{
int ch;
int fd;
off_t offset = 0;
int cnt = 0;
char *dev = 0;
struct scsi_rw_big read_cmd;
struct scsi_mode_sense sense_cmd;
struct cd_mode_data bdesc;
scsireq_t req;
while ((ch = getopt(argc, argv, "d:b:o:")) != -1) {
switch (ch) {
case 'd':
dev = optarg;
break;
case 'b':
cnt = atoi(optarg);
if (cnt <= 0)
usage();
break;
case 'o':
offset = atoi(optarg);
break;
case '?':
default:
usage();
}
}
if (dev == NULL || cnt == 0)
usage();
fd = open(dev, O_RDONLY);
if (fd == -1)
err(1,"can't open device %s", dev);
#ifdef DEBUG
ch = SC_DB_FLOW;
ioctl(fd, SCIOCDEBUG, &ch);
#endif
ch = 1;
if (ioctl(fd, CDIOCSETCDDA, &ch) == -1)
warn("can't set CDDA mode");
read_cmd.opcode = READ_BIG; /* READ10 */
read_cmd.byte2 = 0; /* no relative */
read_cmd.reserved = 0;
read_cmd.length2 = 0;
read_cmd.length1 = 1; /* read one block at a time.
hope it caches! */
read_cmd.control = 0; /* LBA mode, leave flag & link zero */
for (; cnt > 0; cnt--, offset++) {
read_cmd.addr_3 = (offset >> 24) & 0xff;
read_cmd.addr_2 = (offset >> 16) & 0xff;
read_cmd.addr_1 = (offset >> 8) & 0xff;
read_cmd.addr_0 = offset & 0xff;
memset(&req, 0, sizeof(req));
req.flags = SCCMD_READ;
/* timeout is in milliseconds--not that it's obvious from the
include files! */
req.timeout = 10000; /* 10 sec */
bcopy(&read_cmd, req.cmd, sizeof(read_cmd));
req.cmdlen = sizeof(read_cmd);
req.databuf = databuf;
req.datalen = sizeof(databuf);
req.senselen = sizeof(req.sense); /* XXX */
if (ioctl(fd, SCIOCCOMMAND, &req) == -1) {
fprintf(stderr, "bad ioctl: %d\n", errno);
ch = 0;
ioctl(fd, CDIOCSETCDDA, &ch);
#ifdef DEBUG
ioctl(fd, SCIOCDEBUG, &ch);
#endif
exit(1);
}
if (req.retsts != 0 || req.error != 0) {
ch = 0;
ioctl(fd, CDIOCSETCDDA, &ch);
#ifdef DEBUG
ioctl(fd, SCIOCDEBUG, &ch);
#endif
errx(1,"return status %d, error %d\n", req.retsts, req.error);
}
if (req.datalen_used != sizeof(databuf)) {
ch = 0;
ioctl(fd, CDIOCSETCDDA, &ch);
#ifdef DEBUG
ioctl(fd, SCIOCDEBUG, &ch);
#endif
errx(1,"didn't get full buffer back (%x)", req.datalen_used);
}
write(1, databuf, sizeof(databuf));
}
ch = 0;
if (ioctl(fd, CDIOCSETCDDA, &ch) == -1)
warn("can't reset CDDA mode");
#ifdef DEBUG
ioctl(fd, SCIOCDEBUG, &ch);
#endif
close(fd);
exit(0);
}
|
|
|
|
|
|
|
|
- Accept DIOCEJECT as a synonym for CDIOCEJECT. Implement DIOCLOCK
separately from CDIOCALLOW and CDIOCPREVENT, even though they perform
basically the same function (with a different interface XXX).
- scsi prototypes
|
|
"command aborted" status)
Handle cases like the following:
- controller calls scsi_done() with error XS_TIMEOUT
- scsi_done() calls sddone()
- sddone() calls disk_unbusy()
- scsi_done() calls controller to retry command (missing the
call to disk_busy())
- controller calls scsi_done()
- scsi_done() calls sddone()
- sddone() calls disk_busy(), which panics because of the imbalance.
Bug noticed by Leo Weppleman, who also suggested this fix; pass an additional
boolean argument ("complete") to the device's "done" routine, with a
value of `0' passed from the previous call to "done", and add an additional
call to "done" when the xfer resources are freed.
|
|
New generic disk framework. Highlights:
New metrics handling. Metrics are now kept in the new `struct disk'.
Busy time is now stored as a timeval, and transfer count in bytes.
Storage for disklabels is now dynamically allocated, so that the size
of the disk structure is not machine-dependent.
Several new functions for attaching and detaching disks, and handling
metrics calculation.
Old-style instrumentation is still supported in drivers that did it
before. However, old-style instrumentation is being deprecated, and
will go away once the userland utilities are updated for the new
framework.
For usage and architectural details, see the forthcoming disk(9)
manual page.
|
|
If the read or write request can fit into a 6-byte cdb, then
use a 6-byte cdb, otherwise use the 10-byte as before.
|
|
|
|
|