Debian Codegraph @

upstream/debian-unstable/man3/sd_device_enumerator_get_device_first.3

raw
1 '\" t
2 .TH "SD_DEVICE_ENUMERATOR_GET_DEVICE_FIRST" "3" "" "systemd 261~rc3" "sd_device_enumerator_get_device_first"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_device_enumerator_get_device_first, sd_device_enumerator_get_device_next, sd_device_enumerator_get_subsystem_first, sd_device_enumerator_get_subsystem_next \- Enumerates devices and get the first or next device\&.
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-device\&.h>
29 .fi
30 .ft
31 .HP \w'sd_device\ *sd_device_enumerator_get_device_first('u
32 .BI "sd_device *sd_device_enumerator_get_device_first(sd_device_enumerator\ *" "enumerator" ");"
33 .HP \w'sd_device\ *sd_device_enumerator_get_device_next('u
34 .BI "sd_device *sd_device_enumerator_get_device_next(sd_device_enumerator\ *" "enumerator" ");"
35 .HP \w'sd_device\ *sd_device_enumerator_get_subsystem_first('u
36 .BI "sd_device *sd_device_enumerator_get_subsystem_first(sd_device_enumerator\ *" "enumerator" ");"
37 .HP \w'sd_device\ *sd_device_enumerator_get_subsystem_next('u
38 .BI "sd_device *sd_device_enumerator_get_subsystem_next(sd_device_enumerator\ *" "enumerator" ");"
39 .SH "DESCRIPTION"
40 .PP
41 The
42 \fBsd_device_enumerator_get_device_first()\fR
43 function enumerates all matching devices under
44 /sys/bus/\fISUBSYSTEM\fR/devices/
45 and
46 /sys/class/\fISUBSYSTEM\fR/devices/, and returns a pointer to the first
47 \fBsd_device\fR
48 object\&. If no devices are found,
49 \fBNULL\fR
50 is returned\&.
51 .PP
52 The
53 \fBsd_device_enumerator_get_device_next()\fR
54 function returns the pointer to the next
55 \fBsd_device\fR
56 from the
57 \fIenumerator\fR\&. It should be called after
58 \fBsd_device_enumerator_get_device_first()\fR
59 or after a previous call to this function\&. If no more devices are available,
60 \fBNULL\fR
61 is returned\&.
62 .PP
63 The
64 \fBsd_device_enumerator_get_subsystem_first()\fR
65 function enumerates all matching subsystem devices in
66 /sys/module/,
67 /sys/bus/, and
68 /sys/bus/\fISUBSYSTEM\fR/drivers/
69 (such as
70 /sys/bus/pci/drivers/)\&. It returns a pointer to the first
71 \fBsd_device\fR
72 object\&. If no devices are found
73 \fBNULL\fR
74 is returned\&. Note that this does
75 \fInot\fR
76 enumerate devices provided by
77 \fBsd_device_enumerator_get_device_first/next()\fR\&. Hence, e\&.g\&.
78 /sys/bus/pci/,
79 /sys/bus/pci/drivers/ahci/
80 and so on are enumerated, but
81 /sys/bus/pci/devices/0000:00:00\&.0/
82 and so on are not\&.
83 .PP
84 The
85 \fBsd_device_enumerator_get_subsystem_next()\fR
86 function returns the next subsystem device from the enumerator\&. It should be called after
87 \fBsd_device_enumerator_get_subsystem_first()\fR
88 or after a previous call to this function\&. If no more subsystem devices are available,
89 \fBNULL\fR
90 is returned\&.
91 .SH "RETURN VALUE"
92 .PP
93 On success, these functions return a pointer to an
94 \fBsd_device\fR
95 object\&. On failure or when no more devices are available,
96 \fBNULL\fR
97 is returned\&. The returned pointers are owned by the enumerator and should not be freed by the caller\&.
98 .SH "HISTORY"
99 .PP
100 \fBsd_device_enumerator_get_device_first()\fR,
101 \fBsd_device_enumerator_get_device_next()\fR,
102 \fBsd_device_enumerator_get_subsystem_first()\fR, and
103 \fBsd_device_enumerator_get_subsystem_next()\fR
104 were introduced in systemd version 240\&.
105 .SH "SEE ALSO"
106 .PP
107 \fBsd_device_enumerator_new\fR(3), \fBsd_device_enumerator_add_match_parent\fR(3), \fBsd_device_ref\fR(3)