The manner in which devices and device special files are named and organized
has been changed in Version 5.0 of the Tru64 UNIX operating system.
For
details on these changes, see
dsfmgr
(8)
and the
System Administration
manual.
Also,
see the
Installation Guide
for information on the effects that various installation
operations have on the accessibility of new- and old-style device special
file names.
To support the Version 5.0 changes that affect device handling, the operating system provides conversion routines that make it relatively easy to handle the transition between the new- and old-style names. This appendix documents those routines. These routines will continue to be provided until the old-style names are no longer supported by the system.
System components or applications that reference the names of device special files will need to modify their source code. The modifications can be done, as necessary, either by replacing all device special file names with their new names or by using the conversion routines to derive the new names.
The following rules apply to all of the conversion routines:
Arguments will be returned if their pointers in the functions calls are non-null.
Only the first argument is mandatory. However, the functions will not return useful information, except status information, unless other arguments are specified.
The individual routines --
dsfcvt_btoc()
,
dsfcvt_ctob()
,
dsfcvt_ntoo()
,
dsfcvt_oton()
,
dsfcvt_noro()
, and
dsfcvt_cdevtoname()
-- are described in the following list.
Descriptions of the
parameters follow the routine descriptions.
dsfcvt_btoc()
Convert block name to character name. The block device name is searched for in the device status database, and, if found, the corresponding character device name is then searched for. If it is found, the name is returned along with the hardware ID.
Synopsis:
int dsfcvt_btoc(
const char *blk_name,
char *chr_name,
char *blk_path,
char *chr_path,
long *hardware_id
);
Return values: ESUCCESS (both device names found), ENOENT (block device name not found), ENODEV (character device name not found).
dsfcvt_ctob()
Convert character name to block name. The character name is searched for in the device status database, and, if found, the corresponding block device is then searched for. If it is found, the name is returned along with the hardware ID.
Synopsis:
int dsfcvt_ctob(
const char *chr_name,
char *blk_name,
char *chr_path,
char *blk_path,
long *hardware_id
);
Return values: ESUCCESS (both device names found), ENOENT (character device name not found), ENODEV (block device name not found).
dsfcvt_ntoo()
Convert new name to old name. The new name is searched for in the device status database, and, if found, the old name, if any, is returned along with the hardware ID.
Synopsis:
int dsfcvt_ntoo(
const char *new_name,
char *old_name,
char *new_path,
char *old_path,
long *hardware_id
);
Return values: ESUCCESS (both device names found), ENOENT (new device name not found), ENODEV (old device name not found).
dsfcvt_oton()
Convert old name to new name. The old name is searched for in the device status database, and, if found, the new name is returned along with the hardware ID.
Synopsis:
int dsfcvt_oton(
const char *old_name,
char *new_name,
char *old_path,
char *new_path,
long *hardware_id
);
Return values: ESUCCESS (both device names found), ENOENT (old device name not found), ENODEV (new device name not found).
dsfcvt_noro()
Convert a name to old or new name. The input name (either new or old) is searched for in the device status database. The first old or new name that matches will be returned in the appropriate field, and the input name will be returned in its appropriate field. The hardware ID is also returned.
The search name may be in either or both name arguments. If in both, they must be the same name and must not point to the same string value.
Synopsis:
int dsfcvt_noro(
char *new_name,
char *old_name,
char *new_path,
char *old_path,
long *hardware_id
);
Return values: ESUCCESS (both device names found), ENOENT (input device name, old or new, not found), ENODEV (other device name, old or new, not found).
dsfcvt_cdevtoname()
Convert a device's unique numeric identifier (cdev) to new name and path. The cdev is searched for in the device status database, and, if found, the new name and path are returned.
Synopsis:
int dsfcvt_cdevtoname(
dev_t cdev,
char *new_name,
char *new_path
);
Return values: ESUCCESS (device found), ENOENT (device not found).
The following list provides information about the arguments to the functions:
Pointer to a name of a block or character device, respectively;
for example,
dsk1a
,
rz4a
, or
rrz4a
.
Pointer to a path for a device identified by
blk_name
(for example,
/dev/disk/dsk1a
) or
chr_name
(for example,
/dev/rdisk/dsk1a
).
Pointer to a device name. The new_name argument follows the new-style naming conventions and the old_name argument follows the old-style naming conventions.
Pointer to a path for a device name.
The
new_path
argument follows the new-style naming conventions and the
old_path
argument follows the old-style naming conventions --
for example,
/dev/disk/dsk1a
and
/dev/rdisk/dsk1a
for block and character devices, respectively, under new-style
conventions, or
/dev/rz4a
and
/dev/rrz4a
for block and character devices, respectively, under old-style conventions.
Pointer to where the unique numeric identifier for a device is to be returned. (This identifier is assigned and maintained by the kernel.)
The unique major-minor number assigned to a device by the kernel.