2 .\" Copyright (c) 2009 The DragonFly Project. All rights reserved.
4 .\" This code is derived from software contributed to The DragonFly Project
5 .\" by Matthew Dillon <dillon@backplane.com>
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in
15 .\" the documentation and/or other materials provided with the
17 .\" 3. Neither the name of The DragonFly Project nor the names of its
18 .\" contributors may be used to endorse or promote products derived
19 .\" from this software without specific, prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 .Nd retrieve device path given name or label
46 .Fn getdevpath "const char *devname" "int flags"
49 takes a device name such as
51 a device identifier such as
53 a device path beginning with
57 or a device label from one of the
59 files, and returns an allocated path which may be used to open the device.
61 Device names prefixed with
65 are assumed to be device paths and an exact allocated copy is simply returned.
66 However, flags may modify the operation.
68 Device names specified with a type prefix, such as
70 are assumed to be typed device identifiers and are directly translated to
71 the appropriate path in
74 .Dq Pa /dev/serno/V21JYQ0G .
76 Device labels are directly checked against
80 and if not found will be searched for in one of the
84 The following flags may be passed to
86 .Bl -tag -width ".Dv GETDEVPATH_RAWDEV" -offset indent
87 .It Dv GETDEVPATH_RAWDEV
90 returns a high level devfs path which often winds up being a softlink in
92 If this flag is specified and the device path represents a softlink,
96 and return the actual raw device path instead.
97 If the device path cannot be
99 this option will return
104 returns a pointer to a
111 will be set appropriately.
115 path may be returned even if it does not exist in the filesystem.
116 Callers should not assume that the device is accessible
117 unless they can also open the device.