hal/hald/linux2/probing probe-hiddev.c, 1.1, 1.2 probe-input.c, 1.4, 1.5 probe-pc-floppy.c, 1.1, 1.2 probe-printer.c, 1.1, 1.2 probe-smbios.c, 1.1, 1.2 probe-storage.c, 1.6, 1.7 probe-volume.c, 1.7, 1.8

David Zeuthen david at freedesktop.org
Fri Apr 8 11:10:22 PDT 2005


Update of /cvs/hal/hal/hald/linux2/probing
In directory gabe:/tmp/cvs-serv32581/hald/linux2/probing

Modified Files:
	probe-hiddev.c probe-input.c probe-pc-floppy.c probe-printer.c 
	probe-smbios.c probe-storage.c probe-volume.c 
Log Message:
2005-04-08  David Zeuthen  <davidz at redhat.com>

	Make all hal helpers use a direct connection to hald rather than
	going through the bus. This is for both performance and security
	reasons. Also, fix the reconnect issue and don't connect to the
	system message bus before probing is done.

	* configure.in: Require dbus 0.33; that, for now, means D-BUS CVS
	HEAD since it requires the patch in fd.o bug #2889 and D-BUS made
	a post-release version bump. I'll look into doing a D-BUS release
	soon.

	* libhal/libhal.h: Export prototype for libhal_ctx_init_direct()

	* libhal/libhal.c (libhal_ctx_init_direct): New convenience function
	for connecting directly to hald instead of going through the message
	bus (requires the address in the HALD_DIRECT_ADDR environment variable)

	* hald/util.c (hal_util_helper_invoke): Export the local hald dbus
	server address in HALD_DIRECT_ADDR

	* hald/hald_dbus.c (manager_send_signal_device_added): Handle the
	case where we're not connected to the system message bus
	(manager_send_signal_device_removed): -do-
	(manager_send_signal_new_capability): -do-
	(device_property_atomic_update_end): -do-
	(device_send_signal_property_modified): -do-
	(device_send_signal_condition): -do-
	(device_set_property): Always allow local interface
	(device_add_capability): -do-
	(device_remove_property): -do-
	(device_rescan): -do-
	(device_reprobe): -do-
	(device_emit_condition): -do-
	(hald_dbus_filter_handle_methods): New function
	(hald_dbus_filter_function): Move bulk of functionality to the new
	hald_dbus_filter_handle_methods() and pass local_interface==FALSE.
	Handle Disconnect from local libdbus properly and attempt to
	reconnect to the system message bus every so often (every 3 secs)
	(local_server_message_handler): New function
	(local_server_unregister_handler): New function
	(local_server_handle_connection): New function
	(hald_dbus_local_server_addr): New function
	(hald_dbus_local_server_init): New function

	* hald/hald.c (main): Register a local dbus server instead of
	connection to the system bus as startup
	(osspec_probe_done): Only connect to the system bus once probing
	is done

	* tools/fstab-sync.c (main): Use direct connection

	* hald/linux2/probing/probe-volume.c (main): Use direct connection

	* hald/linux2/probing/probe-storage.c (main): Use direct connection

	* hald/linux2/probing/probe-smbios.c (main): Use direct connection

	* hald/linux2/probing/probe-printer.c (main): Use direct connection

	* hald/linux2/probing/probe-hiddev.c (main): Use direct connection

	* hald/linux2/probing/probe-input.c (main): Use direct connection

	* hald/linux2/addons/addon-usb-csr.c (main): Use direct connection

	* hald/linux2/addons/addon-storage.c (main): Use direct connection

	* hald/linux2/addons/addon-hid-ups.c (main): Use direct connection

	* hald/linux2/addons/addon-acpi.c (main): Use direct connection

	* hald/linux2/probing/probe-pc-floppy.c (main): Remove all references
	to hal and dbus since this program just returns the result in the
	exit code



Index: probe-hiddev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-hiddev.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- probe-hiddev.c	4 Feb 2005 05:24:25 -0000	1.1
+++ probe-hiddev.c	8 Apr 2005 18:10:20 -0000	1.2
@@ -65,14 +65,7 @@
 		goto out;
 
 	dbus_error_init (&error);
-	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
-		goto out;
-
-	if ((ctx = libhal_ctx_new ()) == NULL)
-		goto out;
-	if (!libhal_ctx_set_dbus_connection (ctx, conn))
-		goto out;
-	if (!libhal_ctx_init (ctx, &error))
+	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
 	device_file = getenv ("HAL_PROP_HIDDEV_DEVICE");

Index: probe-input.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-input.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- probe-input.c	2 Feb 2005 21:14:18 -0000	1.4
+++ probe-input.c	8 Apr 2005 18:10:20 -0000	1.5
@@ -142,14 +142,7 @@
 		goto out;
 
 	dbus_error_init (&error);
-	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
-		goto out;
-
-	if ((ctx = libhal_ctx_new ()) == NULL)
-		goto out;
-	if (!libhal_ctx_set_dbus_connection (ctx, conn))
-		goto out;
-	if (!libhal_ctx_init (ctx, &error))
+	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
 	device_file = getenv ("HAL_PROP_INPUT_DEVICE");

Index: probe-pc-floppy.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-pc-floppy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- probe-pc-floppy.c	25 Feb 2005 22:01:14 -0000	1.1
+++ probe-pc-floppy.c	8 Apr 2005 18:10:20 -0000	1.2
@@ -53,9 +53,6 @@
 	int ret;
 	char *udi;
 	char *device_file;
-	LibHalContext *ctx = NULL;
-	DBusError error;
-	DBusConnection *conn;
 	char name[256];
 	struct floppy_drive_struct ds;
 
@@ -107,11 +104,5 @@
 	if (fd >= 0)
 		close (fd);
 
-	if (ctx != NULL) {
-		dbus_error_init (&error);
-		libhal_ctx_shutdown (ctx, &error);
-		libhal_ctx_free (ctx);
-	}
-
 	return ret;
 }

Index: probe-printer.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-printer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- probe-printer.c	22 Feb 2005 20:18:04 -0000	1.1
+++ probe-printer.c	8 Apr 2005 18:10:20 -0000	1.2
@@ -74,14 +74,7 @@
 		goto out;
 
 	dbus_error_init (&error);
-	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
-		goto out;
-
-	if ((ctx = libhal_ctx_new ()) == NULL)
-		goto out;
-	if (!libhal_ctx_set_dbus_connection (ctx, conn))
-		goto out;
-	if (!libhal_ctx_init (ctx, &error))
+	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
 	if ((getenv ("HALD_VERBOSE")) != NULL)

Index: probe-smbios.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-smbios.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- probe-smbios.c	13 Mar 2005 01:48:24 -0000	1.1
+++ probe-smbios.c	8 Apr 2005 18:10:20 -0000	1.2
@@ -86,14 +86,7 @@
 		is_verbose = TRUE;
 
 	dbus_error_init (&error);
-	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
-		goto out;
-
-	if ((ctx = libhal_ctx_new ()) == NULL)
-		goto out;
-	if (!libhal_ctx_set_dbus_connection (ctx, conn))
-		goto out;
-	if (!libhal_ctx_init (ctx, &error))
+	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
 	pipe (dmipipe);	

Index: probe-storage.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-storage.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- probe-storage.c	5 Apr 2005 16:31:31 -0000	1.6
+++ probe-storage.c	8 Apr 2005 18:10:20 -0000	1.7
@@ -137,14 +137,7 @@
 		only_check_for_fs = FALSE;
 
 	dbus_error_init (&error);
-	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
-		goto out;
-
-	if ((ctx = libhal_ctx_new ()) == NULL)
-		goto out;
-	if (!libhal_ctx_set_dbus_connection (ctx, conn))
-		goto out;
-	if (!libhal_ctx_init (ctx, &error))
+	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
 	dbg ("Doing probe-storage for %s (bus %s) (drive_type %s) (udi=%s) (--only-check-for-fs==%d)", 

Index: probe-volume.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-volume.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- probe-volume.c	6 Apr 2005 19:45:09 -0000	1.7
+++ probe-volume.c	8 Apr 2005 18:10:20 -0000	1.8
@@ -169,14 +169,7 @@
 		is_verbose = TRUE;
 
 	dbus_error_init (&error);
-	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
-		goto out;
-
-	if ((ctx = libhal_ctx_new ()) == NULL)
-		goto out;
-	if (!libhal_ctx_set_dbus_connection (ctx, conn))
-		goto out;
-	if (!libhal_ctx_init (ctx, &error))
+	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
 	dbg ("Doing probe-volume for %s\n", device_file);




More information about the hal-commit mailing list