libudev.h revision 2001208c2ab631a69896d1f670c26846b70d1fb7
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * libudev - interface to udev device information
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * Copyright (C) 2008-2011 Kay Sievers <kay.sievers@vrfy.org>
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * This library is free software; you can redistribute it and/or
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * modify it under the terms of the GNU Lesser General Public
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * License as published by the Free Software Foundation; either
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * version 2.1 of the License, or (at your option) any later version.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * udev - library context
178cc7700c23ac088cd7190d7854282075028d91Lennart Poettering * reads the udev config and system environment
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * allows custom logging
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev *udev_unref(struct udev *udev);
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensenvoid udev_set_log_fn(struct udev *udev,
178cc7700c23ac088cd7190d7854282075028d91Lennart Poettering int priority, const char *file, int line, const char *fn,
178cc7700c23ac088cd7190d7854282075028d91Lennart Poetteringint udev_get_log_priority(struct udev *udev);
3b3154df7e2773332bb814e167187367a0ccae4aLennart Poetteringvoid udev_set_log_priority(struct udev *udev, int priority);
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmekvoid *udev_get_userdata(struct udev *udev);
46b131574fdd7d77c15a0919ca9010cad7aa6ac7Lennart Poetteringvoid udev_set_userdata(struct udev *udev, void *userdata);
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmek * access to libudev generated lists
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmekstruct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry);
f8294e4175918117ca6c131720bcf287eadcd029Josh Triplettstruct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name);
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmekconst char *udev_list_entry_get_name(struct udev_list_entry *list_entry);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_list_entry_get_value(struct udev_list_entry *list_entry);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * udev_list_entry_foreach:
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * @list_entry: entry to store the current position
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * @first_entry: first entry to start with
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * Helper to iterate over all entries of a list.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering#define udev_list_entry_foreach(list_entry, first_entry) \
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering list_entry = udev_list_entry_get_next(list_entry))
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * access to sysfs/kernel devices
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_ref(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_unref(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev *udev_device_get_udev(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_new_from_device_id(struct udev *udev, char *id);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_new_from_environment(struct udev *udev);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_get_parent(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device,
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering const char *subsystem, const char *devtype);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* retrieve device properties */
178cc7700c23ac088cd7190d7854282075028d91Lennart Poetteringconst char *udev_device_get_devpath(struct udev_device *udev_device);
178cc7700c23ac088cd7190d7854282075028d91Lennart Poetteringconst char *udev_device_get_subsystem(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_devtype(struct udev_device *udev_device);
178cc7700c23ac088cd7190d7854282075028d91Lennart Poetteringconst char *udev_device_get_syspath(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_sysname(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_sysnum(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_devnode(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_device_get_is_initialized(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_driver(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringdev_t udev_device_get_devnum(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_action(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringunsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringunsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringconst char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
178cc7700c23ac088cd7190d7854282075028d91Lennart Poetteringint udev_device_has_tag(struct udev_device *udev_device, const char *tag);
178cc7700c23ac088cd7190d7854282075028d91Lennart Poettering * udev_monitor
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * access to kernel uevents and udev events
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monitor);
3b3154df7e2773332bb814e167187367a0ccae4aLennart Poetteringstruct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* kernel and udev generated events over netlink */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* bind socket */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_monitor_get_fd(struct udev_monitor *udev_monitor);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* in-kernel socket filters to select messages that get delivered to a listener */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor,
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering const char *subsystem, const char *devtype);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_monitor_filter_update(struct udev_monitor *udev_monitor);
3b3154df7e2773332bb814e167187367a0ccae4aLennart Poetteringint udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * udev_enumerate
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * search sysfs for specific devices and provide a sorted list
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_enumerate *udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_enumerate *udev_enumerate_new(struct udev *udev);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* device properties filter */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* run enumeration with active filters */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering/* return device list */
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * access to the currently running udev events
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_queue *udev_queue_unref(struct udev_queue *udev_queue);
de0671ee7fe465e108f62dcbbbe9366f81dd9e9aZbigniew Jędrzejewski-Szmekstruct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_queue *udev_queue_new(struct udev *udev);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringunsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringunsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_queue_get_udev_is_active(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_queue_get_queue_is_empty(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering unsigned long long int start, unsigned long long int end);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * access to the static hardware properties database
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_hwdb *udev_hwdb_new(struct udev *udev);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringstruct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering * udev specific utilities
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringint udev_util_encode_string(const char *str, char *str_enc, size_t len);
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering} /* extern "C" */