hal/tools fstab-sync.c,1.32,1.33

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


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv32581/tools

Modified Files:
	fstab-sync.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: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- fstab-sync.c	16 Feb 2005 21:25:35 -0000	1.32
+++ fstab-sync.c	8 Apr 2005 18:10:20 -0000	1.33
@@ -1788,21 +1788,8 @@
 	  }
 
   dbus_error_init (&error);	
-  conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
-  if (conn == NULL) {
-	  fprintf (stderr, "error: dbus_bus_get: %s: %s\n", error.name, error.message);
-	  goto out;
-  }		
-  if ((hal_context = libhal_ctx_new ()) == NULL) {
-	  fprintf (stderr, "error: libhal_ctx_new\n");
-	  goto out;
-  }
-  if (!libhal_ctx_set_dbus_connection (hal_context, conn)) {
-	  fprintf (stderr, "error: libhal_ctx_set_dbus_connection: %s: %s\n", error.name, error.message);
-	  goto out;
-  }
-  if (!libhal_ctx_init (hal_context, &error)) {
-	  fprintf (stderr, "error: libhal_ctx_init: %s: %s\n", error.name, error.message);
+  if ((hal_context = libhal_ctx_init_direct (&error)) == NULL) {
+	  fprintf (stderr, "error: libhal_ctx_init_direct: %s: %s\n", error.name, error.message);
 	  goto out;
   }
 




More information about the hal-commit mailing list