getdevpath man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

GETDEVPATH(3)		 BSD Library Functions Manual		 GETDEVPATH(3)

NAME
     getdevpath — retrieve device path given name or label

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <sys/types.h>
     #include <fstab.h>

     char *
     getdevpath(const char *devname, int flags);

DESCRIPTION
     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 modify
     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.

RETURN VALUES
     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.

SEE ALSO
     devfs(5), devtab(5), fstab(5)

HISTORY
     The getdevpath function appeared in DragonFly 2.3.

BSD				 July 10, 2009				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net