hal/hald hald.c,1.24,1.25

David Zeuthen david at freedesktop.org
Fri Feb 11 14:01:10 PST 2005


Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv4717/hald

Modified Files:
	hald.c 
Log Message:
2005-02-11  David Zeuthen  <davidz at redhat.com>

	With this path, all storage devices should be working just as
	well as on the 0.4.x branch. 

	In fact, since we're doing things in separate processes hald now
	nicely handles my very troublesome USB 6in1 card reader. There's
	other improvements too; we handle media with non-partitioned file
	systems _a lot nicer_, especially those on PCMCIA card
	readers (driven by ide-cs) since we now have logic to discard
	hotplug rem/add for those partitions.

	Rock on.

	* libhal/libhal.h: Add prototypes for libhal_device_rescan()
	and libhal_device_reprobe()

	* libhal/libhal.c (libhal_device_rescan): New function
	(libhal_device_reprobe): New function

	* hald/linux2/probing/probe-volume.c (main): Be able to probe for
	volumes on main block devices. Retrieve optical disc properties
	if applicable.

	* hald/linux2/probing/probe-storage.c (is_mounted): New function
	(main): Add a new option --only-check-for-media which is used on
	Rescan() of a storage device. Check for fs on main block device or
	a disc in the optical drive. Return code 2 if that is the case.

	* hald/linux2/addons/addon-storage.c (force_unmount): New function
	(unmount_childs): New function
	(is_mounted): New function
	(main): Do lazy unmount, if necessary, when media goes away. Handle
	polling on optical drives.

	* hald/linux2/hotplug.h: Add prototype for hotplug_event_reposted()
	and hotplug_event_enqueue_at_front().

	* hald/linux2/hotplug.c (hotplug_event_reposted): New function;
	like event_end but without deleting the hotplug event (useful
	for reordering events)
	(hotplug_event_enqueue_at_front): New function; to insert events
	at the front of the queue

	* hald/linux2/blockdev.c:
	(generate_fakevolume_hotplug_event_add_for_storage_device): New
	function (and what a nice long name :-/)
	(add_blockdev_probing_helper_done): Check result from hald-probe-
	storage and add a new fakevolume add event if one was detected.
	(hotplug_event_begin_add_blockdev): Handle fakevolume add events.
	Add some more debug spewage when things fail.
	(force_unmount): New function
	(hotplug_event_begin_remove_blockdev): Handle fakevolume remove
	events; reorder queue to process non-handled volume before
	the storage device. Nice.
	(block_rescan_storage_done): New function
	(blockdev_rescan_device): Actually do something here; a Rescan()
	method call on a storage device will induce searching a filesystem
	on the main block device

	* hald/hald.c (main): Add new master_slave code but comment it out
	for now

	* fdi/20freedesktop/lexar-media-cf-reader.fdi: Fix up

	* fdi/20freedesktop/6in1-card-reader.fdi: Fix up to use new way
	of figuring vendor_id/product_id etc.



Index: hald.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- hald.c	8 Feb 2005 21:37:47 -0000	1.24
+++ hald.c	11 Feb 2005 22:01:08 -0000	1.25
@@ -44,6 +44,9 @@
 
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+/*#include "master_slave.h"*/
 
 #include "logger.h"
 #include "hald.h"
@@ -407,14 +410,19 @@
 		}
 	}
 
-	if (!retain_privs)
-		drop_privileges();
-
 	if (hald_is_verbose)
 		logger_enable ();
 	else
 		logger_disable ();
 
+	/* will fork into two; only the child will return here if we are successful */
+	/*master_slave_setup ();*/
+
+	if (!retain_privs)
+		drop_privileges();
+
+	loop = g_main_loop_new (NULL, FALSE);
+
 	HAL_INFO ((PACKAGE_STRING));
 	if (opt_become_daemon)
 		HAL_INFO (("Will daemonize"));
@@ -426,7 +434,7 @@
 		int dev_null_fd;
 		int pf;
 		char pid[9];
-
+		
 		HAL_INFO (("Becoming a daemon"));
 
 		if (pipe (startup_daemonize_pipe) != 0) {
@@ -519,8 +527,6 @@
 	if (!hald_dbus_init ())
 		return 1;
 
-	loop = g_main_loop_new (NULL, FALSE);
-
 	/* initialize operating system specific parts */
 	osspec_init ();
 




More information about the hal-commit mailing list