]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd/sd-device/device-util.h
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / libsystemd / sd-device / device-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
57fa1d09
TG
2#pragma once
3
4/***
96b2fb93 5 Copyright © 2014-2015 Tom Gundersen <teg@jklm.no>
57fa1d09
TG
6***/
7
8#include "util.h"
9
57fa1d09
TG
10#define FOREACH_DEVICE_PROPERTY(device, key, value) \
11 for (key = sd_device_get_property_first(device, &(value)); \
12 key; \
13 key = sd_device_get_property_next(device, &(value)))
14
15#define FOREACH_DEVICE_TAG(device, tag) \
16 for (tag = sd_device_get_tag_first(device); \
17 tag; \
18 tag = sd_device_get_tag_next(device))
19
20#define FOREACH_DEVICE_SYSATTR(device, attr) \
21 for (attr = sd_device_get_sysattr_first(device); \
22 attr; \
23 attr = sd_device_get_sysattr_next(device))
24
25#define FOREACH_DEVICE_DEVLINK(device, devlink) \
26 for (devlink = sd_device_get_devlink_first(device); \
27 devlink; \
28 devlink = sd_device_get_devlink_next(device))
96df036f
TG
29
30#define FOREACH_DEVICE(enumerator, device) \
31 for (device = sd_device_enumerator_get_device_first(enumerator); \
32 device; \
33 device = sd_device_enumerator_get_device_next(enumerator))
34
35#define FOREACH_SUBSYSTEM(enumerator, device) \
36 for (device = sd_device_enumerator_get_subsystem_first(enumerator); \
37 device; \
38 device = sd_device_enumerator_get_subsystem_next(enumerator))