chiark / gitweb /
libudev: add library to access udev information
[elogind.git] / udev / lib / libudev.h
1 /*
2  * libudev - interface to udev device information
3  *
4  * Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef _LIBUDEV_H_
21 #define _LIBUDEV_H_
22
23 struct udev;
24 struct udev_device;
25
26 extern struct udev *udev_new(void);
27 extern struct udev *udev_ref(struct udev *udev);
28 extern void udev_unref(struct udev *udev);
29 extern void udev_set_log_fn(struct udev *udev,
30                             void (*log_fn)(struct udev *udev,
31                                            int priority, const char *file, int line, const char *fn,
32                                            const char *format, va_list args));
33 extern const char *udev_get_sys_path(struct udev *udev);
34 extern const char *udev_get_dev_path(struct udev *udev);
35
36 extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath);
37 extern struct udev_device *udev_device_ref(struct udev_device *udev_device);
38 extern void udev_device_unref(struct udev_device *udev_device);
39 extern struct udev *udev_device_get_udev(struct udev_device *udev_device);
40 extern const char *udev_device_get_devpath(struct udev_device *udev_device);
41 extern const char *udev_device_get_devname(struct udev_device *udev_device);
42 extern const char *udev_device_get_subsystem(struct udev_device *udev_device);
43 extern int udev_device_get_devlinks(struct udev_device *udev_device,
44                                     int (*cb)(struct udev_device *udev_device,
45                                               const char *value, void *data),
46                                     void *data);
47 extern int udev_device_get_properties(struct udev_device *udev_device,
48                                       int (*cb)(struct udev_device *udev_device,
49                                                 const char *key, const char *value, void *data),
50                                       void *data);
51
52 extern int udev_devices_enumerate(struct udev *udev, const char *subsystem,
53                                   int (*cb)(struct udev *udev,
54                                             const char *devpath, const char *subsystem, const char *name, void *data),
55                                   void *data);
56
57 #endif