GUdevEnumerator

GUdevEnumerator — Lookup and sort devices

Synopsis

                    GUdevEnumerator;
struct              GUdevEnumeratorClass;
GUdevEnumerator *   g_udev_enumerator_new               (GUdevClient *client);
GUdevEnumerator *   g_udev_enumerator_add_match_subsystem
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *subsystem);
GUdevEnumerator *   g_udev_enumerator_add_nomatch_subsystem
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *subsystem);
GUdevEnumerator *   g_udev_enumerator_add_match_sysfs_attr
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *name,
                                                         const gchar *value);
GUdevEnumerator *   g_udev_enumerator_add_nomatch_sysfs_attr
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *name,
                                                         const gchar *value);
GUdevEnumerator *   g_udev_enumerator_add_match_property
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *name,
                                                         const gchar *value);
GUdevEnumerator *   g_udev_enumerator_add_match_name    (GUdevEnumerator *enumerator,
                                                         const gchar *name);
GUdevEnumerator *   g_udev_enumerator_add_match_tag     (GUdevEnumerator *enumerator,
                                                         const gchar *tag);
GUdevEnumerator *   g_udev_enumerator_add_match_is_initialized
                                                        (GUdevEnumerator *enumerator);
GUdevEnumerator *   g_udev_enumerator_add_sysfs_path    (GUdevEnumerator *enumerator,
                                                         const gchar *sysfs_path);
GList *             g_udev_enumerator_execute           (GUdevEnumerator *enumerator);

Object Hierarchy

  GObject
   +----GUdevEnumerator

Properties

  "client"                   GUdevClient*          : Read / Write / Construct Only

Description

GUdevEnumerator is used to lookup and sort devices.

Details

GUdevEnumerator

typedef struct _GUdevEnumerator GUdevEnumerator;

The GUdevEnumerator struct is opaque and should not be accessed directly.

Since 165


struct GUdevEnumeratorClass

struct GUdevEnumeratorClass {
  GObjectClass   parent_class;
};

Class structure for GUdevEnumerator.

GObjectClass parent_class;

Parent class.

Since 165


g_udev_enumerator_new ()

GUdevEnumerator *   g_udev_enumerator_new               (GUdevClient *client);

Constructs a GUdevEnumerator object that can be used to enumerate and sort devices. Use the add_match_*() and add_nomatch_*() methods and execute the query to get a list of devices with g_udev_enumerator_execute().

client :

A GUdevClient to enumerate devices from.

Returns :

A new GUdevEnumerator object. Free with g_object_unref().

Since 165


g_udev_enumerator_add_match_subsystem ()

GUdevEnumerator *   g_udev_enumerator_add_match_subsystem
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *subsystem);

All returned devices will match the given subsystem.

enumerator :

A GUdevEnumerator.

subsystem :

Wildcard for subsystem name e.g. 'scsi' or 'a*'.

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_nomatch_subsystem ()

GUdevEnumerator *   g_udev_enumerator_add_nomatch_subsystem
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *subsystem);

All returned devices will not match the given subsystem.

enumerator :

A GUdevEnumerator.

subsystem :

Wildcard for subsystem name e.g. 'scsi' or 'a*'.

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_match_sysfs_attr ()

GUdevEnumerator *   g_udev_enumerator_add_match_sysfs_attr
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *name,
                                                         const gchar *value);

All returned devices will have a sysfs attribute matching the given name and value.

enumerator :

A GUdevEnumerator.

name :

Wildcard filter for sysfs attribute key.

value :

Wildcard filter for sysfs attribute value.

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_nomatch_sysfs_attr ()

GUdevEnumerator *   g_udev_enumerator_add_nomatch_sysfs_attr
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *name,
                                                         const gchar *value);

All returned devices will not have a sysfs attribute matching the given name and value.

enumerator :

A GUdevEnumerator.

name :

Wildcard filter for sysfs attribute key.

value :

Wildcard filter for sysfs attribute value.

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_match_property ()

GUdevEnumerator *   g_udev_enumerator_add_match_property
                                                        (GUdevEnumerator *enumerator,
                                                         const gchar *name,
                                                         const gchar *value);

All returned devices will have a property matching the given name and value.

enumerator :

A GUdevEnumerator.

name :

Wildcard filter for property name.

value :

Wildcard filter for property value.

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_match_name ()

GUdevEnumerator *   g_udev_enumerator_add_match_name    (GUdevEnumerator *enumerator,
                                                         const gchar *name);

All returned devices will match the given name.

enumerator :

A GUdevEnumerator.

name :

Wildcard filter for kernel name e.g. "sda*".

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_match_tag ()

GUdevEnumerator *   g_udev_enumerator_add_match_tag     (GUdevEnumerator *enumerator,
                                                         const gchar *tag);

All returned devices will match the given tag.

enumerator :

A GUdevEnumerator.

tag :

A udev tag e.g. "udev-acl".

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_match_is_initialized ()

GUdevEnumerator *   g_udev_enumerator_add_match_is_initialized
                                                        (GUdevEnumerator *enumerator);

All returned devices will be initialized.

enumerator :

A GUdevEnumerator.

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_add_sysfs_path ()

GUdevEnumerator *   g_udev_enumerator_add_sysfs_path    (GUdevEnumerator *enumerator,
                                                         const gchar *sysfs_path);

Add a device to the list of devices, to retrieve it back sorted in dependency order.

enumerator :

A GUdevEnumerator.

sysfs_path :

A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda"

Returns :

The passed in enumerator. [transfer none]

Since 165


g_udev_enumerator_execute ()

GList *             g_udev_enumerator_execute           (GUdevEnumerator *enumerator);

Executes the query in enumerator.

enumerator :

A GUdevEnumerator.

Returns :

A list of GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. [element-type GUdevDevice][transfer full]

Since 165

Property Details

The "client" property

  "client"                   GUdevClient*          : Read / Write / Construct Only

The GUdevClient to enumerate devices from.

Since 165