NAME
udev_enumerate_new,
udev_enumerate_ref,
udev_enumerate_unref,
udev_enumerate_get_udev,
udev_enumerate_scan_devices,
udev_enumerate_get_array,
udev_enumerate_get_list_entry,
udev_list_entry_get_next,
udev_list_entry_foreach,
udev_list_entry_get_dictionary,
udev_list_entry_get_device,
udev_enumerate_add_match_subsystem,
udev_enumerate_add_nomatch_subsystem,
udev_enumerate_add_match_expr,
udev_enumerate_add_match_property,
udev_enumerate_add_nomatch_expr,
udev_enumerate_add_nomatch_property,
udev_enumerate_add_match_regex,
udev_enumerate_add_nomatch_regex —
device listing functions
LIBRARY
library “libdevattr”
SYNOPSIS
#include
<devattr.h>
struct udev_enumerate *
udev_enumerate_new(struct
udev *udev_ctx);
struct udev_enumerate *
udev_enumerate_ref(struct
udev_enumerate *udev_enum);
void
udev_enumerate_unref(struct
udev_enumerate *udev_enum);
struct udev *
udev_enumerate_get_udev(struct
udev_enumerate *udev_enum);
int
udev_enumerate_scan_devices(struct
udev_enumerate *udev_enum);
prop_array_t
udev_enumerate_get_array(struct
udev_enumerate *udev_enum);
struct udev_list_entry *
udev_enumerate_get_list_entry(struct
udev_enumerate *udev_enum);
struct udev_list_entry *
udev_list_entry_get_next(struct
udev_list_entry *list_entry);
udev_list_entry_foreach(struct
udev_list_entry *list_entry,
struct udev_list_entry
*first_entry);
prop_dictionary_t
udev_list_entry_get_dictionary(struct
udev_list_entry *list_entry);
struct udev_device *
udev_list_entry_get_device(struct
udev_list_entry *list_entry);
int
udev_enumerate_add_match_subsystem(struct
udev_enumerate *udev_enum,
const char
*subsystem);
int
udev_enumerate_add_nomatch_subsystem(struct
udev_enumerate *udev_enum,
const char
*subsystem);
int
udev_enumerate_add_match_expr(struct
udev_enumerate *udev_enum,
const char *key,
char *expr);
int
udev_enumerate_add_match_property(struct
udev_enumerate *udev_enum,
const char *key,
const char
*property);
int
udev_enumerate_add_nomatch_expr(struct
udev_enumerate *udev_enum,
const char *key,
char *expr);
int
udev_enumerate_add_nomatch_property(struct
udev_enumerate *udev_enum,
const char *key,
const char
*property);
int
udev_enumerate_add_match_regex(struct
udev_enumerate *udev_enum,
const char *key,
char *expr);
int
udev_enumerate_add_nomatch_regex(struct
udev_enumerate *udev_enum,
const char *key,
char *expr);
DESCRIPTION
Theudev_enumerate_new()
function creates a new udev_enumerate object in the specified udev context
udev_ctx. It returns NULL if no
such object could be created.
The
udev_enumerate_ref()
and
udev_enumerate_unref()
functions increase or decrease the reference count on a
udev_enumerate object respectively. When the reference
count drops to 0, the object is automatically destroyed. The
udev_enumerate_ref() function returns the same
object that was passed in.
The
udev_enumerate_get_udev()
function returns the udev context in which the
udev_enumerate object was created.
The
udev_enumerate_scan_devices()
function retrieves the set of devices matching the set of expressions and
properties specified with previous calls to
udev_enumerate_add_match_*()
and
udev_enumerate_add_nomatch_*().
This function returns -1 in case of failure.
The
udev_enumerate_get_array()
function returns the raw
prop_array(3) array containing the whole set of devices
retrieved by udev_enumerate_scan_devices().
The
udev_enumerate_get_list_entry()
function returns the first list entry of the specified
udev_enumerate context or NULL
if the set is empty. The
udev_list_entry_get_next()
returns the next list element after list_entry or
NULL if the current element was the last. The
udev_list_entry_foreach()
is a convenient macro behaving as a for loop that will iterate the whole set
starting at the list element specified by first_entry
and setting list_entry to the current element.
The
udev_list_entry_get_device()
function returns the udev_device associated to the
current list entry or NULL if no device is
associated.
The
udev_list_entry_get_dictionary()
function returns the raw
prop_dictionary(3) dictionary associated to the list entry or
NULL if no dictionary is associated.
The
udev_enumerate_add_match_subsystem()
and
udev_enumerate_add_nomatch_subsystem()
functions add a filter to match or not to match, respectively, devices with
the specified subsystem. These functions return a
negative value if an error occurred and 0 if no error occurred.
The
udev_enumerate_add_match_expr(),
udev_enumerate_add_match_property(),
udev_enumerate_add_nomatch_expr()
and
udev_enumerate_add_nomatch_property()
functions add a filter to match or not to match, respectively, devices with
the specified key and value
expr. The expr can contain
wildcards. On error, these functions return a negative value and 0 if no
error occurred.
The
udev_enumerate_add_match_regex(),
and
udev_enumerate_add_nomatch_regex()
functions add a filter to match or not to match, respectively, devices with
the specified key and value
expr. The expr can contain
regular expressions according to
regex(3). On error, these functions return a negative value and 0 if
no error occurred.
SEE ALSO
devattr(3), udev(3), udev_device(3), udev_monitor(3), udevd(8)