1di_devlink_init(3DEVINDFeOv)ice Information Library Functidoin_sdevlink_init(3DEVINFO)
2
3
4

NAME

6       di_devlink_init,  di_devlink_fini  -  create  and destroy a snapshot of
7       devlinks
8

SYNOPSIS

10       cc [ flag... ] file... -ldevinfo [ library... ]
11       #include <libdevinfo.h>
12
13       di_devlink_handle_t di_devlink_init(const char *name,
14            uint_t flags);
15
16
17       int di_devlink_fini(di_devlink_handle_t *hdlp);
18
19

PARAMETERS

21       flags    The following values are supported:
22
23                DI_MAKE_LINK    Synchronize  with  devlink  management  before
24                                taking  the snapshot. The name argument deter‐
25                                mines which devlink management activities must
26                                complete  before  taking  a  devlink snapshot.
27                                Appropriate privileges  are  required  to  use
28                                this flag.
29
30
31
32       name     If  flags  is DI_MAKE_LINK, name determines which devlink man‐
33                agement activity must complete prior to snapshot.
34
35                    o      If name is NULL then all devlink management activi‐
36                           ties  must  complete. The devlink snapshot returned
37                           accurately reflects the entire kernel device tree.
38
39                    o      If name is a driver name, devlink management activ‐
40                           ities  associated  with  nodes bound to that driver
41                           must complete.
42
43                    o      If name is a path to a node in  the  kernel  device
44                           tree  (no  "/devices"  prefix),  devlink management
45                           activities below node must complete.
46
47                    o      If name is a path to a minor  node  in  the  kernel
48                           device  tree (no "/devices"prefix), devlink manage‐
49                           ment activities on that minor node must complete.
50
51
52       hdlp     The   handle   to   the   snapshot   obtained    by    calling
53                di_devlink_init().
54
55

DESCRIPTION

57       System management applications often need to map a "/devices" path to a
58       minor node to a public "/dev" device name. The di_devlink_*() functions
59       provide an efficient way to accomplish this.
60
61
62       The di_devlink_init() function takes a snapshot of devlinks and returns
63       a handle to this snapshot.
64
65
66       The di_devlink_fini() function destroys the devlink snapshot and  frees
67       the associated memory.
68

RETURN VALUES

70       Upon  successful  completion,  di_devlink_init()  returns a handle to a
71       devlink snapshot. Otherwise, DI_LINK_NIL is returned and errno  is  set
72       to indicate the error.
73
74
75       Upon  successful completion, di_devlink_fini() returns 0. Otherwise, -1
76       is returned and errno is set to indicate the error.
77

ERRORS

79       The di_devlink_init() function will fail if:
80
81       EINVAL    One or more arguments is invalid.
82
83
84
85       The di_devlink_init() function with DI_MAKE_LINK can also fail if:
86
87       EPERM    The user does no have appropriate privileges.
88
89
90
91       The di_devlink_init() function can set errno to any  error  value  that
92       can also be set by malloc(3C), open(2), ioctl(2), or mmap(2).
93

ATTRIBUTES

95       See attributes(5)  for descriptions of the following attributes:
96
97
98
99
100       ┌─────────────────────────────┬─────────────────────────────┐
101       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
102       ├─────────────────────────────┼─────────────────────────────┤
103       │Interface Stability          │Committed                    │
104       ├─────────────────────────────┼─────────────────────────────┤
105       │MT-Level                     │Safe                         │
106       └─────────────────────────────┴─────────────────────────────┘
107

SEE ALSO

109       ioctl(2),       mmap(2),       open(2),      di_devlink_path(3DEVINFO),
110       di_devlink_walk(3DEVINFO), libdevinfo(3LIB), malloc(3C), attributes(5)
111
112
113
114SunOS 5.11                        21 Jul 2008        di_devlink_init(3DEVINFO)
Impressum