Crate udevrs

Source
Expand description

Pure Rust library for interacting with the udev userspace devfs.

Uses the libc and nix crate to make syscalls to Linux.

Structs§

BpfFilters
Collection of BPF socket filters for kernel events.
LineBuf
Line buffer for parsing HWDB on-disk file format.
Mode
Linux file-permission mode.
Syspath
Represents the file path in the sys filesystem.
TrieChildEntry
Trie child entry in the hardware database.
TrieEntry
Represents the full Trie entry in the HWDB.
TrieHeader
On-disk trie objects
TrieNode
Trie node in the hardware database.
TrieValueEntry
Trie value entry in the hardware database.
Udev
libudev context
UdevDevice
Represents one kernel sys device.
UdevEntry
UDEV list entry.
UdevEnumerate
Represents one device lookup/sort context..
UdevHwdb
Represents the on-disk hardware database.
UdevList
Represents a list wrapper around a UdevEntryList.
UdevMonitor
Handles device event sources.
UdevMonitorNetlinkHeader
Represents a UDEV Netlink header.
UdevQueue
Represents the current event queue in the udev daemon.
file_handle
Represents an FFI type from fcntl.h for a file_handle.

Enums§

Error
Error types for the udev library.
LogPriority
UdevMonitorNetlinkGroup
Represents the netlink group for the UdevMonitor.
UdevSocket
Represents socket variants on a Linux system.

Constants§

BPF_FILTER_LEN
Maximum length of BPF socket filters.
ENVP_LEN
Maximum number of ENVP entries
HWDB_SIG
Hardware database signature.
HWDB_SIG_STR
Hardware database signature (string representation).
LINE_MAX
Maximum length for a file line.
LOG_ALERT
LOG_CRIT
LOG_DEBUG
LOG_EMERG
LOG_ERR
LOG_INFO
LOG_NOTICE
LOG_WARNING
MODE_MASK
Bitmask for Mode.
RULES_PATH_LEN
UDEV_MONITOR_MAGIC
UDEV Monitor magic bytes
UDEV_ROOT_RUN
Default filesystem path for the UDEV run directory.
UEVENT_FILE_LIMIT
Limits the number of characters for a UEVENT file.

Functions§

child_entry_size
Gets the ChildEntry size loaded from the TrieHeader.
encode_devnode_name
Encodes a devnode name, removing potentially dangerous characters.
encode_string
Encodes provided string, removing potentially unsafe characters.
major
Gets the major part of the device number.
minor
Gets the minor part of the device number.
murmur_hash2
MurmurHash2 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code.
name_to_handle_at
Wrapper around a syscall that returns an opaque handle that corresponds to a specified file.
node_size
Gets the Node size loaded from the TrieHeader.
string_bloom64
Gets a bunch of bit numbers out of the hash, and sets the bits into a bitfield.
string_hash32
Compute a MurMurHash over the provided string.
trie_string
Parses a string from the HWDB buffer.
udev_device_get_action
Gets the device action.
udev_device_get_current_tags_list_entry
Gets the current tags list entry in the UdevDevice.
udev_device_get_devlinks_list_entry
Gets the list of device links for the UdevDevice.
udev_device_get_devnode
Gets the UdevDevice devnode.
udev_device_get_devnum
Gets the device major/minor number.
udev_device_get_devpath
Gets the UdevDevice device path.
udev_device_get_driver
Gets the kernel driver name.
udev_device_get_is_initialized
Gets whether the UdevDevice is initialized.
udev_device_get_parent
Gets the next parent UdevDevice.
udev_device_get_parent_with_subsystem_devtype
Gets the next parent UdevDevice based on subsystem and devtype.
udev_device_get_property_value
Gets the value of a given property.
udev_device_get_seqnum
Gets the device event sequence number.
udev_device_get_sysattr_list_entry
Gets the first entry in the sysattr properties list.
udev_device_get_sysattr_value
Gets the sys attribute file value.
udev_device_get_sysname
Gets the UdevDevice sysname.
udev_device_get_sysnum
Gets the UdevDevice sysnum.
udev_device_get_syspath
Gets the UdevDevice syspath.
udev_device_get_tags_list_entry
Gets the first tags list entry in the UdevDevice.
udev_device_get_udev
Gets a reference to the Udev context from an UdevDevice.
udev_device_get_udev_cloned
Gets a cloned reference to the Udev context from an UdevDevice.
udev_device_get_usec_since_initialized
Gets the number of microseconds since the UdevDevice was initialized.
udev_device_has_current_tag
Gets whether the UdevDevice has the provided current tag associated.
udev_device_has_tag
Gets whether the UdevDevice has the provided tag associated.
udev_device_new
Creates a new UdevDevice from the provided Udev context.
udev_device_new_from_device_id
Create new UdevDevice from an ID string.
udev_device_new_from_devnum
Creates new UdevDevice.
udev_device_new_from_environment
Create new udev device from the environment information.
udev_device_new_from_subsystem_sysname
Creates a new UdevDevice from the subsystem and sysname.
udev_device_new_from_syspath
Creates new UdevDevice, and fills in information from the sys device and the udev database entry.
udev_device_read_db
Reads UdevDevice information from the persistent database file.
udev_enumerate_add_match_is_initialized
Sets whether the match lists are initialized.
udev_enumerate_add_match_parent
Sets the parent UdevDevice on a given device tree.
udev_enumerate_add_match_property
Adds an entry to the match properties UdevEntry list.
udev_enumerate_add_match_subsystem
Adds an entry to the match subsystem UdevEntry list.
udev_enumerate_add_match_sysattr
Adds an entry to the match sysattr UdevEntry list.
udev_enumerate_add_match_sysname
Adds an entry to the match sysname UdevEntry list.
udev_enumerate_add_match_tag
Adds an entry to the match tag UdevEntry list.
udev_enumerate_add_nomatch_subsystem
Adds an entry to the no-match subsystem UdevEntry list.
udev_enumerate_add_nomatch_sysattr
Adds an entry to the no-match sysattr UdevEntry list.
udev_enumerate_add_syspath
Adds a devices to the list of devices.
udev_enumerate_new
Creates a new UdevEnumerate.
udev_enumerate_scan_devices
Scan /sys for devices which match the given filters.
udev_enumerate_scan_subsystems
Scans /sys for all kernel subsystems.
udev_get_log_priority
Gets the LogPriority for the Udev context.
udev_hwdb_get_properties_list_entry
Looks up a matching device in the hardware database.
udev_hwdb_new
Creates a new UdevHwdb.
udev_hwdb_query
Looks up a matching device modalias in the hardware database and returns the list of properties.
udev_hwdb_query_one
Looks up a specific matching property name (key) for device modalias
udev_list_entry_foreach
Helper function that iterates over every UdevEntry in the list, applying the function to each entry.
udev_list_entry_foreach_mut
Helper function that iterates over every UdevEntry in the list, applying the function to each entry.
udev_list_entry_get_name
Gets the name of the UdevEntry.
udev_list_entry_get_next
Gets a reference to the next entry in a UdevList.
udev_list_entry_get_next_mut
Gets a mutable reference to the next entry in a UdevList.
udev_list_entry_get_value
Gets the value of the UdevEntry.
udev_monitor_enable_receiving
Binds the UdevMonitor socket to the event source.
udev_monitor_filter_add_match_subsystem_devtype
Adds an UdevEntry into the filter subsystem list.
udev_monitor_filter_add_match_tag
Adds an UdevEntry into the filter tag list.
udev_monitor_filter_remove
Removes all filters from the UdevMonitor.
udev_monitor_filter_update
Updates the monitor socket filter.
udev_monitor_get_fd
Gets the UdevMonitor socket file descriptor.
udev_monitor_get_udev
Gets the Udev context of the UdevMonitor.
udev_monitor_new_from_netlink
Creates a new UdevMonitor from the provided parameters.
udev_monitor_receive_device
Receives data from the UdevMonitor socket.
udev_monitor_set_receive_buffer_size
Sets the size of the kernel socket buffer.
udev_new
Creates a new Udev context.
udev_queue_flush
Clears the watched file descriptor for queue changes.
udev_queue_get_fd
Gets a file descriptor to watch for a queue to become empty.
udev_queue_get_queue_is_empty
Gets whether UdevQueue is currently processing any events.
udev_queue_get_udev
Gets a reference to the Udev context.
udev_queue_get_udev_is_active
Checks if Udev is active on the system.
udev_queue_new
Creates a new UdevQueue.
udev_set_log_priority
Sets the LogPriority for the Udev context.
udev_util_encode_string
Encodes provided string, removing potentially unsafe characters.
value_entry_size
Gets the ValueEntry size loaded from the TrieHeader.
whitelisted_char_for_devnode
Gets whether the provided character is whitelisted.

Type Aliases§

Result
Convenience alias for the udev library Result type.
UdevEntryList
Convenience alias for a LinkedList of UdevEntry.