hal/hald/linux block_class_device.c,1.42,1.43 osspec.c,1.26,1.27
David Zeuthen
david at freedesktop.org
Wed Jul 21 10:14:56 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv14640a/hald/linux
Modified Files:
block_class_device.c osspec.c
Log Message:
2004-07-21 David Zeuthen <david at fubar.dk>
Commit of first stab at callouts for shutdown; needs some more work.
Now to update the spec
* hald/device_info.c: (scan_fdi_files): Remove some noisy debug
* hald/hald.c:
(handle_sigterm): New function
(sigterm_iochn_data): New function
(main): Handle SIGTERM, setup GIOChannel for safe handling of POSIX
signal
* hald/linux/block_class_device.c:
(detect_media): Comment out noisy EBUSY debug
* hald/linux/osspec.c:
(visit_class_device): Removed unused dir variable
(shutdown_callouts_finished): New function
(do_shutdown_callouts): New function
(osspec_shutdown): New function
* hald/osspec.h: Add prototype for osspec_shutdown()
Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- block_class_device.c 20 Jul 2004 20:39:41 -0000 1.42
+++ block_class_device.c 21 Jul 2004 17:14:54 -0000 1.43
@@ -627,7 +627,7 @@
/* this means the disc is mounted or some other app,
* like a cd burner, has opened O_EXCL */
if (errno == EBUSY) {
- HAL_INFO (("*** EBUSY for %s", device_file));
+ /*HAL_INFO (("*** EBUSY for %s", device_file));*/
return FALSE;
}
Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- osspec.c 20 Jul 2004 17:27:16 -0000 1.26
+++ osspec.c 21 Jul 2004 17:14:54 -0000 1.27
@@ -134,7 +134,6 @@
{
int i;
struct sysfs_class_device *class_device;
- struct sysfs_directory *dir;
class_device = sysfs_open_class_device_path (path);
if (class_device == NULL) {
@@ -711,4 +710,50 @@
return DBUS_HANDLER_RESULT_HANDLED;
}
+
+
+/* number of devices for whom the shutdown callouts are pending */
+static int num_shutdown_devices_remaining;
+
+static void
+shutdown_callouts_finished (HalDevice *d, gpointer user_data)
+{
+ HAL_INFO (("entering for udi=%s", d->udi));
+
+ num_shutdown_devices_remaining--;
+
+ if (num_shutdown_devices_remaining == 0) {
+ HAL_INFO (("All devices shutdown callouts done"));
+ /* @todo Should return to hald.c though a gobject signal */
+ exit (0);
+ }
+}
+
+
+static gboolean
+do_shutdown_callouts (HalDeviceStore *store, HalDevice *device,
+ gpointer user_data)
+{
+ HAL_INFO (("doing shutdown callouts for udi %s", device->udi));
+
+ num_shutdown_devices_remaining++;
+
+ g_signal_connect (device, "callouts_finished",
+ G_CALLBACK (shutdown_callouts_finished), NULL);
+ hal_callout_device (device, FALSE);
+ return TRUE;
+}
+
+/* This function is documented in ../osspec.h */
+void
+osspec_shutdown ()
+{
+ HAL_INFO (("entering"));
+
+ num_shutdown_devices_remaining = 0;
+ hal_device_store_foreach (hald_get_gdl (),
+ do_shutdown_callouts,
+ NULL);
+}
+
/** @} */
More information about the hal-commit
mailing list