1ldi_get_dev(9F) Kernel Functions for Drivers ldi_get_dev(9F)
2
3
4
6 ldi_get_dev, ldi_get_otyp, ldi_get_devid, ldi_get_minor_name - Extract
7 information from a layered handle
8
10 #include <sys/sunldi.h>
11
12 int ldi_get_dev(ldi_handle_t lh, dev_t *devp);
13
14
15 int ldi_get_otyp(ldi_handle_t lh, int *otyp);
16
17
18 int ldi_get_devid(ldi_handle_t lh, ddi_devid_t *devid);
19
20
21 int ldi_get_minor_name(ldi_handle_t lh, char **minor_name);
22
23
25 lh Layered handle
26
27
28 otyp Indicates on which interface the driver was opened.
29 Valid settings are:
30
31 OTYP_BLK Open device block interface.
32
33
34 OTYP_CHR Open device character interface.
35
36
37
38 devp Pointer to a device number.
39
40
41 devid Device ID.
42
43
44 minor_name Minor device node name.
45
46
48 The ldi_get_dev() function retrieves the dev_t associated with a lay‐
49 ered handle.
50
51
52 The ldi_get_otyp() retrieves the open flag that was used to open the
53 device associated with the layered handle.
54
55
56 The ldi_get_devid() function retrieves a devid for the device associ‐
57 ated with the layered handle. The caller should use ddi_devid_free()
58 to free the devid when done with it.
59
60
61 The ldi_get_minor_name() function retrieves the name of the minor node
62 opened for the device associated with the layered handle.
63 ldi_get_minor_name() allocates a buffer containing the minor node name
64 and returns it via the minor_name parameter. The caller should use
65 kmem_free() to release the buffer when done with it.
66
68 The ldi_get_dev(), ldi_get_otyp(), ldi_get_devid(), and ldi_get_devid()
69 functions return 0 upon success.
70
71
72 In case of an error, the following values may be returned:
73
74 EINVAL Invalid input parameters.
75
76
77 ENOTSUP The operation is not supported for this device.
78
79
81 These functions may be called from user or kernel context.
82
83
84
85SunOS 5.11 3 June 2003 ldi_get_dev(9F)