DragonFly On-Line Manual Pages
GETDEVPATH(3) DragonFly Library Functions Manual GETDEVPATH(3)
getdevpath -- retrieve device path given name or label
Standard C Library (libc, -lc)
getdevpath(const char *devname, int flags);
getdevpath() takes a device name such as ``da0'', a device identifier
such as ``V21JYQ0G'', a device path beginning with ``/'' or ``.'', or a
device label from one of the devtab files, and returns an allocated path
which may be used to open the device.
Device names prefixed with ``/'' or ``.'' are assumed to be device paths
and an exact allocated copy is simply returned. However, flags may mod-
ify the operation.
Device names specified with a type prefix, such as ``serno:V21JYQ0G'' are
assumed to be typed device identifiers and are directly translated to the
appropriate path in /dev, for example ``/dev/serno/V21JYQ0G''.
Device labels are directly checked against /dev first, using lstat(), and
if not found will be searched for in one of the devtab files.
The following flags may be passed to getdevpath():
GETDEVPATH_RAWDEV Normally, getdevpath() returns a high level
devfs path which often winds up being a softlink
in devfs. If this flag is specified and the
device path represents a softlink, getdevpath()
will do a readlink(2) and return the actual raw
device path instead. If the device path cannot
be lstat()'d this option will return NULL.
getdevpath() returns a pointer to a malloc()'d path on success and NULL
on failure. If a failure occurs errno will be set appropriately.
Note that a malloc()'d path may be returned even if it does not exist in
the filesystem. Callers should not assume that the device is accessible
unless they can also open the device.
devfs(5), devtab(5), fstab(5)
The getdevpath function appeared in DragonFly 2.3.
DragonFly 3.9 July 10, 2009 DragonFly 3.9