Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / device / udev_linux / udev1_loader.cc
blob34c2848e5b778561b048b96bbf3c5ab5e1f8665c
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/udev1_loader.h"
7 #include "library_loaders/libudev1.h"
9 namespace device {
11 Udev1Loader::Udev1Loader() {
14 Udev1Loader::~Udev1Loader() {
17 bool Udev1Loader::Init() {
18 if (lib_loader_)
19 return lib_loader_->loaded();
20 lib_loader_.reset(new LibUdev1Loader);
21 return lib_loader_->Load("libudev.so.1");
24 const char* Udev1Loader::udev_device_get_action(udev_device* udev_device) {
25 return lib_loader_->udev_device_get_action(udev_device);
28 const char* Udev1Loader::udev_device_get_devnode(udev_device* udev_device) {
29 return lib_loader_->udev_device_get_devnode(udev_device);
32 udev_device* Udev1Loader::udev_device_get_parent(udev_device* udev_device) {
33 return lib_loader_->udev_device_get_parent(udev_device);
36 udev_device* Udev1Loader::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* Udev1Loader::udev_device_get_property_value(
45 udev_device* udev_device,
46 const char* key) {
47 return lib_loader_->udev_device_get_property_value(udev_device, key);
50 const char* Udev1Loader::udev_device_get_subsystem(udev_device* udev_device) {
51 return lib_loader_->udev_device_get_subsystem(udev_device);
54 const char* Udev1Loader::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* Udev1Loader::udev_device_get_sysname(udev_device* udev_device) {
60 return lib_loader_->udev_device_get_sysname(udev_device);
63 const char* Udev1Loader::udev_device_get_syspath(udev_device* udev_device) {
64 return lib_loader_->udev_device_get_syspath(udev_device);
67 udev_device* Udev1Loader::udev_device_new_from_devnum(udev* udev,
68 char type,
69 dev_t devnum) {
70 return lib_loader_->udev_device_new_from_devnum(udev, type, devnum);
73 udev_device* Udev1Loader::udev_device_new_from_subsystem_sysname(
74 udev* udev,
75 const char* subsystem,
76 const char* sysname) {
77 return lib_loader_->udev_device_new_from_subsystem_sysname(
78 udev, subsystem, sysname);
81 udev_device* Udev1Loader::udev_device_new_from_syspath(udev* udev,
82 const char* syspath) {
83 return lib_loader_->udev_device_new_from_syspath(udev, syspath);
86 void Udev1Loader::udev_device_unref(udev_device* udev_device) {
87 lib_loader_->udev_device_unref(udev_device);
90 int Udev1Loader::udev_enumerate_add_match_subsystem(
91 udev_enumerate* udev_enumerate,
92 const char* subsystem) {
93 return lib_loader_->udev_enumerate_add_match_subsystem(udev_enumerate,
94 subsystem);
97 udev_list_entry* Udev1Loader::udev_enumerate_get_list_entry(
98 udev_enumerate* udev_enumerate) {
99 return lib_loader_->udev_enumerate_get_list_entry(udev_enumerate);
102 udev_enumerate* Udev1Loader::udev_enumerate_new(udev* udev) {
103 return lib_loader_->udev_enumerate_new(udev);
106 int Udev1Loader::udev_enumerate_scan_devices(udev_enumerate* udev_enumerate) {
107 return lib_loader_->udev_enumerate_scan_devices(udev_enumerate);
110 void Udev1Loader::udev_enumerate_unref(udev_enumerate* udev_enumerate) {
111 lib_loader_->udev_enumerate_unref(udev_enumerate);
114 udev_list_entry* Udev1Loader::udev_list_entry_get_next(
115 udev_list_entry* list_entry) {
116 return lib_loader_->udev_list_entry_get_next(list_entry);
119 const char* Udev1Loader::udev_list_entry_get_name(udev_list_entry* list_entry) {
120 return lib_loader_->udev_list_entry_get_name(list_entry);
123 int Udev1Loader::udev_monitor_enable_receiving(udev_monitor* udev_monitor) {
124 return lib_loader_->udev_monitor_enable_receiving(udev_monitor);
127 int Udev1Loader::udev_monitor_filter_add_match_subsystem_devtype(
128 udev_monitor* udev_monitor,
129 const char* subsystem,
130 const char* devtype) {
131 return lib_loader_->udev_monitor_filter_add_match_subsystem_devtype(
132 udev_monitor, subsystem, devtype);
135 int Udev1Loader::udev_monitor_get_fd(udev_monitor* udev_monitor) {
136 return lib_loader_->udev_monitor_get_fd(udev_monitor);
139 udev_monitor* Udev1Loader::udev_monitor_new_from_netlink(udev* udev,
140 const char* name) {
141 return lib_loader_->udev_monitor_new_from_netlink(udev, name);
144 udev_device* Udev1Loader::udev_monitor_receive_device(
145 udev_monitor* udev_monitor) {
146 return lib_loader_->udev_monitor_receive_device(udev_monitor);
149 void Udev1Loader::udev_monitor_unref(udev_monitor* udev_monitor) {
150 lib_loader_->udev_monitor_unref(udev_monitor);
153 udev* Udev1Loader::udev_new() {
154 return lib_loader_->udev_new();
157 void Udev1Loader::udev_set_log_fn(
158 struct udev* udev,
159 void (*log_fn)(struct udev* udev, int priority,
160 const char* file, int line,
161 const char* fn, const char* format, va_list args)) {
162 return lib_loader_->udev_set_log_fn(udev, log_fn);
165 void Udev1Loader::udev_set_log_priority(struct udev* udev, int priority) {
166 return lib_loader_->udev_set_log_priority(udev, priority);
169 void Udev1Loader::udev_unref(udev* udev) {
170 lib_loader_->udev_unref(udev);
173 } // namespace device