gudevenumerator.c revision 23757887f768b0b7339239cc98aee879d9f4d87f
/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2008-2010 David Zeuthen <davidz@redhat.com>
*
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "gudevclient.h"
#include "gudevenumerator.h"
#include "gudevdevice.h"
#include "gudevmarshal.h"
#include "gudevprivate.h"
/**
* SECTION:gudevenumerator
* @short_description: Lookup and sort devices
*
* #GUdevEnumerator is used to lookup and sort devices.
*
* Since: 165
*/
struct _GUdevEnumeratorPrivate
{
struct udev_enumerate *e;
};
enum
{
};
/* ---------------------------------------------------------------------------------------------------- */
static void
{
{
}
{
}
}
static void
{
switch (prop_id)
{
case PROP_CLIENT:
break;
default:
break;
}
}
static void
{
switch (prop_id)
{
case PROP_CLIENT:
break;
default:
break;
}
}
static void
{
}
static void
{
/**
* GUdevEnumerator:client:
*
* The #GUdevClient to enumerate devices from.
*
* Since: 165
*/
g_param_spec_object ("client",
"The client to enumerate devices from",
"The client to enumerate devices from",
}
static void
{
}
/**
* g_udev_enumerator_new:
* @client: A #GUdevClient to enumerate devices from.
*
* 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().
*
* Returns: A new #GUdevEnumerator object. Free with g_object_unref().
*
* Since: 165
*/
{
}
/**
* g_udev_enumerator_add_match_subsystem:
* @enumerator: A #GUdevEnumerator.
* @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'.
*
* All returned devices will match the given @subsystem.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_nomatch_subsystem:
* @enumerator: A #GUdevEnumerator.
* @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'.
*
* All returned devices will not match the given @subsystem.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_match_sysfs_attr:
* @enumerator: A #GUdevEnumerator.
* @name: Wildcard filter for sysfs attribute key.
* @value: Wildcard filter for sysfs attribute value.
*
* All returned devices will have a sysfs attribute matching the given @name and @value.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_nomatch_sysfs_attr:
* @enumerator: A #GUdevEnumerator.
* @name: Wildcard filter for sysfs attribute key.
* @value: Wildcard filter for sysfs attribute value.
*
* All returned devices will not have a sysfs attribute matching the given @name and @value.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_match_property:
* @enumerator: A #GUdevEnumerator.
* @name: Wildcard filter for property name.
* @value: Wildcard filter for property value.
*
* All returned devices will have a property matching the given @name and @value.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_match_name:
* @enumerator: A #GUdevEnumerator.
* @name: Wildcard filter for kernel name e.g. "sda*".
*
* All returned devices will match the given @name.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_sysfs_path:
* @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"
*
* Add a device to the list of devices, to retrieve it back sorted in dependency order.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
const gchar *sysfs_path)
{
return enumerator;
}
/**
* g_udev_enumerator_add_match_tag:
* @enumerator: A #GUdevEnumerator.
* @tag: A udev tag e.g. "udev-acl".
*
* All returned devices will match the given @tag.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_add_match_is_initialized:
* @enumerator: A #GUdevEnumerator.
*
* All returned devices will be initialized.
*
* Returns: (transfer none): The passed in @enumerator.
*
* Since: 165
*/
{
return enumerator;
}
/**
* g_udev_enumerator_execute:
* @enumerator: A #GUdevEnumerator.
*
* Executes the query in @enumerator.
*
* Returns: (element-type GUdevDevice) (transfer full): 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.
*
* Since: 165
*/
GList *
{
struct udev_list_entry *l, *devices;
/* retrieve the list */
{
struct udev_device *udevice;
udev_list_entry_get_name (l));
continue;
}
return ret;
}