]>
Commit | Line | Data |
---|---|---|
57fa1d09 TG |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #ifndef foosddevicehfoo | |
4 | #define foosddevicehfoo | |
5 | ||
6 | /*** | |
7 | This file is part of systemd. | |
8 | ||
9 | Copyright 2008-2012 Kay Sievers <kay@vrfy.org> | |
96df036f | 10 | Copyright 2014-2015 Tom Gundersen <teg@jklm.no> |
57fa1d09 TG |
11 | |
12 | systemd is free software; you can redistribute it and/or modify it | |
13 | under the terms of the GNU Lesser General Public License as published by | |
14 | the Free Software Foundation; either version 2.1 of the License, or | |
15 | (at your option) any later version. | |
16 | ||
17 | systemd is distributed in the hope that it will be useful, but | |
18 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 | Lesser General Public License for more details. | |
21 | ||
22 | You should have received a copy of the GNU Lesser General Public License | |
23 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
24 | ***/ | |
25 | ||
26 | #include <sys/types.h> | |
04c01369 | 27 | #include <inttypes.h> |
57fa1d09 TG |
28 | |
29 | #include "_sd-common.h" | |
30 | ||
31 | _SD_BEGIN_DECLARATIONS; | |
32 | ||
33 | typedef struct sd_device sd_device; | |
96df036f TG |
34 | typedef struct sd_device_enumerator sd_device_enumerator; |
35 | ||
36 | /* device */ | |
57fa1d09 TG |
37 | |
38 | sd_device *sd_device_ref(sd_device *device); | |
39 | sd_device *sd_device_unref(sd_device *device); | |
40 | ||
41 | int sd_device_new_from_syspath(sd_device **ret, const char *syspath); | |
42 | int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum); | |
43 | int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname); | |
44 | int sd_device_new_from_device_id(sd_device **ret, const char *id); | |
45 | ||
46 | int sd_device_get_parent(sd_device *child, sd_device **ret); | |
47 | int sd_device_get_parent_with_subsystem_devtype(sd_device *child, const char *subsystem, const char *devtype, sd_device **ret); | |
48 | ||
49 | int sd_device_get_syspath(sd_device *device, const char **ret); | |
50 | int sd_device_get_subsystem(sd_device *device, const char **ret); | |
51 | int sd_device_get_devtype(sd_device *device, const char **ret); | |
52 | int sd_device_get_devnum(sd_device *device, dev_t *devnum); | |
53 | int sd_device_get_ifindex(sd_device *device, int *ifindex); | |
54 | int sd_device_get_driver(sd_device *device, const char **ret); | |
55 | int sd_device_get_devpath(sd_device *device, const char **ret); | |
56 | int sd_device_get_devname(sd_device *device, const char **ret); | |
57 | int sd_device_get_sysname(sd_device *device, const char **ret); | |
58 | int sd_device_get_sysnum(sd_device *device, const char **ret); | |
59 | ||
60 | int sd_device_get_is_initialized(sd_device *device, int *initialized); | |
61 | int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *usec); | |
62 | ||
63 | const char *sd_device_get_tag_first(sd_device *device); | |
64 | const char *sd_device_get_tag_next(sd_device *device); | |
65 | const char *sd_device_get_devlink_first(sd_device *device); | |
66 | const char *sd_device_get_devlink_next(sd_device *device); | |
67 | const char *sd_device_get_property_first(sd_device *device, const char **value); | |
68 | const char *sd_device_get_property_next(sd_device *device, const char **value); | |
69 | const char *sd_device_get_sysattr_first(sd_device *device); | |
70 | const char *sd_device_get_sysattr_next(sd_device *device); | |
71 | ||
72 | int sd_device_has_tag(sd_device *device, const char *tag); | |
73 | int sd_device_get_property_value(sd_device *device, const char *key, const char **value); | |
74 | int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, const char **_value); | |
75 | ||
76 | int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, char *value); | |
77 | ||
96df036f TG |
78 | /* device enumerator */ |
79 | ||
80 | int sd_device_enumerator_new(sd_device_enumerator **ret); | |
81 | sd_device_enumerator *sd_device_enumerator_ref(sd_device_enumerator *enumerator); | |
82 | sd_device_enumerator *sd_device_enumerator_unref(sd_device_enumerator *enumerator); | |
83 | ||
96df036f TG |
84 | sd_device *sd_device_enumerator_get_device_first(sd_device_enumerator *enumerator); |
85 | sd_device *sd_device_enumerator_get_device_next(sd_device_enumerator *enumerator); | |
86 | sd_device *sd_device_enumerator_get_subsystem_first(sd_device_enumerator *enumerator); | |
87 | sd_device *sd_device_enumerator_get_subsystem_next(sd_device_enumerator *enumerator); | |
88 | ||
89 | int sd_device_enumerator_add_match_subsystem(sd_device_enumerator *enumerator, const char *subsystem, int match); | |
90 | int sd_device_enumerator_add_match_sysattr(sd_device_enumerator *enumerator, const char *sysattr, const char *value, int match); | |
91 | int sd_device_enumerator_add_match_property(sd_device_enumerator *enumerator, const char *property, const char *value); | |
92 | int sd_device_enumerator_add_match_sysname(sd_device_enumerator *enumerator, const char *sysname); | |
93 | int sd_device_enumerator_add_match_tag(sd_device_enumerator *enumerator, const char *tag); | |
94 | int sd_device_enumerator_add_match_parent(sd_device_enumerator *enumerator, sd_device *parent); | |
dee5e0b6 | 95 | int sd_device_enumerator_allow_uninitialized(sd_device_enumerator *enumerator); |
96df036f | 96 | |
57fa1d09 TG |
97 | _SD_END_DECLARATIONS; |
98 | ||
99 | #endif |