libudev.h revision 116254097ad3c07d9f7ed06042dbec7ba4f0f4fd
/*
* libudev - interface to udev device information
*
* Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#ifndef _LIBUDEV_H_
#define _LIBUDEV_H_
#include <stdarg.h>
/* this will stay as long as the DeviceKit integration of udev is work in progress */
#if !defined _LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
#error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version"
#endif
/* library context */
struct udev;
/* list iteration */
struct udev_list_entry;
extern struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name);
/* sys devices */
struct udev_device;
extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
extern struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype);
extern struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
extern struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
extern const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
extern const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
/* udev and kernel device events */
struct udev_monitor;
enum udev_monitor_netlink_group {
UDEV_MONITOR_KERNEL = 1,
UDEV_MONITOR_UDEV = 2,
};
extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, enum udev_monitor_netlink_group group);
/* sys enumeration */
struct udev_enumerate;
extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
extern int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
extern int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
extern int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate);
/* event queue */
struct udev_queue;
extern int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum);
#endif