Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

HAL device store
[HAL daemon]

The device store is where the device objects are stored. More...

Data Structures

struct  DSDeviceAsyncFindStruct_s
 search structure for async find operations More...

struct  HalProperty_s
 HalProperty internals; private. More...

struct  HalDevice_s
 HalDevice internals; private. More...

struct  HalPropertyIterator_s
 Iterator for properties; private. More...

struct  HalDeviceIterator_s
 Iterator for global device list; private. More...


Defines

#define MAX_CB_FUNCS   32
 Maximum number of callbacks inside the HAL daemon.

#define MAX_CAP_SIZE   2048
 Maximum string length for capabilities; quite a hack :-/.


Typedefs

typedef DSDeviceAsyncFindStruct_s DSDeviceAsyncFindStruct
 search structure for async find operations

typedef HalProperty_s HalProperty
 HalProperty internals; private.

typedef HalDevice_s HalDevice
 HalDevice internals; private.

typedef HalPropertyIterator_s HalPropertyIterator
 Iterator for properties; private.

typedef HalDeviceIterator_s HalDeviceIterator
 Iterator for global device list; private.

typedef void(* HalDevicePropertyChangedCallback )(HalDevice *device, const char *key, dbus_bool_t in_gdl, dbus_bool_t removed, dbus_bool_t added)
 Signature for callback function when a property is changed, added or removed.

typedef void(* HalDeviceGDLChangedCallback )(HalDevice *device, dbus_bool_t is_added)
 Signature for callback function when a device is added or removed to the gdl.

typedef void(* HalDeviceNewCapabilityCallback )(HalDevice *device, const char *capability, dbus_bool_t in_gdl)
 Signature for callback function when a device is assigned a new capability.

typedef void(* DSAsyncFindDeviceCB )(HalDevice *result, void *data1, void *data2)
 Type for callback function when a device has been found.


Functions

void async_find_property_changed (HalDevice *device, const char *key, dbus_bool_t in_gdl, dbus_bool_t removed, dbus_bool_t added)
 Called whenever a property on a device is changed.

void ds_init ()
 Initialize the device store.

void ds_add_cb_newcap (HalDeviceNewCapabilityCallback cb)
 Add a callback when a device has got a new capability.

void ds_add_cb_property_changed (HalDevicePropertyChangedCallback cb)
 Add a callback when a property of a device has changed.

void ds_add_cb_gdl_changed (HalDeviceGDLChangedCallback cb)
 Add a callback when the global device list changeds.

void ds_shutdown ()
 Shut down the device store.

void ds_print (HalDevice *device)
 Dump a textual representation of a device to stdout.

HalDeviceds_device_find (const char *udi)
 Find a device; it doesn't have to be in the global device list.

gboolean async_find_timeout_fn (gpointer data)
 Callback for when an async timeout happens.

void async_find_check_new_addition (HalDevice *device)
 This function is called by ds_gdl_add() when a new device is added to the global device list.

void ds_device_async_find_by_key_value_string (const char *key, const char *value, dbus_bool_t only_gdl, DSAsyncFindDeviceCB callback, void *data1, void *data2, int timeout)
 Find a device by requiring a specific key to assume string value.

HalDevice ** ds_device_find_multiple_by_key_value_string (const char *key, const char *value, dbus_bool_t only_gdl, int *num_results)
 Find one or more devices by requiring a specific key to assume string value.

HalDeviceds_device_find_by_key_value_string (const char *key, const char *value, dbus_bool_t only_gdl)
 Find a device by requiring a specific key to assume string value.

HalDeviceds_device_new ()
 Create a new device; it will be added to the global device list and will have a randomly generated unique device id.

void ds_device_destroy (HalDevice *device)
 Destroy a device; works both if the device is in the global device list or not.

void ds_gdl_add (HalDevice *device)
 Add a device to the global device list.

unsigned int ds_device_size ()
 Get number of devices.

void ds_device_iter_begin (HalDeviceIterator *iterator)
 Get an iterator pointing to the beginning of the device list.

dbus_bool_t ds_device_iter_has_more (HalDeviceIterator *iterator)
 Determine if there are more devices to iterate over.

void ds_device_iter_next (HalDeviceIterator *iterator)
 Advance the iterator to the next position.

HalDeviceds_device_iter_get (HalDeviceIterator *iterator)
 Get the device that this iterator represents.

const char * ds_device_get_udi (HalDevice *device)
 Get device unique id.

dbus_bool_t ds_device_set_udi (HalDevice *device, const char *udi)
 Set unique device id.

unsigned int ds_properties_size (HalDevice *device)
 Get number of properties.

dbus_bool_t ds_property_exists (HalDevice *device, const char *key)
 Determine if a property exists.

HalPropertyds_property_find (HalDevice *device, const char *key)
 Find a device property.

void ds_property_iter_begin (HalDevice *device, HalPropertyIterator *iterator)
 Get an iterator pointing to the beginning of the properties of a device.

dbus_bool_t ds_property_iter_has_more (HalPropertyIterator *iterator)
 Determine if there are more properties to iterate over.

void ds_property_iter_next (HalPropertyIterator *iterator)
 Advance the property iterator to the next position.

HalPropertyds_property_iter_get (HalPropertyIterator *iterator)
 Get the property that this iterator represents.

dbus_bool_t ds_property_set_string (HalDevice *device, const char *key, const char *value)
 Set the value of a property.

dbus_bool_t ds_property_set_int (HalDevice *device, const char *key, dbus_int32_t value)
 Set the value of a property.

dbus_bool_t ds_property_set_bool (HalDevice *device, const char *key, dbus_bool_t value)
 Set the value of a property.

dbus_bool_t ds_property_set_double (HalDevice *device, const char *key, double value)
 Set the value of a property.

dbus_bool_t ds_property_remove (HalDevice *device, const char *key)
 Remove a property.

const char * ds_property_iter_get_key (HalProperty *property)
 Get the key of a property.

int ds_property_iter_get_type (HalProperty *property)
 Get the type of the value of a property.

const char * ds_property_iter_get_string (HalProperty *property)
 Get the value of a property.

dbus_int32_t ds_property_iter_get_int (HalProperty *property)
 Get the value of a property.

dbus_bool_t ds_property_iter_get_bool (HalProperty *property)
 Get the value of a property.

double ds_property_iter_get_double (HalProperty *property)
 Get the value of a property.

void ds_device_merge (HalDevice *target, HalDevice *source)
 Merge properties from one device to another.

int ds_property_get_type (HalDevice *device, const char *key)
 Get the type of the value of a property.

const char * ds_property_get_string (HalDevice *device, const char *key)
 Get the value of a property.

dbus_int32_t ds_property_get_int (HalDevice *device, const char *key)
 Get the value of a property.

dbus_bool_t ds_property_get_bool (HalDevice *device, const char *key)
 Get the value of a property.

double ds_property_get_double (HalDevice *device, const char *key)
 Get the value of a property.

dbus_bool_t ds_device_matches (HalDevice *device1, HalDevice *device2, const char *namespace)
 Check a set of properties for two devices matches.

void ds_add_capability (HalDevice *device, const char *capability)
 Add a capability to a device.

dbus_bool_t ds_query_capability (HalDevice *device, const char *capability)
 Query a device for a capability.


Variables

HalDevicePropertyChangedCallback property_changed_cb [MAX_CB_FUNCS]
 property changed callback

HalDeviceGDLChangedCallback gdl_changed_cb [MAX_CB_FUNCS]
 gdl changed callback

HalDeviceNewCapabilityCallback new_capability_cb [MAX_CB_FUNCS]
 new capability callback

int num_property_changed_cb = 0
 property changed callback

int num_gdl_changed_cb = 0
 gdl changed callback

int num_new_capability_cb = 0
 new capability callback

unsigned int device_list_num = 0
 Number of devices.

unsigned int temp_device_counter = 0
 Counter used for generating random device names.

HalDevicedevice_list_head = NULL
 Head of device list.

DSDeviceAsyncFindStructasync_find_outstanding_head = NULL
 head of list of outstanding async find requests


Detailed Description

The device store is where the device objects are stored.

Todo:
FIXME: Right now this implementation is quite naive - should be replaced with something like hashtables etc.

Typedef Documentation

typedef void(* DSAsyncFindDeviceCB)(HalDevice * result, void *data1, void *data2)
 

Type for callback function when a device has been found.

Parameters:
result The result of the search or #NULL if the specified timeout occured
data1 The 1st parameter passed to the search function that triggered this callback. This is used to uniqely identify the origin/context for the caller
data2 The 2nd parameter passed to the search function

Definition at line 152 of file device_store.h.

Referenced by async_find_check_new_addition(), async_find_timeout_fn(), and ds_device_async_find_by_key_value_string().

typedef void(* HalDeviceGDLChangedCallback)(HalDevice * device, dbus_bool_t is_added)
 

Signature for callback function when a device is added or removed to the gdl.

Parameters:
device A pointer to a HalDevice object
is_added True iff device was added

Definition at line 114 of file device_store.h.

Referenced by ds_add_cb_gdl_changed().

typedef void(* HalDeviceNewCapabilityCallback)(HalDevice * device, const char *capability, dbus_bool_t in_gdl)
 

Signature for callback function when a device is assigned a new capability.

Parameters:
device A pointer to a HalDevice object
capability Capability acquired

Definition at line 124 of file device_store.h.

Referenced by ds_add_cb_newcap().

typedef void(* HalDevicePropertyChangedCallback)(HalDevice * device, const char *key, dbus_bool_t in_gdl, dbus_bool_t removed, dbus_bool_t added)
 

Signature for callback function when a property is changed, added or removed.

Parameters:
device A pointer to a HalDevice object
key The key of the property
in_gdl Device is in global device list
removed True iff property was removed
added True iff property was added

Definition at line 102 of file device_store.h.

Referenced by ds_add_cb_property_changed().


Function Documentation

void async_find_check_new_addition HalDevice device  )  [static]
 

This function is called by ds_gdl_add() when a new device is added to the global device list.

We use it to check if there is someone having an asynchronous wait out for the this device.

Parameters:
device Device just added

Definition at line 305 of file device_store.c.

References async_find_outstanding_head, DSDeviceAsyncFindStruct_s::callback, DSDeviceAsyncFindStruct_s::data1, DSDeviceAsyncFindStruct_s::data2, ds_property_get_string(), ds_property_get_type(), DSAsyncFindDeviceCB, DSDeviceAsyncFindStruct, HalDevice, HalDevice_s::in_gdl, DSDeviceAsyncFindStruct_s::key, DSDeviceAsyncFindStruct_s::next, DSDeviceAsyncFindStruct_s::only_gdl, and DSDeviceAsyncFindStruct_s::value.

Referenced by async_find_property_changed(), and ds_gdl_add().

void async_find_property_changed HalDevice device,
const char *  key,
dbus_bool_t  in_gdl,
dbus_bool_t  removed,
dbus_bool_t  added
[static]
 

Called whenever a property on a device is changed.

Parameters:
device HalDevice object
key Property that has changed
in_gdl True iff the device object in visible in the global device list
removed True iff the property was removed
added True iff the property was added

Definition at line 391 of file device_store.c.

References async_find_check_new_addition(), and HalDevice.

Referenced by ds_init().

gboolean async_find_timeout_fn gpointer  data  )  [static]
 

Callback for when an async timeout happens.

Parameters:
data User provided data
Returns:
#TRUE to preserve the timer, #FALSE otherwise

Definition at line 250 of file device_store.c.

References async_find_outstanding_head, DSDeviceAsyncFindStruct_s::callback, DSDeviceAsyncFindStruct_s::data1, DSDeviceAsyncFindStruct_s::data2, DSAsyncFindDeviceCB, DSDeviceAsyncFindStruct, DSDeviceAsyncFindStruct_s::key, DSDeviceAsyncFindStruct_s::next, and DSDeviceAsyncFindStruct_s::value.

Referenced by ds_device_async_find_by_key_value_string().

void ds_add_capability HalDevice device,
const char *  capability
 

Add a capability to a device.

Parameters:
device HalDevice to add capability to
capability Capability to add

Definition at line 1492 of file device_store.c.

References ds_property_get_string(), ds_property_set_string(), ds_query_capability(), HalDevice, HalDevice_s::in_gdl, MAX_CAP_SIZE, new_capability_cb, and num_new_capability_cb.

Referenced by ds_device_merge(), linux_class_block_check_if_ready_to_add(), pci_add_caps_from_class(), process_input_proc_info(), usb_add_caps_from_class(), visit_class_device_block(), visit_class_device_block_got_parent(), visit_class_device_i2c_adapter_got_parent(), visit_class_device_net(), and visit_class_device_v4l().

void ds_add_cb_gdl_changed HalDeviceGDLChangedCallback  cb  ) 
 

Add a callback when the global device list changeds.

Parameters:
cb Callback function

Definition at line 135 of file device_store.c.

References gdl_changed_cb, HalDeviceGDLChangedCallback, MAX_CB_FUNCS, and num_gdl_changed_cb.

Referenced by linux_class_net_init(), and main().

void ds_add_cb_newcap HalDeviceNewCapabilityCallback  cb  ) 
 

Add a callback when a device has got a new capability.

Parameters:
cb Callback function

Definition at line 113 of file device_store.c.

References HalDeviceNewCapabilityCallback, MAX_CB_FUNCS, new_capability_cb, num_new_capability_cb, and num_property_changed_cb.

Referenced by linux_class_net_init(), and main().

void ds_add_cb_property_changed HalDevicePropertyChangedCallback  cb  ) 
 

Add a callback when a property of a device has changed.

Parameters:
cb Callback function

Definition at line 124 of file device_store.c.

References HalDevicePropertyChangedCallback, MAX_CB_FUNCS, num_property_changed_cb, and property_changed_cb.

Referenced by main().

void ds_device_async_find_by_key_value_string const char *  key,
const char *  value,
dbus_bool_t  only_gdl,
DSAsyncFindDeviceCB  callback,
void *  data1,
void *  data2,
int  timeout
 

Find a device by requiring a specific key to assume string value.

If multiple devices meet this criteria then the result is undefined. Only devices in the GDL is searched.

This is an asynchronous version of ds_device_find_by_key_value_string. The result is delivered to the specified callback function. If the device is there the callback is invoked immedieately and thus before this functions returns.

The caller can specify a timeout in milliseconds on how long he is willing to wait. A value of zero means don't wait at all.

Parameters:
key key of the property
value value of the property
only_gdl only search in the gdl
data1 The 1st parameter passed to the callback function for this callback. This is used to uniqely identify the origin/context for the caller
data2 The 2nd parameter passed to the callback function
timeout Timeout in milliseconds
Returns:
HalDevice object or #NULL if no such device exist

Definition at line 427 of file device_store.c.

References async_find_outstanding_head, async_find_timeout_fn(), DSDeviceAsyncFindStruct_s::callback, DSDeviceAsyncFindStruct_s::data1, DSDeviceAsyncFindStruct_s::data2, ds_device_find_by_key_value_string(), DSAsyncFindDeviceCB, DSDeviceAsyncFindStruct, HalDevice, DSDeviceAsyncFindStruct_s::key, DSDeviceAsyncFindStruct_s::only_gdl, DSDeviceAsyncFindStruct_s::timeout_id, DSDeviceAsyncFindStruct_s::value, xmalloc(), and xstrdup().

Referenced by handle_udev_node_created(), process_input_proc_info(), visit_class_device_block(), visit_class_device_i2c_adapter(), visit_class_device_net(), visit_class_device_scsi_device(), visit_class_device_scsi_host(), visit_class_device_v4l(), visit_device_i2c(), visit_device_ide(), visit_device_ide_host(), visit_device_ieee1394(), visit_device_pci(), visit_device_usb(), and visit_device_usb_interface().

void ds_device_destroy HalDevice device  ) 
 

Destroy a device; works both if the device is in the global device list or not.

Parameters:
device A pointer to a HalDevice object

Definition at line 604 of file device_store.c.

References device_list_head, device_list_num, gdl_changed_cb, HalDevice, HalProperty, HalDevice_s::in_gdl, HalProperty_s::key, HalProperty_s::next, HalDevice_s::next, num_gdl_changed_cb, HalDevice_s::prev, HalDevice_s::prop_head, HalProperty_s::str_value, HalProperty_s::type, and HalDevice_s::udi.

Referenced by agent_manager_remove(), detect_media(), handle_hotplug(), input_got_sysdevice(), rename_and_merge(), visit_class_device_block_got_parent(), visit_class_device_i2c_adapter_got_parent(), visit_class_device_net_got_sysdevice(), visit_class_device_scsi_device_got_parent(), visit_class_device_scsi_host_got_parent(), visit_class_device_v4l_got_sysdevice(), and visit_device_usbif_got_parent().

HalDevice * ds_device_find const char *  udi  ) 
 

Find a device; it doesn't have to be in the global device list.

Parameters:
udi Unique device id
Returns:
HalDevice object or #NULL if the device doesn't exist

Definition at line 214 of file device_store.c.

References device_list_head, HalDevice, HalDevice_s::next, and HalDevice_s::udi.

Referenced by agent_device_matches(), agent_manager_commit_to_gdl(), agent_manager_remove(), agent_merge_properties(), device_add_capability(), device_get_all_properties(), device_get_property(), device_get_property_type(), device_property_exists(), device_query_capability(), device_remove_property(), device_set_property(), ds_device_set_udi(), find_and_set_physical_device(), manager_device_exists(), rename_and_merge(), visit_class_device_block_got_parent(), visit_class_device_i2c_adapter_got_parent(), visit_class_device_scsi_device_got_parent(), visit_class_device_scsi_host_got_parent(), visit_device_i2c_got_parent(), visit_device_ide_got_parent(), visit_device_ide_host_got_parent(), visit_device_ieee1394_got_parent(), visit_device_pci_got_parent(), visit_device_usb_got_parent(), and visit_device_usbif_got_parent().

HalDevice * ds_device_find_by_key_value_string const char *  key,
const char *  value,
dbus_bool_t  only_gdl
 

Find a device by requiring a specific key to assume string value.

If multiple devices meet this criteria then the result is undefined. Use ds_device_find_multiple_by_key_value_string() instead.

Parameters:
key key of the property
value value of the property
only_gdl only search in the gdl
Returns:
HalDevice object or #NULL if no such device exist

Definition at line 538 of file device_store.c.

References ds_device_iter_begin(), ds_device_iter_get(), ds_device_iter_has_more(), ds_device_iter_next(), ds_property_get_string(), ds_property_get_type(), HalDevice, HalDeviceIterator, and HalDevice_s::in_gdl.

Referenced by detect_media(), ds_device_async_find_by_key_value_string(), and handle_hotplug().

HalDevice ** ds_device_find_multiple_by_key_value_string const char *  key,
const char *  value,
dbus_bool_t  only_gdl,
int *  num_results
 

Find one or more devices by requiring a specific key to assume string value.

Parameters:
key key of the property
value value of the property
only_gdl only search in the gdl
num_results pointer to where number of results are stored
Returns:
Array of pointers to HalDevice object, terminated by #NULL, or #NULL if no such devices exist. Caller is supposed to free this with free()

Todo:
FIXME HACK XXX HERE_BE_DRAGONS this is an ugly hack, and a waste to have max 1024 devices

Definition at line 484 of file device_store.c.

References ds_device_iter_begin(), ds_device_iter_get(), ds_device_iter_has_more(), ds_device_iter_next(), ds_property_get_string(), ds_property_get_type(), HalDevice, HalDeviceIterator, HalDevice_s::in_gdl, and xmalloc().

Referenced by force_unmount_of_all_childs().

const char * ds_device_get_udi HalDevice device  ) 
 

Get device unique id.

Parameters:
device A pointer to a HalDevice object The device unique id

Definition at line 720 of file device_store.c.

References HalDevice, and HalDevice_s::udi.

Referenced by agent_manager_new_device(), ds_print(), and manager_get_all_devices().

void ds_device_iter_begin HalDeviceIterator iterator  ) 
 

Get an iterator pointing to the beginning of the device list.

Parameters:
iterator Iterator object

Definition at line 671 of file device_store.c.

References HalDeviceIterator_s::cursor, device_list_head, HalDeviceIterator, and HalDeviceIterator_s::position.

Referenced by ds_device_find_by_key_value_string(), ds_device_find_multiple_by_key_value_string(), etc_mtab_process_all_block_devices(), manager_find_device_by_capability(), manager_find_device_string_match(), manager_get_all_devices(), and media_detect_timer_handler().

HalDevice * ds_device_iter_get HalDeviceIterator iterator  ) 
 

Get the device that this iterator represents.

Parameters:
iterator Iterator object
Returns:
The HalDevice object the iterator represents

Definition at line 707 of file device_store.c.

References HalDeviceIterator_s::cursor, and HalDeviceIterator.

Referenced by ds_device_find_by_key_value_string(), ds_device_find_multiple_by_key_value_string(), etc_mtab_process_all_block_devices(), manager_find_device_by_capability(), manager_find_device_string_match(), manager_get_all_devices(), and media_detect_timer_handler().

dbus_bool_t ds_device_iter_has_more HalDeviceIterator iterator  ) 
 

Determine if there are more devices to iterate over.

Parameters:
iterator Iterator object
Returns:
#FALSE if there isn't any properties left

Definition at line 683 of file device_store.c.

References device_list_num, HalDeviceIterator, and HalDeviceIterator_s::position.

Referenced by ds_device_find_by_key_value_string(), ds_device_find_multiple_by_key_value_string(), etc_mtab_process_all_block_devices(), manager_find_device_by_capability(), manager_find_device_string_match(), manager_get_all_devices(), and media_detect_timer_handler().

void ds_device_iter_next HalDeviceIterator iterator  ) 
 

Advance the iterator to the next position.

Parameters:
iterator Iterator object
Returns:
#FALSE if there isn't any devices left left

Definition at line 695 of file device_store.c.

References HalDeviceIterator_s::cursor, HalDeviceIterator, HalDevice_s::next, and HalDeviceIterator_s::position.

Referenced by ds_device_find_by_key_value_string(), ds_device_find_multiple_by_key_value_string(), etc_mtab_process_all_block_devices(), manager_find_device_by_capability(), manager_find_device_string_match(), manager_get_all_devices(), and media_detect_timer_handler().

dbus_bool_t ds_device_matches HalDevice device1,
HalDevice device,
const char *  namespace
 

Check a set of properties for two devices matches.

Checks that all properties where keys, starting with a given value (namespace), of the first device is in the second device and that they got the same value and type.

Note that the other inclusion isn't tested, so there could be properties (from the given namespace) in the second device not present in the first device.

Parameters:
device1 Unique Device Id for device 1
device2 Unique Device Id for device 2
namespace Namespace for set of devices, e.g. "usb"
Returns:
#TRUE if all properties starting with the given namespace parameter from one device is in the other and have the same value.

Definition at line 1426 of file device_store.c.

References ds_property_exists(), ds_property_get_bool(), ds_property_get_double(), ds_property_get_int(), ds_property_get_string(), ds_property_iter_begin(), ds_property_iter_get(), ds_property_iter_get_bool(), ds_property_iter_get_double(), ds_property_iter_get_int(), ds_property_iter_get_key(), ds_property_iter_get_string(), ds_property_iter_get_type(), ds_property_iter_has_more(), ds_property_iter_next(), HalDevice, HalProperty, and HalPropertyIterator.

Referenced by agent_device_matches(), and rename_and_merge().

void ds_device_merge HalDevice target,
HalDevice source
 

Merge properties from one device to another.

The info.capabilities property is handled in a special way; like the other properties it isn't overwritten, but rather merged. If new capabilities are introduced then new_capability_cb will be invoked for every new capability merged onto the target device.

Parameters:
target Target device receiving properties
source Source device contributing properties

Definition at line 1221 of file device_store.c.

References ds_add_capability(), ds_property_get_string(), ds_property_get_type(), ds_property_iter_begin(), ds_property_iter_get(), ds_property_iter_get_bool(), ds_property_iter_get_double(), ds_property_iter_get_int(), ds_property_iter_get_key(), ds_property_iter_get_string(), ds_property_iter_get_type(), ds_property_iter_has_more(), ds_property_iter_next(), ds_property_remove(), ds_property_set_bool(), ds_property_set_double(), ds_property_set_int(), ds_property_set_string(), ds_query_capability(), HalDevice, HalProperty, HalPropertyIterator, property_atomic_update_begin(), and property_atomic_update_end().

Referenced by agent_merge_properties(), detect_media(), input_got_sysdevice(), rename_and_merge(), visit_class_device_net_got_sysdevice(), and visit_class_device_v4l_got_sysdevice().

HalDevice * ds_device_new  ) 
 

Create a new device; it will be added to the global device list and will have a randomly generated unique device id.

It will not be in the global device list.

Returns:
A HalDevice object

Definition at line 572 of file device_store.c.

References device_list_head, device_list_num, HalDevice, HalDevice_s::in_gdl, HalDevice_s::next, HalDevice_s::num_properties, HalDevice_s::prev, HalDevice_s::prop_head, temp_device_counter, HalDevice_s::udi, xmalloc(), and xstrdup().

Referenced by agent_manager_new_device(), detect_media(), process_input_proc_info(), visit_class_device_block(), visit_class_device_i2c_adapter(), visit_class_device_net(), visit_class_device_scsi_device(), visit_class_device_scsi_host(), visit_class_device_v4l(), visit_device_i2c(), visit_device_ide(), visit_device_ide_host(), visit_device_ieee1394(), visit_device_pci(), visit_device_usb(), and visit_device_usb_interface().

dbus_bool_t ds_device_set_udi HalDevice device,
const char *  udi
 

Set unique device id.

Parameters:
device A pointer to a HalDevice object
udi Unique device id
Returns:
#FALSE if the unique device id was in use by another application

Definition at line 733 of file device_store.c.

References ds_device_find(), HalDevice, HalDevice_s::udi, and xstrdup().

Referenced by agent_manager_commit_to_gdl(), detect_media(), and rename_and_merge().

unsigned int ds_device_size  ) 
 

Get number of devices.

Returns:
Number of devices

Definition at line 661 of file device_store.c.

References device_list_num.

void ds_gdl_add HalDevice device  ) 
 

Add a device to the global device list.

Parameters:
device A HalDevice object

Definition at line 642 of file device_store.c.

References async_find_check_new_addition(), gdl_changed_cb, HalDevice, HalDevice_s::in_gdl, and num_gdl_changed_cb.

Referenced by agent_manager_commit_to_gdl(), detect_media(), linux_class_block_check_if_ready_to_add(), visit_class_device_i2c_adapter_got_parent(), visit_class_device_scsi_device_got_parent(), visit_class_device_scsi_host_got_parent(), visit_device_i2c_got_parent(), visit_device_ide_got_parent(), visit_device_ide_host_got_parent(), visit_device_ieee1394_got_parent(), visit_device_pci_got_parent(), visit_device_usb_got_parent(), and visit_device_usbif_got_parent().

void ds_print HalDevice device  ) 
 

Dump a textual representation of a device to stdout.

Parameters:
device A pointer to a HalDevice object

Definition at line 155 of file device_store.c.

References ds_device_get_udi(), ds_property_iter_begin(), ds_property_iter_get(), ds_property_iter_get_bool(), ds_property_iter_get_double(), ds_property_iter_get_int(), ds_property_iter_get_key(), ds_property_iter_get_string(), ds_property_iter_get_type(), ds_property_iter_has_more(), ds_property_iter_next(), HalDevice, HalProperty, and HalPropertyIterator.

Referenced by rename_and_merge().

unsigned int ds_properties_size HalDevice device  ) 
 

Get number of properties.

Parameters:
device A pointer to a HalDevice object
Returns:
Number of properties

Definition at line 751 of file device_store.c.

References HalDevice, and HalDevice_s::num_properties.

dbus_bool_t ds_property_exists HalDevice device,
const char *  key
 

Determine if a property exists.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
#TRUE if the property exists, otherwise #FALSE

Definition at line 763 of file device_store.c.

References ds_property_find(), and HalDevice.

Referenced by detect_media(), device_property_exists(), ds_device_matches(), find_and_set_physical_device(), force_unmount(), handle_hotplug(), linux_class_block_removed(), rename_and_merge(), usb_compute_udi(), and visit_class_device_block_got_parent().

HalProperty * ds_property_find HalDevice device,
const char *  key
 

Find a device property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
HalProperty object or #NULL if the property doesn't exist

Definition at line 776 of file device_store.c.

References HalDevice, HalProperty, HalProperty_s::key, HalProperty_s::next, and HalDevice_s::prop_head.

Referenced by device_get_property(), device_get_property_type(), and ds_property_exists().

dbus_bool_t ds_property_get_bool HalDevice device,
const char *  key
 

Get the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
#TRUE or #FALSE

Definition at line 1369 of file device_store.c.

References HalProperty_s::bool_value, HalDevice, HalProperty, HalProperty_s::key, HalProperty_s::next, HalDevice_s::prop_head, and HalProperty_s::type.

Referenced by detect_media(), ds_device_matches(), etc_mtab_process_all_block_devices(), force_unmount(), handle_hotplug(), handle_match(), linux_class_block_check_if_ready_to_add(), linux_class_block_removed(), rename_and_merge(), and visit_class_device_block_got_parent().

double ds_property_get_double HalDevice device,
const char *  key
 

Get the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
IEEE754 double precision floating point number

Definition at line 1391 of file device_store.c.

References HalProperty_s::double_value, HalDevice, HalProperty, HalProperty_s::key, HalProperty_s::next, HalDevice_s::prop_head, and HalProperty_s::type.

Referenced by ds_device_matches().

dbus_int32_t ds_property_get_int HalDevice device,
const char *  key
 

Get the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
A 32-bit signed integer

Definition at line 1347 of file device_store.c.

References HalDevice, HalProperty, HalProperty_s::int_value, HalProperty_s::key, HalProperty_s::next, HalDevice_s::prop_head, and HalProperty_s::type.

Referenced by block_compute_udi(), ds_device_matches(), etc_mtab_process_all_block_devices(), handle_match(), i2c_adapter_compute_udi(), ide_compute_udi(), ide_host_compute_udi(), pci_compute_udi(), scsi_device_compute_udi(), scsi_host_compute_udi(), usb_compute_udi(), usbif_compute_udi(), visit_device_usb(), visit_device_usb_got_parent(), and visit_device_usbif_got_parent().

const char * ds_property_get_string HalDevice device,
const char *  key
 

Get the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
A zero-terminated UTF-8 string or #NULL if property didn't exist or wasn't a string

Definition at line 1325 of file device_store.c.

References HalDevice, HalProperty, HalProperty_s::key, HalProperty_s::next, HalDevice_s::prop_head, HalProperty_s::str_value, and HalProperty_s::type.

Referenced by async_find_check_new_addition(), detect_media(), device_add_capability(), device_query_capability(), ds_add_capability(), ds_device_find_by_key_value_string(), ds_device_find_multiple_by_key_value_string(), ds_device_matches(), ds_device_merge(), ds_query_capability(), etc_mtab_process_all_block_devices(), find_and_set_physical_device(), force_unmount(), force_unmount_of_all_childs(), handle_match(), i2c_compute_udi(), ieee1394_compute_udi(), link_detection_add(), linux_class_block_check_if_ready_to_add(), manager_find_device_by_capability(), manager_find_device_string_match(), usb_compute_udi(), usbif_compute_udi(), visit_class_device_block_got_parent(), visit_device_i2c(), and visit_device_usb_got_parent().

int ds_property_get_type HalDevice device,
const char *  key
 

Get the type of the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
One of #DBUS_TYPE_STRING, #DBUS_TYPE_INT32, #DBUS_TYPE_BOOL, #DBUS_TYPE_DOUBLE or #DBUS_TYPE_NIL if the property didn't exist

Definition at line 1304 of file device_store.c.

References HalDevice, HalProperty, HalProperty_s::key, HalProperty_s::next, HalDevice_s::prop_head, and HalProperty_s::type.

Referenced by async_find_check_new_addition(), ds_device_find_by_key_value_string(), ds_device_find_multiple_by_key_value_string(), ds_device_merge(), handle_match(), manager_find_device_by_capability(), and manager_find_device_string_match().

void ds_property_iter_begin HalDevice device,
HalPropertyIterator iterator
 

Get an iterator pointing to the beginning of the properties of a device.

Parameters:
device Device to get properties from
iterator Iterator object

Definition at line 796 of file device_store.c.

References HalPropertyIterator_s::cursor, HalPropertyIterator_s::device, HalDevice, HalPropertyIterator, and HalDevice_s::prop_head.

Referenced by device_get_all_properties(), ds_device_matches(), ds_device_merge(), and ds_print().

HalProperty * ds_property_iter_get HalPropertyIterator iterator  ) 
 

Get the property that this iterator represents.

Parameters:
iterator Iterator object
Returns:
The HalProperty object the iterator represents

Definition at line 829 of file device_store.c.

References HalPropertyIterator_s::cursor, and HalPropertyIterator.

Referenced by device_get_all_properties(), ds_device_matches(), ds_device_merge(), and ds_print().

dbus_bool_t ds_property_iter_get_bool HalProperty property  ) 
 

Get the value of a property.

Parameters:
property A pointer to a HalProperty object
Returns:
#TRUE or #FALSE

Definition at line 1194 of file device_store.c.

References HalProperty_s::bool_value, and HalProperty.

Referenced by device_get_all_properties(), device_get_property(), ds_device_matches(), ds_device_merge(), and ds_print().

double ds_property_iter_get_double HalProperty property  ) 
 

Get the value of a property.

Parameters:
property A pointer to a HalProperty object
Returns:
IEEE754 double precision floating point number

Definition at line 1205 of file device_store.c.

References HalProperty_s::double_value, and HalProperty.

Referenced by device_get_all_properties(), device_get_property(), ds_device_matches(), ds_device_merge(), and ds_print().

dbus_int32_t ds_property_iter_get_int HalProperty property  ) 
 

Get the value of a property.

Parameters:
property A pointer to a HalProperty object
Returns:
A 32-bit signed integer

Definition at line 1183 of file device_store.c.

References HalProperty, and HalProperty_s::int_value.

Referenced by device_get_all_properties(), device_get_property(), ds_device_matches(), ds_device_merge(), and ds_print().

const char * ds_property_iter_get_key HalProperty property  ) 
 

Get the key of a property.

Parameters:
property A pointer to a HalProperty object
Returns:
Key of the property

Definition at line 1145 of file device_store.c.

References HalProperty, and HalProperty_s::key.

Referenced by device_get_all_properties(), ds_device_matches(), ds_device_merge(), and ds_print().

const char * ds_property_iter_get_string HalProperty property  ) 
 

Get the value of a property.

Parameters:
property A pointer to a HalProperty object
Returns:
A zero-terminated UTF-8 string or #NULL if property didn't exist or wasn't a string

Definition at line 1170 of file device_store.c.

References HalProperty, HalProperty_s::str_value, and HalProperty_s::type.

Referenced by device_get_all_properties(), device_get_property(), ds_device_matches(), ds_device_merge(), and ds_print().

int ds_property_iter_get_type HalProperty property  ) 
 

Get the type of the value of a property.

Parameters:
property A pointer to a HalProperty object
Returns:
One of #DBUS_TYPE_STRING, #DBUS_TYPE_INT32, #DBUS_TYPE_BOOL, #DBUS_TYPE_DOUBLE

Definition at line 1157 of file device_store.c.

References HalProperty, and HalProperty_s::type.

Referenced by device_get_all_properties(), device_get_property(), device_get_property_type(), ds_device_matches(), ds_device_merge(), and ds_print().

dbus_bool_t ds_property_iter_has_more HalPropertyIterator iterator  ) 
 

Determine if there are more properties to iterate over.

Parameters:
iterator Iterator object
Returns:
#FALSE if there isn't any properties left

Definition at line 808 of file device_store.c.

References HalPropertyIterator_s::cursor, and HalPropertyIterator.

Referenced by device_get_all_properties(), ds_device_matches(), ds_device_merge(), and ds_print().

void ds_property_iter_next HalPropertyIterator iterator  ) 
 

Advance the property iterator to the next position.

Parameters:
iterator Iterator object

Definition at line 818 of file device_store.c.

References HalPropertyIterator_s::cursor, HalPropertyIterator, and HalProperty_s::next.

Referenced by device_get_all_properties(), ds_device_matches(), ds_device_merge(), and ds_print().

dbus_bool_t ds_property_remove HalDevice device,
const char *  key
 

Remove a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
Returns:
#FALSE if property didn't exist

Definition at line 1087 of file device_store.c.

References HalDevice, HalProperty, HalProperty_s::key, HalProperty_s::next, HalDevice_s::num_properties, num_property_changed_cb, HalProperty_s::prev, HalDevice_s::prop_head, property_changed_cb, HalProperty_s::str_value, and HalProperty_s::type.

Referenced by device_remove_property(), ds_device_merge(), and handle_hotplug().

dbus_bool_t ds_property_set_bool HalDevice device,
const char *  key,
dbus_bool_t  value
 

Set the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
value A zero-terminated UTF-8 string
Returns:
#FALSE if the property already exists and isn't of type boolean

Definition at line 968 of file device_store.c.

References HalProperty_s::bool_value, HalDevice, HalProperty, HalDevice_s::in_gdl, HalProperty_s::key, HalProperty_s::next, HalDevice_s::num_properties, num_property_changed_cb, HalProperty_s::prev, HalDevice_s::prop_head, property_changed_cb, HalProperty_s::type, and xstrdup().

Referenced by detect_media(), device_set_property(), ds_device_merge(), end(), etc_mtab_process_all_block_devices(), force_unmount(), handle_hotplug(), link_detection_process(), linux_class_block_check_if_ready_to_add(), process_input_proc_info(), rename_and_merge(), visit_class_device_block(), visit_class_device_block_got_parent(), visit_class_device_i2c_adapter_got_parent(), visit_class_device_scsi_device_got_parent(), visit_class_device_scsi_host_got_parent(), visit_device_ide_got_parent(), visit_device_ide_host_got_parent(), visit_device_usb(), and visit_device_usb_interface().

dbus_bool_t ds_property_set_double HalDevice device,
const char *  key,
double  value
 

Set the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
value A zero-terminated UTF-8 string
Returns:
#FALSE if the property already exists and isn't of type double

Definition at line 1029 of file device_store.c.

References HalProperty_s::double_value, HalDevice, HalProperty, HalDevice_s::in_gdl, HalProperty_s::key, HalProperty_s::next, HalDevice_s::num_properties, num_property_changed_cb, HalProperty_s::prev, HalDevice_s::prop_head, property_changed_cb, HalProperty_s::type, and xstrdup().

Referenced by device_set_property(), ds_device_merge(), and end().

dbus_bool_t ds_property_set_int HalDevice device,
const char *  key,
dbus_int32_t  value
 

Set the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
value A zero-terminated UTF-8 string
Returns:
#FALSE if the property already exists and isn't of type int

Definition at line 907 of file device_store.c.

References HalDevice, HalProperty, HalDevice_s::in_gdl, HalProperty_s::int_value, HalProperty_s::key, HalProperty_s::next, HalDevice_s::num_properties, num_property_changed_cb, HalProperty_s::prev, HalDevice_s::prop_head, property_changed_cb, HalProperty_s::type, and xstrdup().

Referenced by device_set_property(), ds_device_merge(), end(), link_detection_process(), linux_class_block_check_if_ready_to_add(), process_input_proc_info(), visit_class_device_block(), visit_class_device_i2c_adapter(), visit_class_device_net(), visit_class_device_scsi_device(), visit_class_device_scsi_host(), visit_class_device_v4l(), visit_device_ide(), visit_device_ide_host(), visit_device_pci(), visit_device_usb(), visit_device_usb_got_parent(), visit_device_usb_interface(), and visit_device_usbif_got_parent().

dbus_bool_t ds_property_set_string HalDevice device,
const char *  key,
const char *  value
 

Set the value of a property.

Parameters:
device A pointer to a HalDevice object
key The key of the property
value A zero-terminated UTF-8 string
Returns:
#FALSE if the property already exists and isn't of type string

Definition at line 843 of file device_store.c.

References HalDevice, HalProperty, HalDevice_s::in_gdl, HalProperty_s::key, HalProperty_s::next, HalDevice_s::num_properties, num_property_changed_cb, HalProperty_s::prev, HalDevice_s::prop_head, property_changed_cb, HalProperty_s::str_value, HalProperty_s::type, and xstrdup().

Referenced by detect_media(), device_add_capability(), device_set_property(), ds_add_capability(), ds_device_merge(), end(), etc_mtab_process_all_block_devices(), find_and_set_physical_device(), force_unmount(), handle_udev_node_created_found_device(), linux_class_block_check_if_ready_to_add(), pci_add_caps_from_class(), process_input_proc_info(), rename_and_merge(), usb_add_caps_from_class(), visit_class_device_block(), visit_class_device_block_got_parent(), visit_class_device_i2c_adapter(), visit_class_device_i2c_adapter_got_parent(), visit_class_device_net(), visit_class_device_scsi_device(), visit_class_device_scsi_device_got_parent(), visit_class_device_scsi_host(), visit_class_device_scsi_host_got_parent(), visit_class_device_v4l(), visit_device_i2c(), visit_device_i2c_got_parent(), visit_device_ide(), visit_device_ide_got_parent(), visit_device_ide_host(), visit_device_ide_host_got_parent(), visit_device_ieee1394(), visit_device_ieee1394_got_parent(), visit_device_pci(), visit_device_pci_got_parent(), visit_device_usb(), visit_device_usb_got_parent(), visit_device_usb_interface(), and visit_device_usbif_got_parent().

dbus_bool_t ds_query_capability HalDevice device,
const char *  capability
 

Query a device for a capability.

Parameters:
device Pointer to a HalDevice object
capability Capability to query for, e.g. 'net.ethernet'
Returns:
#TRUE if and only if the device got the capablity

Definition at line 1526 of file device_store.c.

References ds_property_get_string(), HalDevice, and xstrdup().

Referenced by ds_add_capability(), ds_device_merge(), and gdl_changed().


Generated on Thu Mar 11 21:32:24 2004 for HAL by doxygen 1.3.6-20040222