SD(4) — UNIX Programmer’s Manual
NAME
sd − SCSI disk device driver
SYNOPSIS
device_name as sd? at sc0 target ? lun ?
DESCRIPTION
This driver allows access to a number of disk drives with standard SCSI interfaces. The driver has both block and character oriented interfaces. The form of the block device is
/dev/sd<unit><partition>
Where <unit> is a digit from 0 to 6 and <partition> is a letter from a to h, indicating the partition on the disk. For example, /dev/sd1b refers to unit 1, partition b. Similarly, a character device is accessed by
/dev/rsd<unit><partition>
The following operations are allowed by the SCSI disk driver:
open()
See open(2).
close()
See close(2).
read()
See read(2).
write()
See write(2).
strategy()
This is the standard block device entry point used by the Unix File System. This is only valid for the block disk device.
ioctl()
The general form of an ioctl() call is
ioctl(int d, u_int request, char ∗argp)
The following ioctl requests are currently defined (see <nextdev/disk.h> and <nextdev/scsireg.h>):
DKIOCKGLABEL
Get disk label, kernel version. argp points to a pointer to a struct disk_label (see <nextdev/disk.h>. Copies the label of the current disk into kernel address space.
DKIOCGLABEL
Get disk label, user version. argp points to a pointer to a struct disk_label (see <nextdev/disk.h>. Copies the label of the current disk into user address space.
DKIOCSLABEL
Write disk label. argp points to a pointer to a struct disk_label. Must be superuser to execute this call.
DKIOCINFO
Get drive info. argp points to a struct drive_info (see <nextdev/disk.h>.
SDIOCSRQ
Execute an arbitrary SCSI command using the scsi_req mechanism. You must be superuser to execute this call.
For SDIOCSRQ, argp points to a struct scsi_req, which is defined in <nextdev/scsireg.h> as are all other constants used with this mechanism. This struct contains both the input to the sd driver required for execution of a command (SCSI CDB bytes, address at which DMA will occur, etc.) as well as the status block upon return. The following status is provided:
srp->sr_io_status
Indicates success, I/O timeout, SCSI check status, DMA overrun, etc.
srp->sr_scsi_status
The actual SCSI status byte returned by the target.
srp->sr_dma_xfr
Number of data bytes actually transferred to/from device.
srp->sr_exec_time
Command execution time, with microsecond resolution.
FILES
<nextdev/scsireg.h>
<nextdev/disk.h>
/dev/rsd?
/dev/sd??
SEE ALSO
open(2), read(2), write(2), ioctl(2), close(2)
NeXT, Inc. — June 30, 1989