up | Inhaltsverzeichniss | Kommentar

Manual page for SD(4)

sd - SCSI disk device driver

SYNOPSIS

device_name as sd[0-6] at sc0 target [0-6] lun [0-7]

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 15, 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>

Partition h of the character device is a special device called the ``live'' partition; for example, sd1h. I/O to and from the live partition is used to access disks that do not have a valid label, and to access portions of disks normally inaccessible to read(2) and write(2) calls -- for example, the front porch. (Reading and writing the other partitions of the character device, and all partitions of the block device, requires a valid label on the disk.) I/O using the live partition has the following restrictions:

The sd driver supports drives with removable media. In a manner similar to the fd(4) and od(4) drivers, the devices in /dev refer to volumes, not to drives. One physical drive can have multiple volumes associated with it at any given time. Each drive has associated with it one permanent volume at boot time -- drive 0 is associated with volume 0 (/dev/rsd0? and /dev/sd0?), drive 1 with volume 1, etc. Henceforth, additional volumes can be assigned to a drive if one of the following occurs:

In both of these cases, the following occurs when an I/O is attempted on a volume not currently present in a drive:

1.
The volume currently present in the desired drive is ejected. (If any references still remain to this device, the volume will be ``remembered,'' and will not be reassigned; otherwise, the volume information is discarded, and the volume may be reassigned at a later time.)
2.
An alert panel is displayed asking for the desired volume (by name, if known).
3.
The user takes one of two actions:

Another feature of removable media support is automatic mounting of newly inserted volumes. If a disk is inserted in an empty drive, the disk will be mounted if it has a valid label and is in a consistent (``clean'') state. If it does not have a valid label, or has a file system in an inconsistent state, the user will be asked by the Workspace Manager (via an alert panel) if he/she wants to initialize it (or repair it, if ``unclean''). Answering in the affirmative results in the disk ultimately being mounted in the root directory.

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 /NextDeveloper/Headers/bsd/dev/disk.h and /NextDeveloper/Headers/bsd/dev/scsireg.h):

DKIOCGLABEL
Get disk label; argp points to a pointer to a struct disk_label (see /NextDeveloper/Headers/bsd/dev/disk.h). Copy 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 /NextDeveloper/Headers/bsd/dev/disk.h).
DKIOCSFORMAT
Set ``disk formatted'' flag; argp points to an int; if *argp is non-zero, the driver henceforth assumes the disk is formatted, else the driver marks the disk as unformatted.
DKIOCGFORMAT
Get "disk formatted" flag; argp points to an int, and *argp will be 1 if the disk is formatted, else *argp will be 0.
DKIOCEJECT
Eject the disk. Only valid for drives with removable media. See ``Multiple Volume Support.''
SDIOCGETCAP
Get disk capacity; argp points to a struct capacity_reply (see /NextDeveloper/Headers/bsd/dev/scsireg.h).
DKIOCGFREEVOL
Get the number of the next free volume; argp points to an int. This ioctl is normally executed on the SCSI Disk Controller device, /dev/sdc0. It is used when an application wants to determine the volume number not currently in use. If this ioctl returns a value of 3, for example, a subsequent open of /dev/rsd3a will result in an alert panel requesting a new disk for volume 3.
SDIOCSRQ
Execute an arbitrary SCSI command using the scsi_req mechanism. (Must be superuser to execute this call.)

For SDIOCSRQ, argp points to a struct scsi_req, defined in /NextDeveloper/Headers/bsd/dev/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

/NextDeveloper/Headers/bsd/dev/scsireg.h
/NextDeveloper/Headers/bsd/dev/disk.h
/dev/rsd?
/dev/sd??
/dev/sdc0

SEE ALSO

open(2), read(2), write(2), ioctl(2), close(2)


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97