OD(4)OD(4)NAMEod - optical disk device driver
SYNOPSIS
odc0 at 0x2012000
od0 at odc0 slave 0
DESCRIPTION
This driver allows access to the optical disk drive. The driver has
both block and character oriented interfaces. The form of the block
device is
/dev/od<volume><partition>
Where <volume> is a digit from 0 to 7 and <partition> is a letter from
a to h, indicating the partition on the disk. For example, /dev/od1b
refers to volume 1, partition b. Similarly, a character device is
accessed by
/dev/rod<volume><partition>
An optical device in /dev does not refer to a specific optical disk
drive. Instead these devices refer to individual pieces of disk media
which can be installed in any drive. The devices are called volumes to
distinguish them from optical disks and drives. It is possible for
several volumes to be in use even though only one of them can be
inserted at a time in a single-drive system. The operating system asks
for the proper volume to be inserted at the appropriate times by using
a popup window. If for some reason the volume is no longer available
(for example, if you took it somewhere else and forgot it) you can type
'n' to this popup window and all programs using the volume will receive
an error.
When a disk is inserted for the first time a special process called
autodiskmount will attempt to mount the disk in your home directory
using the name from the disk label. If you want to use a command on a
disk without having it automatically automounted then run that command
before inserting the disk. When the command opens the volume a kernel
panel will appear with the message:
Please insert new disk for volume <n>
where <n> is the volume number from the device entry in /dev (e.g.
volume 0 for /dev/rod0a). A volume inserted into an optical drive will
be automatically ejected to make room for another volume if necessary.
A message will appear in a kernel panel telling you which volume to
insert as other volumes are needed. The next section describes how to
determine a volume number that is not in use and how to sense if a
volume is inserted in any drive.
The following operations are allowed by the optical disk driver:
open() See open(2). If the O_NDELAY flag is set, and that volume is
not inserted in any drive, the error code EWOULDBLOCK is
returned instead of the system requesting a new disk to be
inserted. This is useful for programs that want to determine
whether a volume is inserted without hanging the system waiting
for the volume to be inserted.
close()
See close(2). When a volume is not in any drive at the time of
the last close operation the association between the volume
number and a particular disk is removed.
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
<bsd/dev/disk.h>):
DKIOCGLABEL
Get disk label. 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>.
DKIOCGFREEVOL
Get free volume number. Returns a volume number (placed in an
int pointed to by argp) that is currently not in use.
FILES
<nextdev/disk.h>
/dev/rod?
/dev/od??
SEE ALSOopen(2), read(2), write(2), ioctl(2), close(2), disk(8)NeXT Computer, Inc. March 10, 1990 OD(4)