hal/libhal Makefile.am, 1.2, 1.3 libhal.c, 1.33, 1.34 libhal.h, 1.18,
1.19
David Zeuthen
david at freedesktop.org
Mon Jan 31 12:06:43 PST 2005
- Previous message: hal/po da.po, 1.8, 1.9 de.po, 1.9, 1.10 fr.po, 1.8, 1.9 hu.po, 1.3,
1.4 it.po, 1.2, 1.3 nl.po, 1.7, 1.8 pt.po, 1.3, 1.4 ru.po, 1.3, 1.4
- Next message: hal/tools/linux hal_hotplug_map.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/libhal
In directory gabe:/tmp/cvs-serv1622/libhal
Modified Files:
Makefile.am libhal.c libhal.h
Log Message:
2005-01-31 David Zeuthen <davidz at redhat.com>
* configure.in: Prebump to 0.5.0 - but we're not doing a release yet!
Add libtool versioning since libhal and libhal-storage are going
to break API and ABI backwards compatibility.
* hald/hald_test.c: Add the beginnings of a test suite
* hald/hald_test_libhal.c: -do-
* hald/Makefile.am: Add build rules for test suite
* tools/linux/hal_hotplug_map.c: Update to use new libhal API.
* tools/lshal.c: Update to use new libhal API.
* tools/hal_set_property.c: Update to use new libhal API.
* tools/hal_get_property.c: Update to use new libhal API.
* tools/fstab-sync.c: Update to use new libhal API.
* libhal-storage/libhal-storage.c: Update to use new libhal API.
This library will also go through a renaming/cleanup before 0.5.0.
* libhal-storage/Makefile.am: Use library versioning
* libhal/libhal.[ch]: Prefix all function names and other identifiers
with libhal instead of hal. Add code for string lists. Change the
way libhal is initialized to be a multistep process. Use HAL_PROPERTY_
TYPE_* instead of DBUS_TYPE_*. Make all functions using IPC take
a DBusError argument for better error handling. Notable changes
(libhal_device_get_all_properties): Teach this function about
string lists
(libhal_psi_get_strlist): New function
(hal_initialize): Removed
(hal_shutdown): Removed
(libhal_device_get_property_strlist): New function
(libhal_device_property_strlist_append): New function
(libhal_device_property_strlist_prepend): New function
(libhal_device_property_strlist_remove_index): New function
(libhal_device_property_strlist_remove): New function
(libhal_ctx_new): New function
(libhal_ctx_set_cache): New function
(libhal_ctx_set_dbus_connection): New function
(libhal_ctx_init): New function
(libhal_ctx_shutdown): New function
(libhal_ctx_free): New function
(libhal_ctx_set_device_added): New function
(libhal_ctx_set_device_removed): New function
(libhal_ctx_set_device_new_capability): New function
(libhal_ctx_set_device_lost_capability): New function
(libhal_ctx_set_device_property_modified): New function
(libhal_ctx_set_device_condition): New function
* libhal/Makefile.am: Use library versioning
* hald/linux2/probing/probe-input.c: Port to new libhal API
* hald/property.h: Rename property types to HAL_PROPERTY_TYPE_*.
Add prototypes for new string list properties.
* hald/property.c: Rename property types to HAL_PROPERTY_TYPE_*.
(hal_property_free): Teach this function about string lists.
(hal_property_new_strlist): New function
(hal_property_get_strlist): New function
(hal_property_strlist_append): New function
(hal_property_strlist_prepend): New function
(hal_property_strlist_remove_elem): New function
(hal_property_strlist_add): New function
(hal_property_strlist_remove): New function
* hald/hald_dbus.c: Rename property types to HAL_PROPERTY_TYPE_*.
Add new ugly code to handle string lists with the current D-BUS.
(device_string_list_append_prepend): New function
(hald_dbus_filter_function): Rename from filter_function. Add
handlers for new D-BUS methods. Export this function
* hald/hald.[ch]: Rip out persistent property code.
* hald/device_info.c: Rename property types to HAL_PROPERTY_TYPE_*.
* hald/device.c: Rename to property to HAL_PROPERTY_TYPE_*. Rip out
persistent property code.
(hal_device_property_get_as_string): Add code for strlist type
(hal_device_property_get_strlist): New function
(hal_device_property_strlist_append): New function
(hal_device_property_strlist_prepend): New function
(hal_device_property_strlist_remove_elem): New function
(hal_device_property_strlist_add): New function
(hal_device_property_strlist_remove): New function
* hald/device.h: Add new strlist prototypes
* pstore.[ch]: Remove for now as persistent properties needs to be
reworked
Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/libhal/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am 4 Jan 2004 18:44:41 -0000 1.2
+++ Makefile.am 31 Jan 2005 20:06:41 -0000 1.3
@@ -18,5 +18,7 @@
libhal_la_LIBADD = @DBUS_LIBS@
+libhal_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+
clean-local :
rm -f *~
Index: libhal.c
===================================================================
RCS file: /cvs/hal/hal/libhal/libhal.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- libhal.c 18 Jan 2005 19:48:13 -0000 1.33
+++ libhal.c 31 Jan 2005 20:06:41 -0000 1.34
@@ -66,7 +66,7 @@
* @param str_array The array to be freed
*/
void
-hal_free_string_array (char **str_array)
+libhal_free_string_array (char **str_array)
{
if (str_array != NULL) {
int i;
@@ -83,7 +83,7 @@
* @param str The nul-terminated sting to free
*/
[...1941 lines suppressed...]
+
+dbus_bool_t
+libhal_ctx_set_device_property_modified (LibHalContext *ctx, LibHalDevicePropertyModified callback)
+{
+ if (ctx == NULL)
+ return FALSE;
+ ctx->device_property_modified = callback;
+ return TRUE;
+}
+
+dbus_bool_t
+libhal_ctx_set_device_condition (LibHalContext *ctx, LibHalDeviceCondition callback)
+{
+ if (ctx == NULL)
+ return FALSE;
+ ctx->device_condition = callback;
+ return TRUE;
+}
/** @} */
Index: libhal.h
===================================================================
RCS file: /cvs/hal/hal/libhal/libhal.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- libhal.h 17 Sep 2004 17:05:48 -0000 1.18
+++ libhal.h 31 Jan 2005 20:06:41 -0000 1.19
@@ -30,6 +30,9 @@
#if defined(__cplusplus)
extern "C" {
+#if 0
+} /* shut up emacs indenting */
+#endif
#endif
/**
@@ -38,6 +41,30 @@
* @{
*/
+/** Possible types for properties on hal device objects */
+typedef enum {
+ /** Used to report error condition */
+ LIBHAL_PROPERTY_TYPE_NIL = DBUS_TYPE_NIL,
+
+ /** Type for 32-bit signed integer property */
+ LIBHAL_PROPERTY_TYPE_INT32 = DBUS_TYPE_INT32,
+
+ /** Type for 64-bit unsigned integer property */
+ LIBHAL_PROPERTY_TYPE_UINT64 = DBUS_TYPE_UINT64,
+
+ /** Type for double precision floating point property */
+ LIBHAL_PROPERTY_TYPE_DOUBLE = DBUS_TYPE_DOUBLE,
+
+ /** Type for boolean property */
+ LIBHAL_PROPERTY_TYPE_BOOLEAN = DBUS_TYPE_BOOLEAN,
+
+ /** Type for UTF-8 string property */
+ LIBHAL_PROPERTY_TYPE_STRING = DBUS_TYPE_STRING,
+
+ /** Type for list of UTF-8 strings property */
+ LIBHAL_PROPERTY_TYPE_STRLIST = ((int) (DBUS_TYPE_STRING<<8)+('l'))
+} LibHalPropertyType;
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct LibHalContext_s LibHalContext;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
@@ -48,38 +75,39 @@
* @param udi Unique Device Id
*/
typedef void (*LibHalIntegrateDBusIntoMainLoop) (LibHalContext *ctx,
- DBusConnection *
- dbus_connection);
+ DBusConnection *dbus_connection);
/** Type for callback when a device is added.
*
* @param udi Unique Device Id
*/
-typedef void (*LibHalDeviceAdded) (LibHalContext *ctx, const char *udi);
+typedef void (*LibHalDeviceAdded) (LibHalContext *ctx,
+ const char *udi);
/** Type for callback when a device is removed.
*
* @param udi Unique Device Id
*/
-typedef void (*LibHalDeviceRemoved) (LibHalContext *ctx, const char *udi);
+typedef void (*LibHalDeviceRemoved) (LibHalContext *ctx,
+ const char *udi);
-/** Type for callback when a device got a new capability
+/** Type for callback when a device gains a new capability
*
* @param udi Unique Device Id
* @param capability Capability of the device
*/
-typedef void (*LibHalNewCapability) (LibHalContext *ctx,
- const char *udi,
- const char *capability);
+typedef void (*LibHalDeviceNewCapability) (LibHalContext *ctx,
+ const char *udi,
+ const char *capability);
-/** Type for callback when a device lost a capability
+/** Type for callback when a device loses a capability
*
* @param udi Unique Device Id
* @param capability Capability of the device
*/
-typedef void (*LibHalLostCapability) (LibHalContext *ctx,
- const char *udi,
- const char *capability);
+typedef void (*LibHalDeviceLostCapability) (LibHalContext *ctx,
+ const char *udi,
+ const char *capability);
/** Type for callback when a property of a device changes.
*
@@ -109,107 +137,132 @@
DBusMessage *message);
-/** Big convenience chunk for all callback function pointers.
- *
- * Every function pointer can be set to NULL to indicate that the
- * callback is not requested.
- */
-typedef struct LibHalFunctions_s {
- /** This is called when the application needs to integrate the
- * underlying DBusConnection into the main loop
- */
- LibHalIntegrateDBusIntoMainLoop main_loop_integration;
+LibHalContext *libhal_ctx_new (void);
+dbus_bool_t libhal_ctx_set_cache (LibHalContext *ctx, dbus_bool_t use_cache);
+dbus_bool_t libhal_ctx_set_dbus_connection (LibHalContext *ctx, DBusConnection *conn);
+dbus_bool_t libhal_ctx_set_user_data (LibHalContext *ctx, void *user_data);
+void* libhal_ctx_get_user_data (LibHalContext *ctx);
+dbus_bool_t libhal_ctx_set_device_added (LibHalContext *ctx, LibHalDeviceAdded callback);
+dbus_bool_t libhal_ctx_set_device_removed (LibHalContext *ctx, LibHalDeviceRemoved callback);
+dbus_bool_t libhal_ctx_set_device_new_capability (LibHalContext *ctx, LibHalDeviceNewCapability callback);
+dbus_bool_t libhal_ctx_set_device_lost_capability (LibHalContext *ctx, LibHalDeviceLostCapability callback);
+dbus_bool_t libhal_ctx_set_device_property_modified (LibHalContext *ctx, LibHalDevicePropertyModified callback);
+dbus_bool_t libhal_ctx_set_device_condition (LibHalContext *ctx, LibHalDeviceCondition callback);
+dbus_bool_t libhal_ctx_init (LibHalContext *ctx, DBusError *error);
+dbus_bool_t libhal_ctx_shutdown (LibHalContext *ctx, DBusError *error);
+dbus_bool_t libhal_ctx_free (LibHalContext *ctx);
- /** Device added */
- LibHalDeviceAdded device_added;
- /** Device removed */
- LibHalDeviceRemoved device_removed;
+char **libhal_get_all_devices (LibHalContext *ctx, int *num_devices, DBusError *error);
+dbus_bool_t libhal_device_exists (LibHalContext *ctx, const char *udi, DBusError *error);
+dbus_bool_t libhal_device_print (LibHalContext *ctx, const char *udi, DBusError *error);
- /** Device got a new capability */
- LibHalNewCapability device_new_capability;
- /** Device got a new capability */
- LibHalLostCapability device_lost_capability;
- /** A property of a device changed */
- LibHalDevicePropertyModified device_property_modified;
+dbus_bool_t libhal_device_property_exists (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
- /** A non-continous event on the device occured */
- LibHalDeviceCondition device_condition;
-} LibHalFunctions;
+char *libhal_device_get_property_string (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
+dbus_int32_t libhal_device_get_property_int (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
-LibHalContext *hal_initialize (const LibHalFunctions * cb_functions,
- dbus_bool_t use_cache);
+dbus_uint64_t libhal_device_get_property_uint64 (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
-int hal_shutdown (LibHalContext *ctx);
+double libhal_device_get_property_double (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
-void hal_ctx_set_user_data(LibHalContext *ctx, void *user_data);
+dbus_bool_t libhal_device_get_property_bool (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
-void* hal_ctx_get_user_data(LibHalContext *ctx);
+char **libhal_device_get_property_strlist (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
-char **hal_get_all_devices (LibHalContext *ctx, int *num_devices);
-dbus_bool_t hal_device_exists (LibHalContext *ctx, const char *udi);
-void hal_device_print (LibHalContext *ctx, const char *udi);
-dbus_bool_t hal_device_property_exists (LibHalContext *ctx,
- const char *udi,
- const char *key);
+dbus_bool_t libhal_device_set_property_string (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ const char *value,
+ DBusError *error);
-char *hal_device_get_property_string (LibHalContext *ctx, const char *udi,
- const char *key);
+dbus_bool_t libhal_device_set_property_int (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ dbus_int32_t value,
+ DBusError *error);
-dbus_int32_t hal_device_get_property_int (LibHalContext *ctx,
- const char *udi,
- const char *key);
+dbus_bool_t libhal_device_set_property_uint64 (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ dbus_uint64_t value,
+ DBusError *error);
-dbus_uint64_t hal_device_get_property_uint64 (LibHalContext *ctx,
- const char *udi,
- const char *key);
+dbus_bool_t libhal_device_set_property_double (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ double value,
+ DBusError *error);
-double hal_device_get_property_double (LibHalContext *ctx,
- const char *udi,
- const char *key);
+dbus_bool_t libhal_device_set_property_bool (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ dbus_bool_t value,
+ DBusError *error);
-dbus_bool_t hal_device_get_property_bool (LibHalContext *ctx,
- const char *udi,
- const char *key);
-dbus_bool_t hal_device_set_property_string (LibHalContext *ctx,
- const char *udi,
- const char *key,
- const char *value);
+dbus_bool_t libhal_device_property_strlist_append (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ const char *value,
+ DBusError *error);
-dbus_bool_t hal_device_set_property_int (LibHalContext *ctx,
- const char *udi,
- const char *key,
- dbus_int32_t value);
+dbus_bool_t libhal_device_property_strlist_prepend (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ const char *value,
+ DBusError *error);
-dbus_bool_t hal_device_set_property_uint64 (LibHalContext *ctx,
- const char *udi,
- const char *key,
- dbus_uint64_t value);
+dbus_bool_t libhal_device_property_strlist_remove_index (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ unsigned int index,
+ DBusError *error);
-dbus_bool_t hal_device_set_property_double (LibHalContext *ctx,
- const char *udi,
- const char *key,
- double value);
+dbus_bool_t libhal_device_property_strlist_remove (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ const char *value,
+ DBusError *error);
-dbus_bool_t hal_device_set_property_bool (LibHalContext *ctx,
- const char *udi,
- const char *key,
- dbus_bool_t value);
-dbus_bool_t hal_device_remove_property (LibHalContext *ctx,
- const char *udi,
- const char *key);
-int hal_device_get_property_type (LibHalContext *ctx,
- const char *udi,
- const char *key);
+dbus_bool_t libhal_device_remove_property (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
+
+LibHalPropertyType libhal_device_get_property_type (LibHalContext *ctx,
+ const char *udi,
+ const char *key,
+ DBusError *error);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -221,10 +274,11 @@
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-LibHalPropertySet *hal_device_get_all_properties (LibHalContext *ctx,
- const char *udi);
+LibHalPropertySet *libhal_device_get_all_properties (LibHalContext *ctx,
+ const char *udi,
+ DBusError *error);
-void hal_free_property_set (LibHalPropertySet * set);
+void libhal_free_property_set (LibHalPropertySet *set);
/** Iterator for inspecting all properties */
struct LibHalPropertySetIterator_s {
@@ -239,71 +293,88 @@
typedef struct LibHalPropertySetIterator_s LibHalPropertySetIterator;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-void hal_psi_init (LibHalPropertySetIterator * iter,
- LibHalPropertySet * set);
+void libhal_psi_init (LibHalPropertySetIterator *iter, LibHalPropertySet *set);
-dbus_bool_t hal_psi_has_more (LibHalPropertySetIterator * iter);
-void hal_psi_next (LibHalPropertySetIterator * iter);
+dbus_bool_t libhal_psi_has_more (LibHalPropertySetIterator *iter);
+void libhal_psi_next (LibHalPropertySetIterator *iter);
-int hal_psi_get_type (LibHalPropertySetIterator * iter);
+LibHalPropertyType libhal_psi_get_type (LibHalPropertySetIterator *iter);
-char *hal_psi_get_key (LibHalPropertySetIterator * iter);
+char *libhal_psi_get_key (LibHalPropertySetIterator *iter);
-char *hal_psi_get_string (LibHalPropertySetIterator * iter);
-dbus_int32_t hal_psi_get_int (LibHalPropertySetIterator * iter);
-dbus_uint64_t hal_psi_get_uint64 (LibHalPropertySetIterator * iter);
-double hal_psi_get_double (LibHalPropertySetIterator * iter);
-dbus_bool_t hal_psi_get_bool (LibHalPropertySetIterator * iter);
+char *libhal_psi_get_string (LibHalPropertySetIterator *iter);
+dbus_int32_t libhal_psi_get_int (LibHalPropertySetIterator *iter);
+dbus_uint64_t libhal_psi_get_uint64 (LibHalPropertySetIterator *iter);
+double libhal_psi_get_double (LibHalPropertySetIterator *iter);
+dbus_bool_t libhal_psi_get_bool (LibHalPropertySetIterator *iter);
+char **libhal_psi_get_strlist (LibHalPropertySetIterator *iter);
-void hal_free_string_array (char **str_array);
-void hal_free_string (char *str);
+void libhal_free_string_array (char **str_array);
+void libhal_free_string (char *str);
-char *hal_agent_new_device (LibHalContext *ctx);
-dbus_bool_t hal_agent_commit_to_gdl (LibHalContext *ctx,
- const char *temp_udi,
- const char *udi);
-dbus_bool_t hal_agent_remove_device (LibHalContext *ctx,
- const char *udi);
-dbus_bool_t hal_agent_merge_properties (LibHalContext *ctx,
- const char *target_udi,
- const char *source_udi);
-dbus_bool_t hal_agent_device_matches (LibHalContext *ctx,
- const char *udi1,
- const char *udi2,
- const char *property_namespace);
+char *libhal_agent_new_device (LibHalContext *ctx, DBusError *error);
-char **hal_manager_find_device_string_match (LibHalContext *ctx,
- const char *key,
- const char *value,
- int *num_devices);
+dbus_bool_t libhal_agent_commit_to_gdl (LibHalContext *ctx,
+ const char *temp_udi,
+ const char *udi,
+ DBusError *error);
+dbus_bool_t libhal_agent_remove_device (LibHalContext *ctx,
+ const char *udi,
+ DBusError *error);
-dbus_bool_t hal_device_add_capability (LibHalContext *ctx,
- const char *udi,
- const char *capability);
+dbus_bool_t libhal_agent_merge_properties (LibHalContext *ctx,
+ const char *target_udi,
+ const char *source_udi,
+ DBusError *error);
-dbus_bool_t hal_device_query_capability (LibHalContext *ctx,
- const char *udi,
- const char *capability);
+dbus_bool_t libhal_agent_device_matches (LibHalContext *ctx,
+ const char *udi1,
+ const char *udi2,
+ const char *property_namespace,
+ DBusError *error);
-char **hal_find_device_by_capability (LibHalContext *ctx,
- const char *capability,
- int *num_devices);
+char **libhal_manager_find_device_string_match (LibHalContext *ctx,
+ const char *key,
+ const char *value,
+ int *num_devices,
+ DBusError *error);
-int hal_device_property_watch_all (LibHalContext *ctx);
-int hal_device_add_property_watch (LibHalContext *ctx,
- const char *udi);
-int hal_device_remove_property_watch (LibHalContext *ctx,
- const char *udi);
-dbus_bool_t hal_device_lock (LibHalContext *ctx,
- const char *udi,
- const char *reason_to_lock,
- char **reason_why_locked);
+dbus_bool_t libhal_device_add_capability (LibHalContext *ctx,
+ const char *udi,
+ const char *capability,
+ DBusError *error);
-dbus_bool_t hal_device_unlock (LibHalContext *ctx,
- const char *udi);
+dbus_bool_t libhal_device_query_capability (LibHalContext *ctx,
+ const char *udi,
+ const char *capability,
+ DBusError *error);
+
+char **libhal_find_device_by_capability (LibHalContext *ctx,
+ const char *capability,
+ int *num_devices,
+ DBusError *error);
+
+dbus_bool_t libhal_device_property_watch_all (LibHalContext *ctx,
+ DBusError *error);
+dbus_bool_t libhal_device_add_property_watch (LibHalContext *ctx,
+ const char *udi,
+ DBusError *error);
+dbus_bool_t libhal_device_remove_property_watch (LibHalContext *ctx,
+ const char *udi,
+ DBusError *error);
+
+dbus_bool_t libhal_device_lock (LibHalContext *ctx,
+ const char *udi,
+ const char *reason_to_lock,
+ char **reason_why_locked,
+ DBusError *error);
+
+dbus_bool_t libhal_device_unlock (LibHalContext *ctx,
+ const char *udi,
+ DBusError *error);
/** @} */
- Previous message: hal/po da.po, 1.8, 1.9 de.po, 1.9, 1.10 fr.po, 1.8, 1.9 hu.po, 1.3,
1.4 it.po, 1.2, 1.3 nl.po, 1.7, 1.8 pt.po, 1.3, 1.4 ru.po, 1.3, 1.4
- Next message: hal/tools/linux hal_hotplug_map.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list