hal/hald debug-hald.sh, 1.6, 1.7 hald_dbus.c, 1.53, 1.54 hald_dbus.h,
1.11, 1.12 valgrind-hald.sh, 1.3, 1.4
David Zeuthen
david at freedesktop.org
Sun Feb 12 13:47:30 PST 2006
Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv15287/hald
Modified Files:
debug-hald.sh hald_dbus.c hald_dbus.h valgrind-hald.sh
Log Message:
2006-02-12 David Zeuthen <davidz at redhat.com>
* tools/hal-system-storage-unmount (MOUNT_POINT): Attempt to use
volume.mount_point if we cannot find
info.hal_mount.created_mount_point
* libhal/libhal.h: Export prototype for new function
libhal_ctx_get_dbus_connection()
* libhal/libhal.c (libhal_ctx_get_dbus_connection): New function
* hald/linux2/addons/addon-storage.c (force_unmount): Use a the
Unmount() hal method to lazy unmount
* hald/linux2/osspec.c (hald_udev_data): Ugh ugh ugh.. clear
buffer before receiving data from udev.. we didn't use to do this
and we got all sorts of weird side-effects since we'd for instance
pick up DEVNAME='/dev/sdb' and _then_ DEVNAME='/dev/sda1' for
/sys/block/sdb.. This was because this data was left in the buffer
from the old run. It now appears to work..
* hald/linux2/blockdev.c (force_unmount_cb): New function, pass
end_token to hal_util_callout_device_remove()
(force_unmount): Use the Unmount method call to lazy unmount, thus
making sure we don't block
(hotplug_event_begin_remove_blockdev): Pass end_token to force_unmount
and let that function invoke hal_util_callout_device_remove()
* hald/hald_dbus.c (hald_exec_method_cb, hald_exec_method): Make
this work for helpers using a direct connection to hald
(hald_dbus_filter_handle_methods): Pass local_interface to
hald_exec_method
* hald/valgrind-hald.sh, /debug-hald.sh: Update to use 'pwd' just
like run-hald.sh was updated
Index: debug-hald.sh
===================================================================
RCS file: /cvs/hal/hal/hald/debug-hald.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- debug-hald.sh 21 Jan 2006 16:54:03 -0000 1.6
+++ debug-hald.sh 12 Feb 2006 21:47:28 -0000 1.7
@@ -1,7 +1,7 @@
#!/bin/sh
-export HALD_RUNNER_PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux
-export PATH=../hald-runner:$PATH
+export HALD_RUNNER_PATH=`pwd`/linux2:`pwd`/linux2/probing:`pwd`/linux2/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/linux
+export PATH=`pwd`/../hald-runner:$PATH
export HAL_FDI_SOURCE_PREPROBE=../fdi/preprobe
export HAL_FDI_SOURCE_INFORMATION=../fdi/information
export HAL_FDI_SOURCE_POLICY=../fdi/policy
Index: hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- hald_dbus.c 21 Jan 2006 16:54:04 -0000 1.53
+++ hald_dbus.c 12 Feb 2006 21:47:28 -0000 1.54
@@ -2479,17 +2479,19 @@
static void
hald_exec_method_cb (HalDevice *d, guint32 exit_type,
- gint return_code, gchar **error,
- gpointer data1, gpointer data2)
+ gint return_code, gchar **error,
+ gpointer data1, gpointer data2)
{
dbus_uint32_t result;
DBusMessage *reply = NULL;
DBusMessage *message;
DBusMessageIter iter;
+ DBusConnection *conn;
gchar *exp_name = NULL;
gchar *exp_detail = NULL;
message = (DBusMessage *) data1;
+ conn = (DBusConnection *) data2;
if (exit_type == HALD_RUN_SUCCESS && error != NULL &&
error[0] != NULL && error[1] != NULL) {
@@ -2502,8 +2504,8 @@
if (exit_type != HALD_RUN_SUCCESS) {
reply = dbus_message_new_error (message, "org.freedesktop.Hal.Device.UnknownError", "An unknown error occured");
- if (dbus_connection != NULL) {
- if (!dbus_connection_send (dbus_connection, reply, NULL))
+ if (conn != NULL) {
+ if (!dbus_connection_send (conn, reply, NULL))
DIE (("No memory"));
}
dbus_message_unref (reply);
@@ -2516,8 +2518,8 @@
DIE (("No memory"));
}
}
- if (dbus_connection != NULL) {
- if (!dbus_connection_send (dbus_connection, reply, NULL))
+ if (conn != NULL) {
+ if (!dbus_connection_send (conn, reply, NULL))
DIE (("No memory"));
}
dbus_message_unref (reply);
@@ -2532,8 +2534,8 @@
dbus_message_iter_init_append (reply, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &result);
- if (dbus_connection != NULL) {
- if (!dbus_connection_send (dbus_connection, reply, NULL))
+ if (conn != NULL) {
+ if (!dbus_connection_send (conn, reply, NULL))
DIE (("No memory"));
}
@@ -2544,31 +2546,36 @@
}
static DBusHandlerResult
-hald_exec_method (HalDevice *d, DBusConnection *connection, DBusMessage *message, const char *execpath)
+hald_exec_method (HalDevice *d, DBusConnection *connection, dbus_bool_t local_interface,
+ DBusMessage *message, const char *execpath)
{
int type;
GString *stdin_str;
DBusMessageIter iter;
- const char *sender;
char *extra_env[2];
char uid_export[128];
/* add calling uid */
extra_env[0] = NULL;
- sender = dbus_message_get_sender (message);
- if (sender != NULL) {
- DBusError error;
- unsigned long uid;
-
- dbus_error_init (&error);
- uid = dbus_bus_get_unix_user (connection, sender, &error);
- if (!dbus_error_is_set (&error)) {
- sprintf (uid_export, "HAL_METHOD_INVOKED_BY_UID=%lu", uid);
- extra_env[0] = uid_export;
- extra_env[1] = NULL;
- HAL_INFO(("%s", uid_export));
+ if (local_interface) {
+ extra_env[0] = "HAL_METHOD_INVOKED_BY_UID=0";
+ } else {
+ const char *sender;
+
+ sender = dbus_message_get_sender (message);
+ if (sender != NULL) {
+ DBusError error;
+ unsigned long uid;
+
+ dbus_error_init (&error);
+ uid = dbus_bus_get_unix_user (connection, sender, &error);
+ if (!dbus_error_is_set (&error)) {
+ sprintf (uid_export, "HAL_METHOD_INVOKED_BY_UID=%lu", uid);
+ extra_env[0] = uid_export;
+ }
}
}
+ extra_env[1] = NULL;
/* prepare stdin with parameters */
stdin_str = g_string_sized_new (256); /* default size for passing params; can grow */
@@ -2673,11 +2680,11 @@
/* no timeout */
hald_runner_run_method(d,
- execpath, extra_env,
- stdin_str->str, TRUE,
- 0,
- hald_exec_method_cb,
- (gpointer) message, NULL);
+ execpath, extra_env,
+ stdin_str->str, TRUE,
+ 0,
+ hald_exec_method_cb,
+ (gpointer) message, (gpointer) connection);
dbus_message_ref (message);
g_string_free (stdin_str, TRUE);
@@ -2892,7 +2899,8 @@
HAL_INFO (("OK for method '%s' with signature '%s' on interface '%s' for UDI '%s' and execpath '%s'", method, signature, interface, udi, execpath));
- return hald_exec_method (d, connection, message, execpath);
+ return hald_exec_method (d, connection, local_interface,
+ message, execpath);
}
}
Index: hald_dbus.h
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- hald_dbus.h 21 Jan 2006 02:45:27 -0000 1.11
+++ hald_dbus.h 12 Feb 2006 21:47:28 -0000 1.12
@@ -94,4 +94,5 @@
DBusHandlerResult hald_dbus_filter_function (DBusConnection * connection, DBusMessage * message, void *user_data);
char *hald_dbus_local_server_addr (void);
+
#endif /* HAL_DBUS_H */
Index: valgrind-hald.sh
===================================================================
RCS file: /cvs/hal/hal/hald/valgrind-hald.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- valgrind-hald.sh 21 Jan 2006 16:54:04 -0000 1.3
+++ valgrind-hald.sh 12 Feb 2006 21:47:28 -0000 1.4
@@ -1,7 +1,7 @@
#!/bin/sh
-export HALD_RUNNER_PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux
-export PATH=../hald-runner:$PATH
+export HALD_RUNNER_PATH=`pwd`/linux2:`pwd`/linux2/probing:`pwd`/linux2/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/linux
+export PATH=`pwd`/../hald-runner:$PATH
export HAL_FDI_SOURCE_PREPROBE=../fdi/preprobe
export HAL_FDI_SOURCE_INFORMATION=../fdi/information
export HAL_FDI_SOURCE_POLICY=../fdi/policy
More information about the hal-commit
mailing list