From: Shubhendra Kushwaha Date: Sun, 25 May 2025 15:17:31 +0000 (+0530) Subject: docs: add man page for sd_device_enumerator_get_device_first() and friends X-Git-Tag: v258-rc1~438 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2948f981dd0fd1ad777ea422bc1652ced748accf;p=thirdparty%2Fsystemd.git docs: add man page for sd_device_enumerator_get_device_first() and friends For #20929. --- diff --git a/man/rules/meson.build b/man/rules/meson.build index 1ce5238a3dc..7f64f285963 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -536,6 +536,12 @@ manpages = [ 'sd_device_enumerator_add_nomatch_sysname', 'sd_device_enumerator_allow_uninitialized'], ''], + ['sd_device_enumerator_get_device_first', + '3', + ['sd_device_enumerator_get_device_next', + 'sd_device_enumerator_get_subsystem_first', + 'sd_device_enumerator_get_subsystem_next'], + ''], ['sd_device_enumerator_new', '3', ['sd_device_enumerator_ref', diff --git a/man/sd_device_enumerator_get_device_first.xml b/man/sd_device_enumerator_get_device_first.xml new file mode 100644 index 00000000000..c5e34d8988e --- /dev/null +++ b/man/sd_device_enumerator_get_device_first.xml @@ -0,0 +1,108 @@ + + + + + + + + sd_device_enumerator_get_device_first + systemd + + + + sd_device_enumerator_get_device_first + 3 + + + + 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. + + + + + #include <systemd/sd-device.h> + + + sd_device *sd_device_enumerator_get_device_first + sd_device_enumerator *enumerator + + + + sd_device *sd_device_enumerator_get_device_next + sd_device_enumerator *enumerator + + + + sd_device *sd_device_enumerator_get_subsystem_first + sd_device_enumerator *enumerator + + + + sd_device *sd_device_enumerator_get_subsystem_next + sd_device_enumerator *enumerator + + + + + + Description + The sd_device_enumerator_get_device_first() function enumerates all + matching devices under /sys/bus/SUBSYSTEM/devices/ + and /sys/class/SUBSYSTEM/devices/, + and returns a pointer to the first sd_device object. If no devices are found, + NULL is returned. + + The sd_device_enumerator_get_device_next() function returns the pointer + to the next sd_device from the enumerator. It should + be called after sd_device_enumerator_get_device_first() or after a previous + call to this function. If no more devices are available, NULL is returned. + + The sd_device_enumerator_get_subsystem_first() function enumerates all + matching subsystem devices in /sys/module/, /sys/bus/, + and /sys/bus/SUBSYSTEM/drivers/ + (such as /sys/bus/pci/drivers/). It returns a pointer to the first + sd_device object. If no devices are found NULL is returned. + Note that this does not enumerate devices provided by + sd_device_enumerator_get_device_first/next(). Hence, e.g. + /sys/bus/pci/, /sys/bus/pci/drivers/ahci/ and so on are + enumerated, but /sys/bus/pci/devices/0000:00:00.0/ and so on are not. + + The sd_device_enumerator_get_subsystem_next() function returns the next + subsystem device from the enumerator. It should be called after + sd_device_enumerator_get_subsystem_first() or after a previous call to this + function. If no more subsystem devices are available, NULL is returned. + + + + Return Value + On success, these functions return a pointer to an sd_device object. + On failure or when no more devices are available, NULL is returned. The + returned pointers are owned by the enumerator and should not be freed by the caller. + + + + History + sd_device_enumerator_get_device_first(), + sd_device_enumerator_get_device_next(), + sd_device_enumerator_get_subsystem_first(), and + sd_device_enumerator_get_subsystem_next() were introduced in systemd version + 240. + + + + See Also + + + sd_device_enumerator_new3 + sd_device_enumerator_add_match_parent3 + sd_device_ref3 + + + +