HP-UX Reference (11i v1 00/12) - 5 Miscellaneous Topics, 7 Device (Special) Files, 9 General Information, Index (vol 9)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man7/!!!intro.7
________________________________________________________________
___ ___
d
disk(7) disk(7)
is a hardware-dependent value that can be queried with the DIOC_DESCRIBE ioctl call, which is
described below.
In addition to reading and writing data, the character-special file interface can used to obtain device specific
information and to perform special operations. These operations are controlled through use of ioctl calls.
Details related to these ioctls are contained in <sys/diskio.h >.
The DIOC_DESCRIBE ioctl can be used to obtain device specific identification information. The informa-
tion returned includes the disk’s model identification, the disk interface type, and the disk’s logical block
size.
The DIOC_CAPACITY ioctl can be used to obtain the capacity of a disk device in DEV_BSIZE units.
(DEV_BSIZE is defined in <sys/param.h>).
The DIOC_EXCLUSIVE ioctl can be used to obtain and release exclusive access to a disk device.
Exclusive access is required for some special operations, such as media reformatting, and may be desirable
in other circumstances. The value one specifies that exclusive access is requested. The value zero specifies
the exclusive access should be released. Exclusive access causes other open requests to fail. Exclusive
access can only be granted when the device is not currently opened in block-mode and there is only one
open file table entry for that disk device (the one accessible to the exclusive access requester).
ERRORS
The following errors can be returned by a disk device driver call:
[EACCES] Required permission is denied for the the device or operation.
[ENXIO] If resulting from an open() call, this indicates there is no device at the specified
address. For other calls, this indicates the specified address is out of range or the dev-
ice can no longer be accessed.
[EINVAL] From an open() call: the device is not a disk device. For other calls: Invalid
request or parameter.
[EIO] I/O error (e.g., media defect or device communication problem).
WARNINGS
The interaction of block-special and character-special file access to the same
BLKDEV_IOSIZE
-sized block
is not specified, and in general is unpredictable.
On some systems, having both a mounted file system and a block special file open on the same device can
cause unpredictable results; this should be avoided if possible. This is because it may be possible for some
files to have private buffers in some systems.
Although disk devices have historically had small (typically 512-byte) block sizes, some disk devices (such as
optical disks and disk arrays) have relatively large block sizes. Applications using direct raw disk access
should use
ioctl() calls to determine appropriate I/O operation sizes and alignments.
Any disk with removable media (for example, floppy or CD-ROM) containing a mounted file system should
not be removed prior to being unmounted. Removal of disk media containing mounted file systems is likely
to result in file system errors and system panics.
DEPENDENCIES
disc3
Devices whose logical block size is less than DEV_BSIZE must be accessed on DEV_BSIZE boun-
daries and with transfer sizes that are multiples of
DEV_BSIZE. Disk ‘‘sections’’ 0 (zero) and 2 (two)
have exchanged meanings with HP-UX Release 10.0 and beyond. Whole disk is section 0.
AUTHOR
disk was developed by HP and AT&T.
SEE ALSO
mknod(1M), intro(7), ioscan(1M).
System Administrator manuals included with your system.
HP-UX Release 11i: December 2000 − 2 − Section 7−−25
___
___