]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/systemd/sd-device.h
libsystemd: add sd-device library
[thirdparty/systemd.git] / src / systemd / sd-device.h
CommitLineData
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>
10 Copyright 2014 Tom Gundersen <teg@jklm.no>
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>
27#include <stdint.h>
28
29#include "_sd-common.h"
30
31_SD_BEGIN_DECLARATIONS;
32
33typedef struct sd_device sd_device;
34
35sd_device *sd_device_ref(sd_device *device);
36sd_device *sd_device_unref(sd_device *device);
37
38int sd_device_new_from_syspath(sd_device **ret, const char *syspath);
39int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum);
40int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname);
41int sd_device_new_from_device_id(sd_device **ret, const char *id);
42
43int sd_device_get_parent(sd_device *child, sd_device **ret);
44int sd_device_get_parent_with_subsystem_devtype(sd_device *child, const char *subsystem, const char *devtype, sd_device **ret);
45
46int sd_device_get_syspath(sd_device *device, const char **ret);
47int sd_device_get_subsystem(sd_device *device, const char **ret);
48int sd_device_get_devtype(sd_device *device, const char **ret);
49int sd_device_get_devnum(sd_device *device, dev_t *devnum);
50int sd_device_get_ifindex(sd_device *device, int *ifindex);
51int sd_device_get_driver(sd_device *device, const char **ret);
52int sd_device_get_devpath(sd_device *device, const char **ret);
53int sd_device_get_devname(sd_device *device, const char **ret);
54int sd_device_get_sysname(sd_device *device, const char **ret);
55int sd_device_get_sysnum(sd_device *device, const char **ret);
56
57int sd_device_get_is_initialized(sd_device *device, int *initialized);
58int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *usec);
59
60const char *sd_device_get_tag_first(sd_device *device);
61const char *sd_device_get_tag_next(sd_device *device);
62const char *sd_device_get_devlink_first(sd_device *device);
63const char *sd_device_get_devlink_next(sd_device *device);
64const char *sd_device_get_property_first(sd_device *device, const char **value);
65const char *sd_device_get_property_next(sd_device *device, const char **value);
66const char *sd_device_get_sysattr_first(sd_device *device);
67const char *sd_device_get_sysattr_next(sd_device *device);
68
69int sd_device_has_tag(sd_device *device, const char *tag);
70int sd_device_get_property_value(sd_device *device, const char *key, const char **value);
71int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, const char **_value);
72
73int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, char *value);
74
75_SD_END_DECLARATIONS;
76
77#endif