device_numbers(3K) DG/UX R4.11MU05 device_numbers(3K)
NAME
devicenumbers: ioallocatedevicenumber,
iodeallocatedevicenumber, iomapdevicenumber - manage minor
device numbers
SYNOPSIS
#include "/usr/src/uts/aviion/ii/iio.h"
statustype ioallocatedevicenumber (
iomajordevicenumbertype major, /*READONLY*/
bit32etype handle, /*READONLY*/
uint16type unit, /*READONLY*/
iominordevicenumberptrtype minorptr /*WRITEONLY*/
)
void iodeallocatedevicenumber (
iodevicenumbertype devicenumber /*READONLY*/
)
statustype iomapdevicenumber (
iodevicenumbertype devicenumber, /*READONLY*/
bit32eptrtype handleptr, /*WRITEONLY*/
uint16ptrtype unitptr /*WRITEONLY*/
)
where:
devicenumber The major and minor device numbers of a device.
handle Device handle that identifies the device to its
driver. This is usually a pointer to a structure
that contains state information about the devices.
handleptr Pointer to location where device handle is re
turned.
major The device's major device number.
minorptr A pointer to the location where the allocated mi
nor device number is returned.
unit The unit number that identifies the device to its
controller.
unitptr A pointer to the location where the unit number is
returned.
DESCRIPTION
The following device number management routines are described in this
man page:
ioallocatedevicenumber
Assign device a minor device number. The major device number
identifies the family of devices to which the device belongs.
iodeallocatedevicenumber
Deallocate minor device number, thus terminating the associa
tion between a device and its minor device number.
iomapdevicenumber
Translate a previously allocated major and minor device number
pair to a device handle and unit number.
During device configuration, the system passes to a driver's driv
erconfigure routine a major number that identifies the driver's po
sition in the kernel's driver lookup table. The driver must then
call ioallocatedevicenumber to specify the particular device's lo
cation in the kernel's device tables. This routine returns the next
available minor number and also puts a parameter supplied by the
driver into the device table. Typically, the parameter is a pointer
to a data structure associated with the device. The driver can re
trieve the stored parameter by calling iomapdevicenumber with the
major and minor device number as parameters. At device deconfigura
tion time, the minor device number can be returned to the pool of un
claimed numbers by calling iodeallocatedevicenumber.
DIAGNOSTICS
Return Value
For ioallocatedevicenumber:
OK No errors were discovered, so all returned arguments
are valid.
IOENXIOALLMINORNUMBERSINUSE
The minor device number table for this major device
number contains no unused slots and has grown to the
maximum size.
For iodeallocatedevicenumber:
None.
For iomapdevicenumber:
OK No errors occurred.
IOENXIODEVICEISNOTCONFIGURED
An attempt was made to map a device that is not config
ured.
Errors
None.
Abort Conditions
For iodeallocatedevicenumber, panic may be invoked with the fol
lowing error codes:
IOPANICMAJORNUMBEREXCEEDSMAX
An invalid major device number was used.
IOPANICDEVICEISNOTCONFIGURED
An attempt was made to deallocate a device that was not
configured.
IOPANICDEVICEISNOTCONFIGURED2
An active entry in the minor device number table does
not exist at the offset specified by the minor device
number argument.
For iomapdevicenumber, panic may be invoked with the following er
ror code:
IOPANICMAJORNUMBEREXCEEDSMAX
The major device number argument exceeds the maximum
specified by cfiodevicedrivercount.
IOPANICMAJORNUMBEREXCEEDSMAX2
The major device number argument exceeds the maximum
specified by cfiomajornumbercount.
SEE ALSO
deviceconfiguration(3K).
Programming in the DG/UX Kernel Environment.
Licensed material--property of copyright holder(s)