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 #include "device/udev_linux/udev0_loader.h"
7 #include "library_loaders/libudev0.h"
11 Udev0Loader::Udev0Loader() {
14 Udev0Loader::~Udev0Loader() {
17 bool Udev0Loader::Init() {
19 return lib_loader_
->loaded();
20 lib_loader_
.reset(new LibUdev0Loader
);
21 return lib_loader_
->Load("libudev.so.0");
24 const char* Udev0Loader::udev_device_get_action(udev_device
* udev_device
) {
25 return lib_loader_
->udev_device_get_action(udev_device
);
28 const char* Udev0Loader::udev_device_get_devnode(udev_device
* udev_device
) {
29 return lib_loader_
->udev_device_get_devnode(udev_device
);
32 udev_device
* Udev0Loader::udev_device_get_parent(udev_device
* udev_device
) {
33 return lib_loader_
->udev_device_get_parent(udev_device
);
36 udev_device
* Udev0Loader::udev_device_get_parent_with_subsystem_devtype(
37 udev_device
* udev_device
,
38 const char* subsystem
,
39 const char* devtype
) {
40 return lib_loader_
->udev_device_get_parent_with_subsystem_devtype(
41 udev_device
, subsystem
, devtype
);
44 const char* Udev0Loader::udev_device_get_property_value(
45 udev_device
* udev_device
,
47 return lib_loader_
->udev_device_get_property_value(udev_device
, key
);
50 const char* Udev0Loader::udev_device_get_subsystem(udev_device
* udev_device
) {
51 return lib_loader_
->udev_device_get_subsystem(udev_device
);
54 const char* Udev0Loader::udev_device_get_sysattr_value(udev_device
* udev_device
,
55 const char* sysattr
) {
56 return lib_loader_
->udev_device_get_sysattr_value(udev_device
, sysattr
);
59 const char* Udev0Loader::udev_device_get_sysname(udev_device
* udev_device
) {
60 return lib_loader_
->udev_device_get_sysname(udev_device
);
63 const char* Udev0Loader::udev_device_get_syspath(udev_device
* udev_device
) {
64 return lib_loader_
->udev_device_get_syspath(udev_device
);
67 udev_device
* Udev0Loader::udev_device_new_from_devnum(udev
* udev
,
70 return lib_loader_
->udev_device_new_from_devnum(udev
, type
, devnum
);
73 udev_device
* Udev0Loader::udev_device_new_from_syspath(udev
* udev
,
74 const char* syspath
) {
75 return lib_loader_
->udev_device_new_from_syspath(udev
, syspath
);
78 void Udev0Loader::udev_device_unref(udev_device
* udev_device
) {
79 lib_loader_
->udev_device_unref(udev_device
);
82 int Udev0Loader::udev_enumerate_add_match_subsystem(
83 udev_enumerate
* udev_enumerate
,
84 const char* subsystem
) {
85 return lib_loader_
->udev_enumerate_add_match_subsystem(udev_enumerate
,
89 udev_list_entry
* Udev0Loader::udev_enumerate_get_list_entry(
90 udev_enumerate
* udev_enumerate
) {
91 return lib_loader_
->udev_enumerate_get_list_entry(udev_enumerate
);
94 udev_enumerate
* Udev0Loader::udev_enumerate_new(udev
* udev
) {
95 return lib_loader_
->udev_enumerate_new(udev
);
98 int Udev0Loader::udev_enumerate_scan_devices(udev_enumerate
* udev_enumerate
) {
99 return lib_loader_
->udev_enumerate_scan_devices(udev_enumerate
);
102 void Udev0Loader::udev_enumerate_unref(udev_enumerate
* udev_enumerate
) {
103 lib_loader_
->udev_enumerate_unref(udev_enumerate
);
106 udev_list_entry
* Udev0Loader::udev_list_entry_get_next(
107 udev_list_entry
* list_entry
) {
108 return lib_loader_
->udev_list_entry_get_next(list_entry
);
111 const char* Udev0Loader::udev_list_entry_get_name(udev_list_entry
* list_entry
) {
112 return lib_loader_
->udev_list_entry_get_name(list_entry
);
115 int Udev0Loader::udev_monitor_enable_receiving(udev_monitor
* udev_monitor
) {
116 return lib_loader_
->udev_monitor_enable_receiving(udev_monitor
);
119 int Udev0Loader::udev_monitor_filter_add_match_subsystem_devtype(
120 udev_monitor
* udev_monitor
,
121 const char* subsystem
,
122 const char* devtype
) {
123 return lib_loader_
->udev_monitor_filter_add_match_subsystem_devtype(
124 udev_monitor
, subsystem
, devtype
);
127 int Udev0Loader::udev_monitor_get_fd(udev_monitor
* udev_monitor
) {
128 return lib_loader_
->udev_monitor_get_fd(udev_monitor
);
131 udev_monitor
* Udev0Loader::udev_monitor_new_from_netlink(udev
* udev
,
133 return lib_loader_
->udev_monitor_new_from_netlink(udev
, name
);
136 udev_device
* Udev0Loader::udev_monitor_receive_device(
137 udev_monitor
* udev_monitor
) {
138 return lib_loader_
->udev_monitor_receive_device(udev_monitor
);
141 void Udev0Loader::udev_monitor_unref(udev_monitor
* udev_monitor
) {
142 lib_loader_
->udev_monitor_unref(udev_monitor
);
145 udev
* Udev0Loader::udev_new() {
146 return lib_loader_
->udev_new();
149 void Udev0Loader::udev_set_log_fn(
151 void (*log_fn
)(struct udev
* udev
, int priority
,
152 const char* file
, int line
,
153 const char* fn
, const char* format
, va_list args
)) {
154 return lib_loader_
->udev_set_log_fn(udev
, log_fn
);
157 void Udev0Loader::udev_set_log_priority(struct udev
* udev
, int priority
) {
158 return lib_loader_
->udev_set_log_priority(udev
, priority
);
161 void Udev0Loader::udev_unref(udev
* udev
) {
162 lib_loader_
->udev_unref(udev
);
165 } // namespace device