[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Files Reference

omd Special File

Purpose

Provides access to the read/write optical device driver.

Description

The omd special file provides block and character (raw) access to disks in the read/write optical drive.

The r prefix on a special file name means that the drive is accessed as a raw device rather than a block device. Performing raw I/O with an optical disk requires that all data transfers be in multiples of the optical-disk logical block length. Also, all lseek subroutines that are made to the raw read/write optical device driver must set the file offset pointer to a value that is a multiple of the specified logical block size.

The scdisk SCSI Device Driver provides more information about implementation specifics.

Read/Write Optical Device Driver

Read/write optical disks, used in read/write optical drives, are media that provide storage for large amounts of data. Block access to optical disks is achieved through the special files /dev/omd0, /dev/omd1, ... /dev/omdn. Character access is provided through the special files /dev/romd0, /dev/romd1, ... /dev/romdn.

When a read/write optical disk is ejected from the drive for a mounted read/write optical file system, the files on the optical disk can no longer be accessed. Before attempting to access these files again, perform the following steps for a file system mounted from the read/write optical disk:

  1. Stop processes that have files open on the file system.
  2. Move processes that have current directories on the file system.
  3. Unmount the file system.
  4. Remount the file system after reinserting the media.

If these actions do not work, perform a forced unmount of the file system; then, remount the file system.

Note
Reinserting the read/write optical disk will not fix the problem. Stop all processes (graphical and ASCII), and then forcibly unmount the file system. Then remount the file system. After performing this procedure, you can restart any man commands.

Device-Dependent Subroutines

Most read/write optical operations are implemented using the open, read, write, and close subroutines. However, for some purposes, use of the openx (extended) subroutine is required.

The openx Subroutine

The openx subroutine is supported to provide additional functions to the open sequence. Appropriate authority is required for execution. If an attempt is made to run the openx subroutine without the proper authority, the subroutine returns a value of -1 and sets the errno global variable to a value of EPERM.

The ioctl Subroutine

The ioctl subroutine IOCINFO operation returns the devinfo structure defined in the /usr/include/sys/devinfo.h file. The IOCINFO operation is the only operation defined for all device drivers that use the ioctl subroutine. Other ioctl operations are specific for the type of device driver. Diagnostic mode is not required for the IOCINFO operation.

Error Conditions

Possible errno values for ioctl, open, read, and write subroutines when using the omd special file include:

EACCES Indicates one of the following circumstances:
  • An attempt was made to open a device currently open in Diagnostic or Exclusive Access mode.
  • An attempt was made to open a Diagnostic mode session on a device already open.
  • The user attempted a subroutine other than an ioctl or close subroutine while in Diagnostic mode.
  • A DKIOCMD operation was attempted on a device not in Diagnostic mode.
  • A DKFORMAT operation was attempted on a device not in Exclusive Access mode.
EBUSY Indicates one of the following circumstances:
  • The target device is reserved by another initiator.
  • An attempt was made to open a session in Exclusive Access mode on a device already opened.
EFAULT Indicates an illegal user address.
EFORMAT Indicates the target device has unformatted media or media in an incompatible format.
EINVAL Indicates one of the following circumstances:
  • The read or write subroutine supplied an nbyte parameter that is not an even multiple of the block size.
  • A sense data buffer length of greater than 255 bytes is not valid for a DKIOWRSE or DKIORDSE ioctl subroutine operation.
  • The data buffer length exceeded the maximum defined in the devinfo structure for a DKIORDSE, DKIOWRSE, or DKIOCMD ioctl subroutine operation.
  • An unsupported ioctl subroutine operation was attempted.
  • An attempt was made to configure a device that is still open.
  • An illegal configuration command has been given.
  • A DKPMR (Prevent Media Removal), DKAMR (Allow Media Removal), or DKEJECT (Eject Media) command was sent to a device that does not support removable media.
  • A DKEJECT (Eject Media) command was sent to a device that currently has its media locked in the drive.
EIO Indicates one of the following circumstances:
  • The target device cannot be located or is not responding.
  • The target device has indicated an unrecovered hardware error.
EMEDIA Indicates one of the following circumstances:
  • The target device has indicated an unrecovered media error.
  • The media was changed.
EMFILE Indicates an open operation was attempted for an adapter that already has the maximum permissible number of opened devices.
ENODEV Indicates one of the following circumstances:
  • An attempt was made to access an undefined device.
  • An attempt was made to close an undefined device.
ENOTREADY Indicates no read/write optical disk is in the drive.
ENXIO Indicates one of the following circumstances:
  • The ioctl subroutine supplied an invalid parameter.
  • A read or write operation was attempted beyond the end of the physical volume.
EPERM Indicates the attempted subroutine requires appropriate authority.
ESTALE Indicates a read-only optical disk was ejected (without first being closed by the user) and then either reinserted or replaced with a second disk.
ETIMEDOUT Indicates an I/O operation has exceeded the given timer value.
EWRPROTECT Indicates one of the following circumstances:
  • An open operation requesting read/write mode was attempted on read-only media.
  • A write operation was attempted to read-only media.

Files

/dev/romd0, /dev/romd1,..., /dev/romdn Provides character access to the read/write optical device driver.
/dev/omd0, /dev/omd1,..., /dev/omdn Provides block access to the read/write optical device driver.

Related Information

Special Files Overview.

scdisk SCSI Device Driver.

The close subroutine, ioctl subroutine, lseek subroutine, open subroutine, read subroutine, write subroutine.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]