Fix 'gn clean'.
[chromium-blink-merge.git] / device / udev_linux / udev.h
blobd58960d5dfc36cf1abf15ac8007b71ee379253b4
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DEVICE_UDEV_LINUX_UDEV_H_
6 #define DEVICE_UDEV_LINUX_UDEV_H_
8 #include <stdarg.h>
9 #include <sys/types.h>
10 #include <sys/stat.h>
12 #if !defined(USE_UDEV)
13 #error "USE_UDEV not defined"
14 #endif
16 // Adapted from libudev.h.
17 #define udev_list_entry_foreach(list_entry, first_entry) \
18 for (list_entry = first_entry; list_entry != NULL; \
19 list_entry = ::device::udev_list_entry_get_next(list_entry))
21 // Forward declarations of opaque structs.
22 struct udev;
23 struct udev_device;
24 struct udev_enumerate;
25 struct udev_list_entry;
26 struct udev_monitor;
28 namespace device {
30 const char* udev_device_get_action(udev_device* udev_device);
31 const char* udev_device_get_devnode(udev_device* udev_device);
32 udev_device* udev_device_get_parent(udev_device* udev_device);
33 udev_device* udev_device_get_parent_with_subsystem_devtype(
34 udev_device* udev_device,
35 const char* subsystem,
36 const char* devtype);
37 const char* udev_device_get_property_value(udev_device* udev_device,
38 const char* key);
39 const char* udev_device_get_subsystem(udev_device* udev_device);
40 const char* udev_device_get_sysattr_value(udev_device* udev_device,
41 const char* sysattr);
42 const char* udev_device_get_sysname(udev_device* udev_device);
43 const char* udev_device_get_syspath(udev_device* udev_device);
44 udev_device* udev_device_new_from_devnum(udev* udev, char type, dev_t devnum);
45 udev_device* udev_device_new_from_syspath(udev* udev, const char* syspath);
46 void udev_device_unref(udev_device* udev_device);
47 int udev_enumerate_add_match_subsystem(udev_enumerate* udev_enumerate,
48 const char* subsystem);
49 udev_list_entry* udev_enumerate_get_list_entry(udev_enumerate* udev_enumerate);
50 udev_enumerate* udev_enumerate_new(udev* udev);
51 int udev_enumerate_scan_devices(udev_enumerate* udev_enumerate);
52 void udev_enumerate_unref(udev_enumerate* udev_enumerate);
53 udev_list_entry* udev_list_entry_get_next(udev_list_entry* list_entry);
54 const char* udev_list_entry_get_name(udev_list_entry* list_entry);
55 int udev_monitor_enable_receiving(udev_monitor* udev_monitor);
56 int udev_monitor_filter_add_match_subsystem_devtype(udev_monitor* udev_monitor,
57 const char* subsystem,
58 const char* devtype);
59 int udev_monitor_get_fd(udev_monitor* udev_monitor);
60 udev_monitor* udev_monitor_new_from_netlink(udev* udev, const char* name);
61 udev_device* udev_monitor_receive_device(udev_monitor* udev_monitor);
62 void udev_monitor_unref(udev_monitor* udev_monitor);
63 udev* udev_new();
64 void udev_set_log_fn(
65 struct udev* udev,
66 void (*log_fn)(struct udev* udev, int priority, const char* file, int line,
67 const char* fn, const char* format, va_list args));
68 void udev_set_log_priority(struct udev* udev, int priority);
69 void udev_unref(udev* udev);
71 } // namespace device
73 #endif // DEVICE_UDEV_LINUX_UDEV_H_