hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Thu Jul 27 17:18:23 PDT 2006


 Makefile.am                                           |   23 
 doc/api/tmpl/config.sgml                              |    7 
 doc/api/tmpl/dlist.sgml                               |  286 ----
 doc/api/tmpl/hal-unused.sgml                          | 1137 +++++++++++++++++-
 doc/api/tmpl/hal_block.sgml                           |   23 
 doc/api/tmpl/hal_ide.sgml                             |   32 
 doc/api/tmpl/hal_input.sgml                           |   35 
 doc/api/tmpl/hal_monitor.sgml                         |   16 
 doc/api/tmpl/hal_net.sgml                             |   23 
 doc/api/tmpl/hal_pci.sgml                             |   23 
 doc/api/tmpl/hal_scsi.sgml                            |   32 
 doc/api/tmpl/hal_usb.sgml                             |   23 
 doc/api/tmpl/libhal-storage.sgml                      |    9 
 doc/api/tmpl/libhal.sgml                              |   13 
 doc/api/tmpl/logging.sgml                             |   22 
 doc/api/tmpl/main.sgml                                |  178 --
 doc/api/tmpl/sysfs.sgml                               |   51 
 doc/api/tmpl/util.sgml                                |  278 +++-
 fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi |   21 
 fdi/policy/10osvendor/20-storage-methods.fdi          |   14 
 hald/hald_dbus.c                                      |    9 
 hald/linux2/addons/addon-keyboard.c                   |    4 
 hald/linux2/addons/addon-macbookpro-backlight.c       |  281 ++++
 hald/linux2/addons/addon-storage.c                    |   13 
 hald/linux2/blockdev.c                                |  196 ++-
 hald/linux2/probing/probe-input.c                     |    8 
 hald/linux2/probing/shared.h                          |   61 
 tools/Makefile.am                                     |   22 
 tools/hal-luks-remove                                 |    5 
 tools/hal-luks-setup                                  |    5 
 tools/hal-luks-teardown                               |    5 
 tools/hal-storage-mount.c                             |  395 +++---
 tools/linux/hal-luks-remove-linux                     |   21 
 33 files changed, 2218 insertions(+), 1053 deletions(-)

New commits:
diff-tree 21150f4e76bbc64e9fc7b343d23d93a714c014d4 (from e5ede9d62de02de7566ff212bee7ff389bd08270)
Author: David Zeuthen <davidz at zelda.fubar.dk>
Date:   Thu Jul 27 20:18:20 2006 -0400

    (forgot to pass -a the first time) git stuff, mount/umount/eject all
    in C, .hal-mtab usage, light_sensor and keyboard_backlight additions
    including example.
    
    Remove ChangeLog and add rules to Makefile.am (from cairo) to generate
    the ChangeLog file from git history.
    
    Add support for light_sensor and keyboard_backlight on my Macbook
    Pro. Add an examply python script to examples/ to show how it's done.
    
    Move Unmount, Eject and related stuff to C. Start using the file
    /media/.hal-mtab instead of .created-by-hal to specify if HAL created
    the mount point. Also list tons of metadata such as uid, session id
    (still unused). Fixes the bug where the unprivileged hald couldn't
    look into /media/foobar/ for the .created-by-hal file. So now doing
    'umount /dev/sda1' on a volume mounted by HAL, makes hald remove the
    mount point as one would expect.

diff --git a/Makefile.am b/Makefile.am
index 144e2f2..15e9d9f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,10 +9,31 @@ pkgconfig_DATA = hal.pc hal-storage.pc
 dbusdir = $(DBUS_SYS_DIR)
 dist_dbus_DATA = hal.conf
 
+MAINTAINERCLEANFILES = ChangeLog
+
+# Creating ChangeLog from git log (taken from cairo/Makefile.am):
+
+ChangeLog: $(srcdir)/ChangeLog
+
+$(srcdir)/ChangeLog:
+	@if test -d "$(srcdir)/.git"; then \
+	  (cd "$(srcdir)" && \
+	  ./missing --run git-log --stat) | fmt --split-only > $@.tmp \
+	  && mv -f $@.tmp $@ \
+	  || ($(RM) $@.tmp; \
+	      echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
+	      (test -f $@ || echo git-log is required to generate this file >> $@)); \
+	else \
+	  test -f $@ || \
+	  (echo A git checkout and git-log is required to generate ChangeLog >&2 && \
+	  echo A git checkout and git-log is required to generate this file >> $@); \
+	fi
+
+.PHONY: ChangeLog $(srcdir)/ChangeLog
 
 DISTCLEANFILES = hal.pc hal-storage.pc intltool-extract intltool-merge intltool-update
 
-EXTRA_DIST = HACKING hal.pc.in hal-storage.pc.in hal.conf.in intltool-extract.in intltool-merge.in intltool-update.in mkinstalldirs
+EXTRA_DIST = HACKING hal.pc.in hal-storage.pc.in hal.conf.in intltool-extract.in intltool-merge.in intltool-update.in mkinstalldirs ChangeLog
 
 clean-local :
 	rm -f *~
diff --git a/doc/api/tmpl/config.sgml b/doc/api/tmpl/config.sgml
index 8cd88b2..fd0c10c 100644
--- a/doc/api/tmpl/config.sgml
+++ b/doc/api/tmpl/config.sgml
@@ -157,6 +157,13 @@ config
 
 
 
+<!-- ##### MACRO HAVE_PCI_PCI_H ##### -->
+<para>
+
+</para>
+
+
+
 <!-- ##### MACRO HAVE_STDINT_H ##### -->
 <para>
 
diff --git a/doc/api/tmpl/dlist.sgml b/doc/api/tmpl/dlist.sgml
index 0745893..b13758f 100644
--- a/doc/api/tmpl/dlist.sgml
+++ b/doc/api/tmpl/dlist.sgml
@@ -17,289 +17,3 @@ dlist
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### STRUCT DL_node ##### -->
-<para>
-
-</para>
-
- at prev: 
- at next: 
- at data: 
-
-<!-- ##### STRUCT Dlist ##### -->
-<para>
-
-</para>
-
- at marker: 
- at count: 
- at data_size: 
- at del_func: 
- at headnode: 
- at head: 
-
-<!-- ##### FUNCTION dlist_new ##### -->
-<para>
-
-</para>
-
- at datasize: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_new_with_delete ##### -->
-<para>
-
-</para>
-
- at datasize: 
- at del_func: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_mark ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_start ##### -->
-<para>
-
-</para>
-
- at Param1: 
-
-
-<!-- ##### FUNCTION dlist_end ##### -->
-<para>
-
-</para>
-
- at Param1: 
-
-
-<!-- ##### FUNCTION dlist_insert ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Param2: 
- at Varargs: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_insert_sorted ##### -->
-<para>
-
-</para>
-
- at list: 
- at new: 
- at sorter: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_delete ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Varargs: 
-
-
-<!-- ##### FUNCTION dlist_push ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Param2: 
-
-
-<!-- ##### FUNCTION dlist_unshift ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Param2: 
-
-
-<!-- ##### FUNCTION dlist_pop ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_shift ##### -->
-<para>
-
-</para>
-
- at Param1: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_destroy ##### -->
-<para>
-
-</para>
-
- at Param1: 
-
-
-<!-- ##### FUNCTION dlist_find_custom ##### -->
-<para>
-
-</para>
-
- at list: 
- at target: 
- at comp: 
- at Returns: 
-
-
-<!-- ##### FUNCTION dlist_transform ##### -->
-<para>
-
-</para>
-
- at list: 
- at node_operation: 
-
-
-<!-- ##### MACRO dlist_prev ##### -->
-<para>
-
-</para>
-
- at A: 
-
-
-<!-- ##### MACRO dlist_next ##### -->
-<para>
-
-</para>
-
- at A: 
-
-
-<!-- ##### MACRO dlist_insert_before ##### -->
-<para>
-
-</para>
-
- at A: 
- at B: 
-
-
-<!-- ##### MACRO dlist_insert_after ##### -->
-<para>
-
-</para>
-
- at A: 
- at B: 
-
-
-<!-- ##### MACRO dlist_delete_before ##### -->
-<para>
-
-</para>
-
- at A: 
-
-
-<!-- ##### MACRO dlist_delete_after ##### -->
-<para>
-
-</para>
-
- at A: 
-
-
-<!-- ##### MACRO dlist_for_each ##### -->
-<para>
-
-</para>
-
- at list: 
-
-
-<!-- ##### MACRO dlist_for_each_rev ##### -->
-<para>
-
-</para>
-
- at list: 
-
-
-<!-- ##### MACRO dlist_for_each_nomark ##### -->
-<para>
-
-</para>
-
- at list: 
- at iterator: 
-
-
-<!-- ##### MACRO dlist_for_each_nomark_rev ##### -->
-<para>
-
-</para>
-
- at list: 
- at iterator: 
-
-
-<!-- ##### MACRO dlist_for_each_data ##### -->
-<para>
-
-</para>
-
- at list: 
- at data_iterator: 
- at datatype: 
-
-
-<!-- ##### MACRO dlist_for_each_data_rev ##### -->
-<para>
-
-</para>
-
- at list: 
- at data_iterator: 
- at datatype: 
-
-
-<!-- ##### MACRO dlist_for_each_data_nomark ##### -->
-<para>
-
-</para>
-
- at list: 
- at iterator: 
- at data_iterator: 
- at datatype: 
-
-
-<!-- ##### MACRO dlist_for_each_data_nomark_rev ##### -->
-<para>
-
-</para>
-
- at list: 
- at iterator: 
- at data_iterator: 
- at datatype: 
-
-
diff --git a/doc/api/tmpl/hal-unused.sgml b/doc/api/tmpl/hal-unused.sgml
index 00e45c3..e4bf5ce 100644
--- a/doc/api/tmpl/hal-unused.sgml
+++ b/doc/api/tmpl/hal-unused.sgml
@@ -1,69 +1,955 @@
+<!-- ##### SECTION ./tmpl/dlist.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/dlist.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/dlist.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/dlist.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/dlist.sgml:Title ##### -->
+dlist
+
+
+<!-- ##### SECTION ./tmpl/hal_block.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_block.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_block.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_block.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_block.sgml:Title ##### -->
+hal_block
+
+
+<!-- ##### SECTION ./tmpl/hal_ide.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_ide.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_ide.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_ide.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_ide.sgml:Title ##### -->
+hal_ide
+
+
+<!-- ##### SECTION ./tmpl/hal_input.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_input.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_input.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_input.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_input.sgml:Title ##### -->
+hal_input
+
+
+<!-- ##### SECTION ./tmpl/hal_monitor.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_monitor.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_monitor.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_monitor.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_monitor.sgml:Title ##### -->
+hal_monitor
+
+
+<!-- ##### SECTION ./tmpl/hal_net.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_net.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_net.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_net.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_net.sgml:Title ##### -->
+hal_net
+
+
+<!-- ##### SECTION ./tmpl/hal_pci.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_pci.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_pci.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_pci.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_pci.sgml:Title ##### -->
+hal_pci
+
+
+<!-- ##### SECTION ./tmpl/hal_scsi.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_scsi.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_scsi.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_scsi.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_scsi.sgml:Title ##### -->
+hal_scsi
+
+
+<!-- ##### SECTION ./tmpl/hal_usb.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_usb.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hal_usb.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_usb.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/hal_usb.sgml:Title ##### -->
+hal_usb
+
+
 <!-- ##### SECTION ./tmpl/libhal-policy.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/libhal-policy.sgml:See_Also ##### -->
+<!-- ##### SECTION ./tmpl/libhal-policy.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/libhal-policy.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/libhal-policy.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/libhal-policy.sgml:Title ##### -->
+libhal-policy
+
+
+<!-- ##### SECTION ./tmpl/logging.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/logging.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/logging.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/logging.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/logging.sgml:Title ##### -->
+logging
+
+
+<!-- ##### SECTION ./tmpl/main.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/main.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/main.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/main.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/main.sgml:Title ##### -->
+main
+
+
+<!-- ##### SECTION ./tmpl/sysfs.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/sysfs.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/sysfs.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/sysfs.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/sysfs.sgml:Title ##### -->
+sysfs
+
+
+<!-- ##### USER_FUNCTION ComputeFDI ##### -->
+<para>
+
+</para>
+
+ at udi: 
+ at append_num: 
+ at Returns: 
+
+<!-- ##### STRUCT DL_node ##### -->
+<para>
+
+</para>
+
+ at prev: 
+ at next: 
+ at data: 
+
+<!-- ##### STRUCT Dlist ##### -->
+<para>
+
+</para>
+
+ at marker: 
+ at count: 
+ at data_size: 
+ at del_func: 
+ at headnode: 
+ at head: 
+
+<!-- ##### MACRO HAL_LINUX_HOTPLUG_TIMEOUT ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF LibHalPolicyContext ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT LibHalPolicyContext_s ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF LibHalPolicyElement ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM LibHalPolicyElementType ##### -->
+<para>
+
+</para>
+
+ at LIBHAL_POLICY_ELEMENT_TYPE_UID: 
+ at LIBHAL_POLICY_ELEMENT_TYPE_GID: 
+
+<!-- ##### STRUCT LibHalPolicyElement_s ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM LibHalPolicyResult ##### -->
+<para>
+
+</para>
+
+ at LIBHAL_POLICY_RESULT_OK: 
+ at LIBHAL_POLICY_RESULT_ERROR: 
+ at LIBHAL_POLICY_RESULT_INVALID_CONTEXT: 
+ at LIBHAL_POLICY_RESULT_PERMISSON_DENIED: 
+ at LIBHAL_POLICY_RESULT_NO_SUCH_POLICY: 
+
+<!-- ##### MACRO SB_BUFFER_SIZE ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO SEEK_BUFFER_SIZE ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO be16_to_cpu ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO be32_to_cpu ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO cpu_to_be32 ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO cpu_to_le16 ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO cpu_to_le32 ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO dbg ##### -->
+<para>
+
+</para>
+
+ at format: 
+ at arg...:
+ at arg...:
+ at arg...:
+ at arg...:
+ at arg...:
+
+<!-- ##### VARIABLE dbus_connection ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION dlist_delete ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Varargs: 
+
+<!-- ##### MACRO dlist_delete_after ##### -->
+<para>
+
+</para>
+
+ at A: 
+
+<!-- ##### MACRO dlist_delete_before ##### -->
+<para>
+
+</para>
+
+ at A: 
+
+<!-- ##### FUNCTION dlist_destroy ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+
+<!-- ##### FUNCTION dlist_end ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+
+<!-- ##### FUNCTION dlist_find_custom ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at target: 
+ at comp: 
+ at Returns: 
+
+<!-- ##### MACRO dlist_for_each ##### -->
+<para>
+
+</para>
+
+ at list: 
+
+<!-- ##### MACRO dlist_for_each_data ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at data_iterator: 
+ at datatype: 
+
+<!-- ##### MACRO dlist_for_each_data_nomark ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at iterator: 
+ at data_iterator: 
+ at datatype: 
+
+<!-- ##### MACRO dlist_for_each_data_nomark_rev ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at iterator: 
+ at data_iterator: 
+ at datatype: 
+
+<!-- ##### MACRO dlist_for_each_data_rev ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at data_iterator: 
+ at datatype: 
+
+<!-- ##### MACRO dlist_for_each_nomark ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at iterator: 
+
+<!-- ##### MACRO dlist_for_each_nomark_rev ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at iterator: 
+
+<!-- ##### MACRO dlist_for_each_rev ##### -->
+<para>
+
+</para>
+
+ at list: 
+
+<!-- ##### FUNCTION dlist_insert ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Param2: 
+ at Varargs: 
+ at Returns: 
+
+<!-- ##### MACRO dlist_insert_after ##### -->
+<para>
+
+</para>
+
+ at A: 
+ at B: 
+
+<!-- ##### MACRO dlist_insert_before ##### -->
+<para>
+
+</para>
+
+ at A: 
+ at B: 
+
+<!-- ##### FUNCTION dlist_insert_sorted ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at new: 
+ at sorter: 
+ at Returns: 
+
+<!-- ##### FUNCTION dlist_mark ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Returns: 
+
+<!-- ##### FUNCTION dlist_new ##### -->
+<para>
+
+</para>
+
+ at datasize: 
+ at Returns: 
+
+<!-- ##### FUNCTION dlist_new_with_delete ##### -->
+<para>
+
+</para>
+
+ at datasize: 
+ at del_func: 
+ at Returns: 
+
+<!-- ##### MACRO dlist_next ##### -->
+<para>
+
+</para>
+
+ at A: 
+
+<!-- ##### FUNCTION dlist_pop ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Returns: 
+
+<!-- ##### MACRO dlist_prev ##### -->
+<para>
+
+</para>
+
+ at A: 
+
+<!-- ##### FUNCTION dlist_push ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Param2: 
+
+<!-- ##### FUNCTION dlist_shift ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Returns: 
+
+<!-- ##### FUNCTION dlist_start ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+
+<!-- ##### FUNCTION dlist_transform ##### -->
+<para>
+
+</para>
+
+ at list: 
+ at node_operation: 
+
+<!-- ##### FUNCTION dlist_unshift ##### -->
+<para>
+
+</para>
+
+ at Param1: 
+ at Param2: 
+
+<!-- ##### MACRO dprintf ##### -->
+<para>
+
+</para>
+
+ at format: 
+ at arg...:
+ at arg...:
+ at arg...:
+ at arg...:
+ at arg...:
+
+<!-- ##### FUNCTION drivers_collect ##### -->
+<para>
+
+</para>
+
+ at bus_name: 
+
+<!-- ##### FUNCTION drivers_lookup ##### -->
+<para>
+
+</para>
+
+ at device_path: 
+ at Returns: 
+
+<!-- ##### FUNCTION etc_mtab_process_all_block_devices ##### -->
+<para>
+
+</para>
+
+ at setup_watcher: 
+
+<!-- ##### FUNCTION find_and_set_physical_device ##### -->
+<para>
+
+</para>
+
+ at udi: 
+
+<!-- ##### FUNCTION find_bcd2 ##### -->
+<para>
+
+</para>
+
+ at pre: 
+ at s: 
+ at Returns: 
+
+<!-- ##### FUNCTION find_double ##### -->
+<para>
+
+</para>
+
+ at pre: 
+ at s: 
+ at Returns: 
+
+<!-- ##### FUNCTION find_parent_udi_from_sysfs_path ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at max_time_to_try: 
+ at Returns: 
+
+<!-- ##### FUNCTION find_string ##### -->
+<para>
+
+</para>
+
+ at pre: 
+ at s: 
+ at Returns: 
+
+<!-- ##### FUNCTION find_udi_by_key_value ##### -->
 <para>
 
 </para>
 
+ at key: 
+ at value: 
+ at max_time_to_try: 
+ at Returns: 
 
-<!-- ##### SECTION ./tmpl/libhal-policy.sgml:Short_Description ##### -->
+<!-- ##### FUNCTION find_udi_from_sysfs_path ##### -->
+<para>
 
+</para>
 
+ at path: 
+ at max_time_to_try: 
+ at Returns: 
 
-<!-- ##### SECTION ./tmpl/libhal-policy.sgml:Stability_Level ##### -->
+<!-- ##### FUNCTION get_last_element ##### -->
+<para>
 
+</para>
 
+ at s: 
+ at Returns: 
 
-<!-- ##### SECTION ./tmpl/libhal-policy.sgml:Title ##### -->
-libhal-policy
+<!-- ##### FUNCTION getpagesize ##### -->
+<para>
 
+</para>
 
-<!-- ##### TYPEDEF LibHalPolicyContext ##### -->
+ at Returns: 
+
+<!-- ##### FUNCTION hal_block_init ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### STRUCT LibHalPolicyContext_s ##### -->
+<!-- ##### FUNCTION hal_block_shutdown ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### TYPEDEF LibHalPolicyElement ##### -->
+<!-- ##### VARIABLE hal_functions ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ENUM LibHalPolicyElementType ##### -->
+<!-- ##### FUNCTION hal_ide_init ##### -->
 <para>
 
 </para>
 
- at LIBHAL_POLICY_ELEMENT_TYPE_UID: 
- at LIBHAL_POLICY_ELEMENT_TYPE_GID: 
 
-<!-- ##### STRUCT LibHalPolicyElement_s ##### -->
+<!-- ##### FUNCTION hal_ide_shutdown ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ENUM LibHalPolicyResult ##### -->
+<!-- ##### FUNCTION hal_input_handle_hotplug_add ##### -->
 <para>
 
 </para>
 
- at LIBHAL_POLICY_RESULT_OK: 
- at LIBHAL_POLICY_RESULT_ERROR: 
- at LIBHAL_POLICY_RESULT_INVALID_CONTEXT: 
- at LIBHAL_POLICY_RESULT_PERMISSON_DENIED: 
- at LIBHAL_POLICY_RESULT_NO_SUCH_POLICY: 
+
+<!-- ##### FUNCTION hal_input_handle_hotplug_remove ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_input_init ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_input_probe ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_input_shutdown ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_monitor_enter ##### -->
+<para>
+
+</para>
+
+ at loop: 
+
+<!-- ##### FUNCTION hal_net_init ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_net_shutdown ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_pci_init ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_pci_shutdown ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_scsi_init ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_scsi_shutdown ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_usb_init ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION hal_usb_shutdown ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE is_probing ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION isascii ##### -->
+<para>
+
+</para>
+
+ at c: 
+ at Returns: 
+
+<!-- ##### MACRO le16_to_cpu ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO le32_to_cpu ##### -->
+<para>
+
+</para>
+
+ at x: 
+
+<!-- ##### MACRO le64_to_cpu ##### -->
+<para>
+
+</para>
+
+ at x: 
 
 <!-- ##### FUNCTION libhal_policy_context_set_txt_source ##### -->
 <para>
@@ -328,3 +1214,218 @@ libhal-policy
 @default_gid: 
 @Returns: 
 
+<!-- ##### FUNCTION lstat ##### -->
+<para>
+
+</para>
+
+ at file_name: 
+ at buf: 
+ at Returns: 
+
+<!-- ##### FUNCTION parse_dec ##### -->
+<para>
+
+</para>
+
+ at str: 
+ at Returns: 
+
+<!-- ##### FUNCTION parse_double ##### -->
+<para>
+
+</para>
+
+ at str: 
+ at Returns: 
+
+<!-- ##### FUNCTION parse_hex ##### -->
+<para>
+
+</para>
+
+ at str: 
+ at Returns: 
+
+<!-- ##### FUNCTION read_single_line ##### -->
+<para>
+
+</para>
+
+ at filename_format: 
+ at Varargs: 
+ at Returns: 
+
+<!-- ##### FUNCTION readlink ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at buf: 
+ at bufsize: 
+ at Returns: 
+
+<!-- ##### FUNCTION rename_and_maybe_add ##### -->
+<para>
+
+</para>
+
+ at udi: 
+ at naming_func: 
+ at namespace: 
+ at Returns: 
+
+<!-- ##### FUNCTION visit_class_device_block ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at class_device: 
+
+<!-- ##### FUNCTION visit_class_device_net ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at class_device: 
+
+<!-- ##### FUNCTION visit_class_device_scsi_device ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at class_device: 
+
+<!-- ##### FUNCTION visit_class_device_scsi_host ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at class_device: 
+
+<!-- ##### FUNCTION visit_device_ide ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at device: 
+
+<!-- ##### FUNCTION visit_device_ide_host ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at device: 
+
+<!-- ##### FUNCTION visit_device_pci ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at device: 
+
+<!-- ##### FUNCTION visit_device_usb ##### -->
+<para>
+
+</para>
+
+ at path: 
+ at device: 
+
+<!-- ##### FUNCTION volume_id_free_buffer ##### -->
+<para>
+
+</para>
+
+ at id: 
+
+<!-- ##### FUNCTION volume_id_get_buffer ##### -->
+<para>
+
+</para>
+
+ at id: 
+ at off: 
+ at len: 
+ at Returns: 
+
+<!-- ##### FUNCTION volume_id_log ##### -->
+<para>
+
+</para>
+
+ at format: 
+ at Varargs: 
+
+<!-- ##### FUNCTION volume_id_set_label_raw ##### -->
+<para>
+
+</para>
+
+ at id: 
+ at buf: 
+ at count: 
+
+<!-- ##### FUNCTION volume_id_set_label_string ##### -->
+<para>
+
+</para>
+
+ at id: 
+ at buf: 
+ at count: 
+
+<!-- ##### FUNCTION volume_id_set_label_unicode16 ##### -->
+<para>
+
+</para>
+
+ at id: 
+ at buf: 
+ at endianess: 
+ at count: 
+
+<!-- ##### FUNCTION volume_id_set_unicode16 ##### -->
+<para>
+
+</para>
+
+ at str: 
+ at len: 
+ at buf: 
+ at endianess: 
+ at count: 
+
+<!-- ##### FUNCTION volume_id_set_usage ##### -->
+<para>
+
+</para>
+
+ at id: 
+ at usage_id: 
+
+<!-- ##### FUNCTION volume_id_set_usage_part ##### -->
+<para>
+
+</para>
+
+ at part: 
+ at usage_id: 
+
+<!-- ##### FUNCTION volume_id_set_uuid ##### -->
+<para>
+
+</para>
+
+ at id: 
+ at buf: 
+ at format: 
+
diff --git a/doc/api/tmpl/hal_block.sgml b/doc/api/tmpl/hal_block.sgml
index 16d2c33..06d4b30 100644
--- a/doc/api/tmpl/hal_block.sgml
+++ b/doc/api/tmpl/hal_block.sgml
@@ -17,26 +17,3 @@ hal_block
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION visit_class_device_block ##### -->
-<para>
-
-</para>
-
- at path: 
- at class_device: 
-
-
-<!-- ##### FUNCTION hal_block_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_block_shutdown ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/hal_ide.sgml b/doc/api/tmpl/hal_ide.sgml
index 30b810d..7cc018b 100644
--- a/doc/api/tmpl/hal_ide.sgml
+++ b/doc/api/tmpl/hal_ide.sgml
@@ -17,35 +17,3 @@ hal_ide
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION visit_device_ide_host ##### -->
-<para>
-
-</para>
-
- at path: 
- at device: 
-
-
-<!-- ##### FUNCTION visit_device_ide ##### -->
-<para>
-
-</para>
-
- at path: 
- at device: 
-
-
-<!-- ##### FUNCTION hal_ide_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_ide_shutdown ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/hal_input.sgml b/doc/api/tmpl/hal_input.sgml
index d6aeea0..1644599 100644
--- a/doc/api/tmpl/hal_input.sgml
+++ b/doc/api/tmpl/hal_input.sgml
@@ -17,38 +17,3 @@ hal_input
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION hal_input_handle_hotplug_add ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_input_handle_hotplug_remove ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_input_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_input_shutdown ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_input_probe ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/hal_monitor.sgml b/doc/api/tmpl/hal_monitor.sgml
index 2aeaa97..8ae07bd 100644
--- a/doc/api/tmpl/hal_monitor.sgml
+++ b/doc/api/tmpl/hal_monitor.sgml
@@ -17,19 +17,3 @@ hal_monitor
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION hal_monitor_enter ##### -->
-<para>
-
-</para>
-
- at loop: 
-
-
-<!-- ##### FUNCTION etc_mtab_process_all_block_devices ##### -->
-<para>
-
-</para>
-
- at setup_watcher: 
-
-
diff --git a/doc/api/tmpl/hal_net.sgml b/doc/api/tmpl/hal_net.sgml
index abbcd3e..dad7dd1 100644
--- a/doc/api/tmpl/hal_net.sgml
+++ b/doc/api/tmpl/hal_net.sgml
@@ -17,26 +17,3 @@ hal_net
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION visit_class_device_net ##### -->
-<para>
-
-</para>
-
- at path: 
- at class_device: 
-
-
-<!-- ##### FUNCTION hal_net_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_net_shutdown ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/hal_pci.sgml b/doc/api/tmpl/hal_pci.sgml
index da554bc..0be624f 100644
--- a/doc/api/tmpl/hal_pci.sgml
+++ b/doc/api/tmpl/hal_pci.sgml
@@ -17,26 +17,3 @@ hal_pci
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION visit_device_pci ##### -->
-<para>
-
-</para>
-
- at path: 
- at device: 
-
-
-<!-- ##### FUNCTION hal_pci_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_pci_shutdown ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/hal_scsi.sgml b/doc/api/tmpl/hal_scsi.sgml
index 64d0667..6eeded1 100644
--- a/doc/api/tmpl/hal_scsi.sgml
+++ b/doc/api/tmpl/hal_scsi.sgml
@@ -17,35 +17,3 @@ hal_scsi
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION visit_class_device_scsi_host ##### -->
-<para>
-
-</para>
-
- at path: 
- at class_device: 
-
-
-<!-- ##### FUNCTION visit_class_device_scsi_device ##### -->
-<para>
-
-</para>
-
- at path: 
- at class_device: 
-
-
-<!-- ##### FUNCTION hal_scsi_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_scsi_shutdown ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/hal_usb.sgml b/doc/api/tmpl/hal_usb.sgml
index cc1f474..dcca3ec 100644
--- a/doc/api/tmpl/hal_usb.sgml
+++ b/doc/api/tmpl/hal_usb.sgml
@@ -17,26 +17,3 @@ hal_usb
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION visit_device_usb ##### -->
-<para>
-
-</para>
-
- at path: 
- at device: 
-
-
-<!-- ##### FUNCTION hal_usb_init ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION hal_usb_shutdown ##### -->
-<para>
-
-</para>
-
-
-
diff --git a/doc/api/tmpl/libhal-storage.sgml b/doc/api/tmpl/libhal-storage.sgml
index 1519de8..53a7ecf 100644
--- a/doc/api/tmpl/libhal-storage.sgml
+++ b/doc/api/tmpl/libhal-storage.sgml
@@ -621,6 +621,15 @@ libhal-storage
 @Returns: 
 
 
+<!-- ##### FUNCTION libhal_volume_get_disc_capacity ##### -->
+<para>
+
+</para>
+
+ at volume: 
+ at Returns: 
+
+
 <!-- ##### FUNCTION libhal_volume_get_udi ##### -->
 <para>
 
diff --git a/doc/api/tmpl/libhal.sgml b/doc/api/tmpl/libhal.sgml
index 309a30b..0e83348 100644
--- a/doc/api/tmpl/libhal.sgml
+++ b/doc/api/tmpl/libhal.sgml
@@ -917,3 +917,16 @@ libhal
 @Returns: 
 
 
+<!-- ##### FUNCTION libhal_device_claim_interface ##### -->
+<para>
+
+</para>
+
+ at ctx: 
+ at udi: 
+ at interface_name: 
+ at introspection_xml: 
+ at error: 
+ at Returns: 
+
+
diff --git a/doc/api/tmpl/logging.sgml b/doc/api/tmpl/logging.sgml
index 24c0f74..05791ed 100644
--- a/doc/api/tmpl/logging.sgml
+++ b/doc/api/tmpl/logging.sgml
@@ -17,25 +17,3 @@ logging
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION volume_id_log ##### -->
-<para>
-
-</para>
-
- at format: 
- at Varargs: 
-
-
-<!-- ##### MACRO dbg ##### -->
-<para>
-
-</para>
-
- at format: 
- at arg...:
- at arg...:
- at arg...:
- at arg...:
- at arg...: 
-
-
diff --git a/doc/api/tmpl/main.sgml b/doc/api/tmpl/main.sgml
index 7619d4f..421bc9b 100644
--- a/doc/api/tmpl/main.sgml
+++ b/doc/api/tmpl/main.sgml
@@ -17,13 +17,6 @@ main
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### MACRO HAL_LINUX_HOTPLUG_TIMEOUT ##### -->
-<para>
-
-</para>
-
-
-
 <!-- ##### MACRO DIE ##### -->
 <para>
 
@@ -32,174 +25,3 @@ main
 @expr: 
 
 
-<!-- ##### VARIABLE is_probing ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION parse_double ##### -->
-<para>
-
-</para>
-
- at str: 
- at Returns: 
-
-
-<!-- ##### FUNCTION parse_dec ##### -->
-<para>
-
-</para>
-
- at str: 
- at Returns: 
-
-
-<!-- ##### FUNCTION parse_hex ##### -->
-<para>
-
-</para>
-
- at str: 
- at Returns: 
-
-
-<!-- ##### FUNCTION find_double ##### -->
-<para>
-
-</para>
-
- at pre: 
- at s: 
- at Returns: 
-
-
-<!-- ##### FUNCTION find_bcd2 ##### -->
-<para>
-
-</para>
-
- at pre: 
- at s: 
- at Returns: 
-
-
-<!-- ##### FUNCTION find_string ##### -->
-<para>
-
-</para>
-
- at pre: 
- at s: 
- at Returns: 
-
-
-<!-- ##### USER_FUNCTION ComputeFDI ##### -->
-<para>
-
-</para>
-
- at udi: 
- at append_num: 
- at Returns: 
-
-
-<!-- ##### FUNCTION rename_and_maybe_add ##### -->
-<para>
-
-</para>
-
- at udi: 
- at naming_func: 
- at namespace: 
- at Returns: 
-
-
-<!-- ##### FUNCTION find_udi_from_sysfs_path ##### -->
-<para>
-
-</para>
-
- at path: 
- at max_time_to_try: 
- at Returns: 
-
-
-<!-- ##### FUNCTION find_parent_udi_from_sysfs_path ##### -->
-<para>
-
-</para>
-
- at path: 
- at max_time_to_try: 
- at Returns: 
-
-
-<!-- ##### FUNCTION get_last_element ##### -->
-<para>
-
-</para>
-
- at s: 
- at Returns: 
-
-
-<!-- ##### FUNCTION read_single_line ##### -->
-<para>
-
-</para>
-
- at filename_format: 
- at Varargs: 
- at Returns: 
-
-
-<!-- ##### FUNCTION find_and_set_physical_device ##### -->
-<para>
-
-</para>
-
- at udi: 
-
-
-<!-- ##### FUNCTION find_udi_by_key_value ##### -->
-<para>
-
-</para>
-
- at key: 
- at value: 
- at max_time_to_try: 
- at Returns: 
-
-
-<!-- ##### FUNCTION drivers_lookup ##### -->
-<para>
-
-</para>
-
- at device_path: 
- at Returns: 
-
-
-<!-- ##### FUNCTION drivers_collect ##### -->
-<para>
-
-</para>
-
- at bus_name: 
-
-
-<!-- ##### VARIABLE hal_functions ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE dbus_connection ##### -->
-<para>
-
-</para>
-
-
diff --git a/doc/api/tmpl/sysfs.sgml b/doc/api/tmpl/sysfs.sgml
index a9c8606..49abd9d 100644
--- a/doc/api/tmpl/sysfs.sgml
+++ b/doc/api/tmpl/sysfs.sgml
@@ -17,54 +17,3 @@ sysfs
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### FUNCTION lstat ##### -->
-<para>
-
-</para>
-
- at file_name: 
- at buf: 
- at Returns: 
-
-
-<!-- ##### FUNCTION readlink ##### -->
-<para>
-
-</para>
-
- at path: 
- at buf: 
- at bufsize: 
- at Returns: 
-
-
-<!-- ##### FUNCTION getpagesize ##### -->
-<para>
-
-</para>
-
- at Returns: 
-
-
-<!-- ##### FUNCTION isascii ##### -->
-<para>
-
-</para>
-
- at c: 
- at Returns: 
-
-
-<!-- ##### MACRO dprintf ##### -->
-<para>
-
-</para>
-
- at format: 
- at arg...:
- at arg...:
- at arg...:
- at arg...:
- at arg...: 
-
-
diff --git a/doc/api/tmpl/util.sgml b/doc/api/tmpl/util.sgml
index 529b958..cd1511b 100644
--- a/doc/api/tmpl/util.sgml
+++ b/doc/api/tmpl/util.sgml
@@ -9,181 +9,349 @@ util
 
 </para>
 
-
 <!-- ##### SECTION See_Also ##### -->
 <para>
 
 </para>
 
-
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### MACRO SB_BUFFER_SIZE ##### -->
+<!-- ##### MACRO HAL_NAME_MAX ##### -->
 <para>
 
 </para>
 
 
 
-<!-- ##### MACRO SEEK_BUFFER_SIZE ##### -->
+<!-- ##### MACRO HAL_PATH_MAX ##### -->
 <para>
 
 </para>
 
 
 
-<!-- ##### MACRO le16_to_cpu ##### -->
+<!-- ##### MACRO HAL_HELPER_TIMEOUT ##### -->
 <para>
 
 </para>
 
- at x: 
 
 
-<!-- ##### MACRO le32_to_cpu ##### -->
+<!-- ##### FUNCTION util_compute_time_remaining ##### -->
 <para>
 
 </para>
 
- at x: 
+ at id: 
+ at chargeRate: 
+ at chargeLevel: 
+ at chargeLastFull: 
+ at isDischarging: 
+ at isCharging: 
+ at guessChargeRate: 
+ at Returns: 
 
 
-<!-- ##### MACRO le64_to_cpu ##### -->
+<!-- ##### FUNCTION util_compute_percentage_charge ##### -->
 <para>
 
 </para>
 
- at x: 
+ at id: 
+ at chargeLevel: 
+ at chargeLastFull: 
+ at Returns: 
 
 
-<!-- ##### MACRO be16_to_cpu ##### -->
+<!-- ##### FUNCTION hal_util_remove_trailing_slash ##### -->
 <para>
 
 </para>
 
- at x: 
+ at path: 
+ at Returns: 
 
 
-<!-- ##### MACRO be32_to_cpu ##### -->
+<!-- ##### FUNCTION hal_util_get_last_element ##### -->
 <para>
 
 </para>
 
- at x: 
+ at s: 
+ at Returns: 
 
 
-<!-- ##### MACRO cpu_to_le16 ##### -->
+<!-- ##### FUNCTION hal_util_get_parent_path ##### -->
 <para>
 
 </para>
 
- at x: 
+ at path: 
+ at Returns: 
 
 
-<!-- ##### MACRO cpu_to_le32 ##### -->
+<!-- ##### FUNCTION hal_util_get_normalized_path ##### -->
 <para>
 
 </para>
 
- at x: 
+ at path1: 
+ at path2: 
+ at Returns: 
 
 
-<!-- ##### MACRO cpu_to_be32 ##### -->
+<!-- ##### FUNCTION hal_util_get_int_from_file ##### -->
 <para>
 
 </para>
 
- at x: 
+ at directory: 
+ at file: 
+ at result: 
+ at base: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_set_unicode16 ##### -->
+<!-- ##### FUNCTION hal_util_set_int_from_file ##### -->
 <para>
 
 </para>
 
- at str: 
- at len: 
- at buf: 
- at endianess: 
- at count: 
+ at d: 
+ at key: 
+ at directory: 
+ at file: 
+ at base: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_set_usage ##### -->
+<!-- ##### FUNCTION hal_util_get_string_from_file ##### -->
 <para>
 
 </para>
 
- at id: 
- at usage_id: 
+ at directory: 
+ at file: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_set_usage_part ##### -->
+<!-- ##### FUNCTION hal_util_set_string_from_file ##### -->
 <para>
 
 </para>
 
- at part: 
- at usage_id: 
+ at d: 
+ at key: 
+ at directory: 
+ at file: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_set_label_raw ##### -->
+<!-- ##### FUNCTION hal_util_get_bcd2_from_file ##### -->
 <para>
 
 </para>
 
- at id: 
- at buf: 
- at count: 
+ at directory: 
+ at file: 
+ at result: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_set_label_string ##### -->
+<!-- ##### FUNCTION hal_util_set_bcd2_from_file ##### -->
 <para>
 
 </para>
 
- at id: 
- at buf: 
- at count: 
+ at d: 
+ at key: 
+ at directory: 
+ at file: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_set_label_unicode16 ##### -->
+<!-- ##### FUNCTION hal_util_compute_udi ##### -->
 <para>
 
 </para>
 
- at id: 
- at buf: 
- at endianess: 
- at count: 
+ at store: 
+ at dst: 
+ at dstsize: 
+ at format: 
+ at Varargs: 
 
 
-<!-- ##### FUNCTION volume_id_set_uuid ##### -->
+<!-- ##### FUNCTION hal_util_path_ascend ##### -->
 <para>
 
 </para>
 
- at id: 
- at buf: 
- at format: 
+ at path: 
+ at Returns: 
 
 
-<!-- ##### FUNCTION volume_id_get_buffer ##### -->
+<!-- ##### FUNCTION hal_util_grep_discard_existing_data ##### -->
 <para>
 
 </para>
 
- at id: 
- at off: 
- at len: 
+
+
+<!-- ##### FUNCTION hal_util_grep_file ##### -->
+<para>
+
+</para>
+
+ at directory: 
+ at file: 
+ at linestart: 
+ at reuse_file: 
 @Returns: 
 
 
-<!-- ##### FUNCTION volume_id_free_buffer ##### -->
+<!-- ##### FUNCTION hal_util_grep_int_elem_from_file ##### -->
 <para>
 
 </para>
 
- at id: 
+ at directory: 
+ at file: 
+ at linestart: 
+ at elem: 
+ at base: 
+ at reuse_file: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION hal_util_grep_string_elem_from_file ##### -->
+<para>
+
+</para>
+
+ at directory: 
+ at file: 
+ at linestart: 
+ at elem: 
+ at reuse_file: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION hal_util_set_string_elem_from_file ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at key: 
+ at directory: 
+ at file: 
+ at linestart: 
+ at elem: 
+ at reuse_file: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION hal_util_set_int_elem_from_file ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at key: 
+ at directory: 
+ at file: 
+ at linestart: 
+ at elem: 
+ at base: 
+ at reuse_file: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION hal_util_set_bool_elem_from_file ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at key: 
+ at directory: 
+ at file: 
+ at linestart: 
+ at elem: 
+ at expected: 
+ at reuse_file: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION hal_util_dup_strv_from_g_slist ##### -->
+<para>
+
+</para>
+
+ at strlist: 
+ at Returns: 
+
+
+<!-- ##### USER_FUNCTION HalCalloutsDone ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at userdata1: 
+ at userdata2: 
+
+
+<!-- ##### FUNCTION hal_util_callout_device_add ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at callback: 
+ at userdata1: 
+ at userdata2: 
+
+
+<!-- ##### FUNCTION hal_util_callout_device_remove ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at callback: 
+ at userdata1: 
+ at userdata2: 
+
+
+<!-- ##### FUNCTION hal_util_callout_device_preprobe ##### -->
+<para>
+
+</para>
+
+ at d: 
+ at callback: 
+ at userdata1: 
+ at userdata2: 
+
+
+<!-- ##### FUNCTION hal_util_strdup_valid_utf8 ##### -->
+<para>
+
+</para>
+
+ at str: 
+ at Returns: 
+
+
+<!-- ##### FUNCTION hal_util_hexdump ##### -->
+<para>
+
+</para>
+
+ at buf: 
+ at size: 
 
 
diff --git a/fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi b/fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi
index 0305028..5030bae 100644
--- a/fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi
+++ b/fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi
@@ -33,11 +33,13 @@
     </match>
   </device>
 
-  <!-- this is for controlling backlight on the Macbook Pro -->
+  <!-- this is for Macbook Pro (LCD panel, light sensor, keyboard backlight) -->
   <device>
     <match key="system.kernel.name" string="Linux">
       <match key="smbios.system.manufacturer" string="Apple Computer, Inc.">
         <match key="smbios.system.product" string="MacBookPro1,1">
+          <spawn udi="/org/freedesktop/Hal/devices/macbook_pro_light_sensor"/>
+          <spawn udi="/org/freedesktop/Hal/devices/macbook_pro_keyboard_backlight"/>
           <spawn udi="/org/freedesktop/Hal/devices/macbook_pro_lcd_panel"/>
         </match>
       </match>
@@ -52,5 +54,22 @@
       <append key="info.addons" type="strlist">hald-addon-macbookpro-backlight</append>
     </match>
   </device>
+  <device>
+    <match key="info.udi" string="/org/freedesktop/Hal/devices/macbook_pro_light_sensor">
+      <append key="info.capabilities" type="strlist">light_sensor</append>
+      <merge key="info.product" type="string">MacBook Pro Light Sensor</merge>
+      <merge key="light_sensor.num_sensors" type="int">2</merge>
+      <merge key="light_sensor.num_levels" type="int">256</merge>
+      <append key="light_sensor.sensor_locations" type="strlist">right</append>
+      <append key="light_sensor.sensor_locations" type="strlist">left</append>
+    </match>
+  </device>
+  <device>
+    <match key="info.udi" string="/org/freedesktop/Hal/devices/macbook_pro_keyboard_backlight">
+      <append key="info.capabilities" type="strlist">keyboard_backlight</append>
+      <merge key="info.product" type="string">MacBook Pro Keyboard Backlight</merge>
+      <merge key="keyboard_backlight.num_levels" type="int">256</merge>
+    </match>
+  </device>
 
 </deviceinfo>
diff --git a/fdi/policy/10osvendor/20-storage-methods.fdi b/fdi/policy/10osvendor/20-storage-methods.fdi
index 21a265d..0983ece 100644
--- a/fdi/policy/10osvendor/20-storage-methods.fdi
+++ b/fdi/policy/10osvendor/20-storage-methods.fdi
@@ -3,7 +3,7 @@
 <deviceinfo version="0.2">
   <device>
     <match key="info.udi" string="/org/freedesktop/Hal/devices/computer">
-      <append key="info.callouts.add" type="strlist">hal-system-storage-cleanup-mountpoints</append>
+      <append key="info.callouts.add" type="strlist">hal-storage-cleanup-all-mountpoints</append>
     </match>
 
     <match key="storage.media_check_enabled" bool="true">
@@ -16,14 +16,14 @@
         <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
         <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
 	<append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-system-storage-eject</append>
+        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
       </match>
       <match key="volume.disc.is_blank" bool="true">
         <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>
         <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
         <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
 	<append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-system-storage-eject</append>
+        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
       </match>
     </match>
 
@@ -41,12 +41,12 @@
         <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Unmount</append>
         <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
 	<append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-system-storage-unmount</append>
+        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-unmount</append>
 
         <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
         <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
 	<append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-system-storage-eject</append>
+        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
 
         <!-- allow these mount options for all file systems -->
         <append key="volume.mount.valid_options" type="strlist">ro</append>
@@ -113,12 +113,12 @@
       <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Unmount</append>
       <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
       <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-system-storage-unmount</append>
+      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-unmount</append>
 
       <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
       <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
       <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-system-storage-eject</append>
+      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
 
       <!-- allow these mount options for all file systems -->
       <append key="volume.mount.valid_options" type="strlist">ro</append>
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 49fae4f..5c4cbc8 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -3136,6 +3136,13 @@ do_introspect (DBusConnection  *connecti
 				       "      <arg name=\"condition_details\" direction=\"in\" type=\"s\"/>\n"
 				       "    </method>\n"
 
+				       "    <method name=\"Rescan\">\n"
+				       "      <arg name=\"call_had_sideeffect\" direction=\"out\" type=\"b\"/>\n"
+				       "    </method>\n"
+				       "    <method name=\"Reprobe\">\n"
+				       "      <arg name=\"call_had_sideeffect\" direction=\"out\" type=\"b\"/>\n"
+				       "    </method>\n"
+
 				       "    <method name=\"ClaimInterface\">\n"
 				       "      <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
 				       "      <arg name=\"introspection_xml\" direction=\"in\" type=\"s\"/>\n"
@@ -3286,6 +3293,8 @@ reply_from_fwd_message (DBusPendingCall 
 
 	dbus_message_unref (reply_from_addon);
 	dbus_message_unref (reply);
+	dbus_message_unref (method_from_caller);
+	dbus_pending_call_unref (pending_call);
 }
 
 static DBusHandlerResult
diff --git a/hald/linux2/addons/addon-keyboard.c b/hald/linux2/addons/addon-keyboard.c
index bbae15b..8d23527 100644
--- a/hald/linux2/addons/addon-keyboard.c
+++ b/hald/linux2/addons/addon-keyboard.c
@@ -189,6 +189,8 @@ main (int argc, char **argv)
 	char *device_file;
 	FILE *eventfp;
 
+	hal_set_proc_title_init (argc, argv);
+
 	if (getenv ("HALD_VERBOSE") != NULL)
 		is_verbose = TRUE;
 
@@ -210,6 +212,8 @@ main (int argc, char **argv)
 
 	drop_privileges (0);
 
+	hal_set_proc_title ("hald-addon-keyboard: listening on %s", device_file);
+
 	while (1)
 	{
 		main_loop (ctx, eventfp);
diff --git a/hald/linux2/addons/addon-macbookpro-backlight.c b/hald/linux2/addons/addon-macbookpro-backlight.c
index 81d86ee..974de01 100644
--- a/hald/linux2/addons/addon-macbookpro-backlight.c
+++ b/hald/linux2/addons/addon-macbookpro-backlight.c
@@ -6,7 +6,7 @@
  * Boichat found on the mactel-linux mailing list.
  *
  * Copyright (C) 2006 David Zeuthen <david at fubar.dk>
- * Copyright (C) 2006 Nicolas Boichat <nicolas at bo...>
+ * Copyright (C) 2006 Nicolas Boichat <nicolas at boichat.ch>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -64,14 +64,158 @@ static inline void writel(unsigned int b
 #define INREG(addr)		readl(memory+addr)
 #define OUTREG(addr,val)	writel(val, memory+addr)
 
-unsigned char read_backlight() {
+static unsigned char 
+read_backlight (void)
+{
  	return INREG(0x7af8) >> 8;
 }
 
-void write_backlight(unsigned char value) {
+static void 
+write_backlight (unsigned char value)
+{
  	OUTREG(0x7af8, 0x00000001 | ((unsigned int)value << 8));
 }
 
+
+#define LIGHT_SENSOR_LEFT_KEY	"ALV0" //0x414c5630, r-o length 6
+#define LIGHT_SENSOR_RIGHT_KEY	"ALV1" //0x414c5631, r-o length 6
+#define BACKLIGHT_KEY 		"LKSB" //0x4c4b5342, w-o
+
+static int debug = 0;
+
+static struct timeval lasttv;
+static struct timeval newtv;
+
+
+static void
+ssleep (const int usec)
+{
+	gettimeofday(&lasttv, NULL);
+	while (1) {
+		gettimeofday(&newtv, NULL);
+		if (((newtv.tv_usec - lasttv.tv_usec) + ((newtv.tv_sec - lasttv.tv_sec)*1000000)) > usec) {
+			break;
+		}
+	}
+}
+
+static unsigned char 
+get_status (void)
+{
+	return inb(0x304);
+}
+
+static int 
+waitfree (char num)
+{
+	char c, pc = -1;
+	int retry = 100;
+	while (((c = get_status())&0x0F) != num && retry) {
+		ssleep(10);
+		retry--;
+		if (pc != c) {
+			//printf("%x-%d:", c, retry);
+			pc = c;
+		}
+	}
+	if (retry == 0) {
+		printf("Waitfree failed %x != %x.\n", c, num);
+		return 0;
+	}
+	/*else
+		printf("Waitfree ok %x.\n", c);*/
+
+	return 1;
+}
+
+
+static int
+writekey (char* key, char len, unsigned char* buffer)
+{
+	int i;
+
+	outb(0x11, 0x304);
+	if (!waitfree(0x0c)) return 0;
+	
+	for (i = 0; i < 4; i++) {
+		outb(key[i], 0x300);
+		if (!waitfree(0x04)) return 0;
+	}
+	if (debug) printf(">%s", key);
+
+	outb(len, 0x300);
+	if (debug) printf(">%x", len);
+
+	for (i = 0; i < len; i++) {
+		if (!waitfree(0x04)) return 0;
+		outb(buffer[i], 0x300);
+		if (debug) printf(">%x", buffer[i]);
+	}
+	if (debug) printf("\n");
+	return 1;
+}
+
+static int 
+readkey (char* key, char len, unsigned char* buffer)
+{
+	int i; unsigned char c;
+
+	outb(0x10, 0x304);
+	if (!waitfree(0x0c)) return 0;
+	
+	for (i = 0; i < 4; i++) {
+		outb(key[i], 0x300);
+		if (!waitfree(0x04)) return 0;
+	}
+	if (debug) printf("<%s", key);
+
+	outb(len, 0x300);
+	if (debug) printf(">%x", len);
+
+	for (i = 0; i < len; i++) {
+		if (!waitfree(0x05)) return 0;
+		c = inb(0x300);
+		buffer[i] = c;
+		if (debug) printf("<%x", c);
+	}
+	if (debug) printf("\n");
+	return 1;
+}
+
+static int 
+read_light_sensor (gboolean left)
+{
+	unsigned char buffer[6];
+
+	if (readkey (left ? LIGHT_SENSOR_LEFT_KEY : LIGHT_SENSOR_RIGHT_KEY, 6, buffer))
+		return buffer[2];
+	else
+		return -1;
+}
+
+static int
+set_keyboard_backlight (char value)
+{
+	unsigned char buffer[2];
+	buffer[0] = value;
+	buffer[1] = 0x00;
+	return writekey (BACKLIGHT_KEY, 2, buffer);	
+}
+
+
+static int
+read_keyboard_backlight (void)
+{
+	unsigned char buffer[6];
+
+	if (readkey (BACKLIGHT_KEY, 6, buffer))
+		return buffer[2];
+	else
+		return -1;
+}
+
+static int last_keyboard_brightness = -1;
+
 static DBusHandlerResult
 filter_function (DBusConnection *connection, DBusMessage *message, void *userdata)
 {
@@ -97,7 +241,7 @@ filter_function (DBusConnection *connect
 					   &err,
 					   DBUS_TYPE_INT32, &brightness,
 					   DBUS_TYPE_INVALID)) {
-			dbg ("setting brightness %d", brightness);
+			/* dbg ("setting brightness %d", brightness); */
 			if (brightness < 0 || brightness > 228) {
 				reply = dbus_message_new_error (message,
 								"org.freedesktop.Hal.Device.LaptopPanel.Invalid",
@@ -137,7 +281,7 @@ filter_function (DBusConnection *connect
 			if (brightness > 228)
 				brightness = 228;
 
-			dbg ("getting brightness, it's %d", brightness);
+			/* dbg ("getting brightness, it's %d", brightness); */
 
 			reply = dbus_message_new_method_return (message);
 			if (reply == NULL)
@@ -149,6 +293,101 @@ filter_function (DBusConnection *connect
 			dbus_connection_send (connection, reply, NULL);
 		}
 		
+	} else if (dbus_message_is_method_call (message, 
+						"org.freedesktop.Hal.Device.LightSensor", 
+						"GetBrightness")) {
+		int brightness[2];
+
+		brightness[0] = read_light_sensor (FALSE); /* right */
+		brightness[1] = read_light_sensor (TRUE); /* left */
+
+		if (brightness[0] == -1 || brightness[1] == -1) {
+			reply = dbus_message_new_error (message,
+							"org.freedesktop.Hal.Device.LightSensors.Error",
+							"Error poking hardware");
+			dbus_connection_send (connection, reply, NULL);
+		} else {
+			int **pb = &brightness;
+
+			reply = dbus_message_new_method_return (message);
+			if (reply == NULL)
+				goto error;
+			
+			dbus_message_append_args (reply,
+						  DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &pb, 2,
+						  DBUS_TYPE_INVALID);
+			dbus_connection_send (connection, reply, NULL);
+		}
+	} else if (dbus_message_is_method_call (message, 
+						"org.freedesktop.Hal.Device.KeyboardBacklight", 
+						"GetBrightness")) {
+
+		/* I can't get this working so just cache last SetBrightness value :-/ */
+		if (last_keyboard_brightness == -1 ) {
+			reply = dbus_message_new_error (message,
+							"org.freedesktop.Hal.Device.KeyboardBacklight.Error",
+							"Error poking hardware");
+			dbus_connection_send (connection, reply, NULL);
+		} else {
+			reply = dbus_message_new_method_return (message);
+			if (reply == NULL)
+				goto error;
+			
+			dbus_message_append_args (reply,
+						  DBUS_TYPE_INT32, &last_keyboard_brightness,
+						  DBUS_TYPE_INVALID);
+			dbus_connection_send (connection, reply, NULL);
+		}
+#if 0
+		int brightness;
+
+		brightness = read_keyboard_backlight ();
+
+		if (brightness == -1) {
+			reply = dbus_message_new_error (message,
+							"org.freedesktop.Hal.Device.KeyboardBacklight.Error",
+							"Error poking hardware");
+			dbus_connection_send (connection, reply, NULL);
+		} else {
+			reply = dbus_message_new_method_return (message);
+			if (reply == NULL)
+				goto error;
+			
+			dbus_message_append_args (reply,
+						  DBUS_TYPE_INT32, &brightness,
+						  DBUS_TYPE_INVALID);
+			dbus_connection_send (connection, reply, NULL);
+		}
+#endif
+	} else if (dbus_message_is_method_call (message, 
+						"org.freedesktop.Hal.Device.KeyboardBacklight", 
+						"SetBrightness")) {
+		int brightness;
+
+
+		dbus_error_init (&err);
+		if (dbus_message_get_args (message, 
+					   &err,
+					   DBUS_TYPE_INT32, &brightness,
+					   DBUS_TYPE_INVALID)) {
+			/*dbg ("setting keyboard brightness %d", brightness);*/
+			if (brightness < 0 || brightness > 255) {
+				reply = dbus_message_new_error (message,
+								"org.freedesktop.Hal.Device.KeyboardBacklight.Invalid",
+								"Brightness has to be between 0 and 255!");
+
+			} else {
+				set_keyboard_backlight (brightness);
+				last_keyboard_brightness = brightness;
+
+				reply = dbus_message_new_method_return (message);
+				if (reply == NULL)
+					goto error;
+			}
+
+			dbus_connection_send (connection, reply, NULL);
+		}
+
 	}
 	
 error:
@@ -161,8 +400,6 @@ error:
 int
 main (int argc, char *argv[])
 {
- 	char* endptr;
- 	int ret = 0;
  	off_t address = 0;
  	size_t length = 0;
  	int fd;
@@ -233,9 +470,14 @@ main (int argc, char *argv[])
  	state = INREG(0x7ae4);
  	OUTREG(0x7ae4, state);
 
+	if (ioperm (0x300, 0x304, 1) < 0) {
+		perror("ioperm failed (you should be root).");
+		exit(1);
+	}
 
+	/* this works because we hardcoded the udi's in the <spawn> in the fdi files */
 	if (!libhal_device_claim_interface (halctx, 
-					    udi, 
+					    "/org/freedesktop/Hal/devices/macbook_pro_lcd_panel", 
 					    "org.freedesktop.Hal.Device.LaptopPanel", 
 					    "    <method name=\"SetBrightness\">\n"
 					    "      <arg name=\"brightness_value\" direction=\"in\" type=\"i\"/>\n"
@@ -248,6 +490,29 @@ main (int argc, char *argv[])
 		fprintf (stderr, "Cannot claim interface");
 		return -4;
 	}
+	if (!libhal_device_claim_interface (halctx, 
+					    "/org/freedesktop/Hal/devices/macbook_pro_light_sensor",
+					    "org.freedesktop.Hal.Device.LightSensor", 
+					    "    <method name=\"GetBrightness\">\n"
+					    "      <arg name=\"brightness_value\" direction=\"out\" type=\"ai\"/>\n"
+					    "    </method>\n",
+					    &err)) {
+		fprintf (stderr, "Cannot claim interface");
+		return -4;
+	}
+	if (!libhal_device_claim_interface (halctx, 
+					    "/org/freedesktop/Hal/devices/macbook_pro_keyboard_backlight",
+					    "org.freedesktop.Hal.Device.KeyboardBacklight", 
+					    "    <method name=\"GetBrightness\">\n"
+					    "      <arg name=\"brightness_value\" direction=\"out\" type=\"i\"/>\n"
+					    "    </method>\n"
+					    "    <method name=\"SetBrightness\">\n"
+					    "      <arg name=\"brightness_value\" direction=\"in\" type=\"i\"/>\n"
+					    "    </method>\n",
+					    &err)) {
+		fprintf (stderr, "Cannot claim interface");
+		return -4;
+	}
 
 	main_loop = g_main_loop_new (NULL, FALSE);
 	g_main_loop_run (main_loop);
diff --git a/hald/linux2/addons/addon-storage.c b/hald/linux2/addons/addon-storage.c
index 14d1289..12aedb7 100644
--- a/hald/linux2/addons/addon-storage.c
+++ b/hald/linux2/addons/addon-storage.c
@@ -57,6 +57,7 @@ force_unmount (LibHalContext *ctx, const
 	char **options = NULL;
 	unsigned int num_options = 0;
 	DBusConnection *dbus_connection;
+	char *device_file;
 
 	dbus_connection = libhal_ctx_get_dbus_connection (ctx);
 
@@ -78,6 +79,14 @@ force_unmount (LibHalContext *ctx, const
 	options[0] = "lazy";
 	num_options = 1;
 
+	device_file = libhal_device_get_property_string (ctx, udi, "block.device", NULL);
+	if (device_file != NULL) {
+		openlog ("hald", 0, LOG_DAEMON);
+		syslog (LOG_NOTICE, "forcibly attempting to lazy unmount %s as media was removed", device_file);
+		closelog ();
+		libhal_free_string (device_file);
+	}
+
 	if (!dbus_message_append_args (msg, 
 				       DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, num_options,
 				       DBUS_TYPE_INVALID)) {
@@ -270,6 +279,8 @@ main (int argc, char *argv[])
 	char *support_media_changed_str;
 	int support_media_changed;
 
+	hal_set_proc_title_init (argc, argv);
+
 	/* We could drop privs if we know that the haldaemon user is
 	 * to be able to access block devices...
 	 */
@@ -300,6 +311,8 @@ main (int argc, char *argv[])
 	dbg ("Doing addon-storage for %s (bus %s) (drive_type %s) (udi %s)", device_file, bus, drive_type, udi);
 	dbg ("**************************************************");
 
+	hal_set_proc_title ("hald-addon-storage: polling %s", device_file);
+
 	if (strcmp (drive_type, "cdrom") == 0)
 		is_cdrom = 1;
 	else
diff --git a/hald/linux2/blockdev.c b/hald/linux2/blockdev.c
index e790b4c..bfe0182 100644
--- a/hald/linux2/blockdev.c
+++ b/hald/linux2/blockdev.c
@@ -48,8 +48,10 @@
 #include <errno.h>
 #include <stdint.h>
 #include <sys/stat.h>
+#include <sys/file.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <syslog.h>
 
 #include <glib.h>
 #include <dbus/dbus.h>
@@ -172,6 +174,116 @@ cleanup_mountpoint_cb (HalDevice *d, gui
 	g_free (mount_point);
 }
 
+static gboolean
+is_mounted_by_hald (const char *mount_point)
+{
+	int i;
+	FILE *hal_mtab;
+	int hal_mtab_len;
+	int num_read;
+	char *hal_mtab_buf;
+	char **lines;
+	gboolean found;
+	int lock_mtab_fd;
+
+	hal_mtab = NULL;
+	hal_mtab_buf = NULL;
+	found = FALSE;
+
+	/* take the lock on /media/.hal-mtab-lock so we don't race with the Mount() and Unmount() methods */
+	
+	/* do not attempt to create the file; tools/hal-storage-shared.c will create it and 
+	 * set the correct ownership so this unprivileged process (running as haldaemon) can
+	 * lock it too
+	 */
+	lock_mtab_fd = open ("/media/.hal-mtab-lock", 0);
+	if (lock_mtab_fd < 0) {
+		HAL_INFO (("Cannot open /media/.hal-mtab for locking"));
+		goto out;
+	}
+
+tryagain:
+	if (flock (lock_mtab_fd, LOCK_EX) != 0) {
+		if (errno == EINTR)
+			goto tryagain;
+		HAL_ERROR (("Cannot obtain lock on /media/.hal-mtab"));
+		goto out;
+	}
+
+	/*HAL_DEBUG (("examining /media/.hal-mtab for %s", mount_point));*/
+
+	hal_mtab = fopen ("/media/.hal-mtab", "r");
+	if (hal_mtab == NULL) {
+		HAL_ERROR (("Cannot open /media/.hal-mtab"));
+		goto out;
+	}
+	if (fseek (hal_mtab, 0L, SEEK_END) != 0) {
+		HAL_ERROR (("Cannot seek to end of /media/.hal-mtab"));
+		goto out;
+	}
+	hal_mtab_len = ftell (hal_mtab);
+	if (hal_mtab_len < 0) {
+		HAL_ERROR (("Cannot determine size of /media/.hal-mtab"));
+		goto out;
+	}
+	rewind (hal_mtab);
+
+	hal_mtab_buf = g_new0 (char, hal_mtab_len + 1);
+	num_read = fread (hal_mtab_buf, 1, hal_mtab_len, hal_mtab);
+	if (num_read != hal_mtab_len) {
+		HAL_ERROR (("Cannot read from /media/.hal-mtab"));
+		goto out;
+	}
+	fclose (hal_mtab);
+	hal_mtab = NULL;
+
+	/*HAL_DEBUG (("hal_mtab = '%s'\n", hal_mtab_buf));*/
+
+	lines = g_strsplit (hal_mtab_buf, "\n", 0);
+	g_free (hal_mtab_buf);
+	hal_mtab_buf = NULL;
+
+	/* find the entry we're going to unmount */
+	for (i = 0; lines[i] != NULL && !found; i++) {
+		char **line_elements;
+
+		/*HAL_DEBUG ((" line = '%s'", lines[i]));*/
+
+		if ((lines[i])[0] == '#')
+			continue;
+
+		line_elements = g_strsplit (lines[i], "\t", 6);
+		if (g_strv_length (line_elements) == 6) {
+/*
+			HAL_DEBUG (("  devfile     = '%s'", line_elements[0]));
+			HAL_DEBUG (("  uid         = '%s'", line_elements[1]));
+			HAL_DEBUG (("  session id  = '%s'", line_elements[2]));
+			HAL_DEBUG (("  fs          = '%s'", line_elements[3]));
+			HAL_DEBUG (("  options     = '%s'", line_elements[4]));
+			HAL_DEBUG (("  mount_point = '%s'", line_elements[5]));
+			HAL_DEBUG (("  (comparing against '%s')", mount_point));
+*/
+
+			if (strcmp (line_elements[5], mount_point) == 0) {
+				found = TRUE;
+				/*HAL_INFO (("device at '%s' is indeed mounted by HAL's Mount()", mount_point));*/
+			}
+			
+		}
+
+		g_strfreev (line_elements);
+	}
+
+out:
+	if (lock_mtab_fd >= 0)
+		close (lock_mtab_fd);
+	if (hal_mtab != NULL)
+		fclose (hal_mtab);
+	if (hal_mtab_buf != NULL)
+		g_free (hal_mtab_buf);
+
+	return found;
+}
 
 void
 blockdev_refresh_mount_state (HalDevice *d)
@@ -242,7 +354,7 @@ blockdev_refresh_mount_state (HalDevice 
 		if (major(statbuf.st_dev) == 0)
 			continue;
 
-		HAL_INFO (("* found mounts dev %s (%i:%i)", mnt.mnt_fsname, major(statbuf.st_dev), minor(statbuf.st_dev)));
+		/*HAL_INFO (("* found mounts dev %s (%i:%i)", mnt.mnt_fsname, major(statbuf.st_dev), minor(statbuf.st_dev)));*/
 		/* match against all hal volumes */
 		for (volume = volumes; volume != NULL; volume = g_slist_next (volume)) {
 			HalDevice *dev;
@@ -253,7 +365,7 @@ blockdev_refresh_mount_state (HalDevice 
 				continue;
 			minor = hal_device_property_get_int (dev, "block.minor");
 			devt = makedev(major, minor);
-			HAL_INFO (("  match %s (%i:%i)", hal_device_get_udi (dev), major, minor));
+			/*HAL_INFO (("  match %s (%i:%i)", hal_device_get_udi (dev), major, minor));*/
 
 			if (statbuf.st_dev == devt) {
 				/* found entry for this device in /proc/mounts */
@@ -263,9 +375,9 @@ blockdev_refresh_mount_state (HalDevice 
 							      hasmntopt (&mnt, MNTOPT_RO) ? TRUE : FALSE);
 				hal_device_property_set_string (dev, "volume.mount_point", mnt.mnt_dir);
 				device_property_atomic_update_end ();
-				HAL_INFO (("  set %s to be mounted at %s (%s)",
+				/*HAL_INFO (("  set %s to be mounted at %s (%s)",
 					   hal_device_get_udi (dev), mnt.mnt_dir,
-					   hasmntopt (&mnt, MNTOPT_RO) ? "ro" : "rw"));
+					   hasmntopt (&mnt, MNTOPT_RO) ? "ro" : "rw"));*/
 				volumes = g_slist_delete_link (volumes, volume);
 				break;
 			}
@@ -276,7 +388,6 @@ blockdev_refresh_mount_state (HalDevice 
 	for (volume = volumes; volume != NULL; volume = g_slist_next (volume)) {
 		HalDevice *dev;
 		char *mount_point;
-		char *mount_point_hal_file;
 		GSList *autofs_node;
 
 		dev = HAL_DEVICE (volume->data);
@@ -286,7 +397,7 @@ blockdev_refresh_mount_state (HalDevice 
 		hal_device_property_set_bool (dev, "volume.is_mounted_read_only", FALSE);
 		hal_device_property_set_string (dev, "volume.mount_point", "");
 		device_property_atomic_update_end ();
-		HAL_INFO (("set %s to unmounted", hal_device_get_udi (dev)));
+		/*HAL_INFO (("set %s to unmounted", hal_device_get_udi (dev)));*/
 
 		/* check to see if mount point falls under autofs */
 		autofs_node = autofs_mounts;
@@ -299,32 +410,26 @@ blockdev_refresh_mount_state (HalDevice 
 			autofs_node = autofs_node->next;
 		}
 
-		mount_point_hal_file = g_strdup_printf ("%s/.created-by-hal", mount_point);
-		if (!autofs_node && 
-		     g_file_test (mount_point_hal_file, G_FILE_TEST_EXISTS)) {
+		/* look up in /media/.hal-mtab to see if we mounted this one */
+		if (mount_point != NULL && strlen (mount_point) > 0 && is_mounted_by_hald (mount_point)) {
 			char *cleanup_stdin;
 			char *extra_env[2];
 
-			HAL_INFO (("Cleaning up directory '%s' since it was created by hal Mount()", mount_point));
+			HAL_INFO (("Cleaning up directory '%s' since it was created by HAL's Mount()", mount_point));
 
 			extra_env[0] = g_strdup_printf ("HALD_CLEANUP=%s", mount_point);
 			extra_env[1] = NULL;
 			cleanup_stdin = "\n";
 
 			hald_runner_run_method (dev, 
-						"hal-system-storage-cleanup-mountpoint", 
+						"hal-storage-cleanup-mountpoint", 
 						extra_env, 
 						cleanup_stdin, TRUE,
 						0,
 						cleanup_mountpoint_cb,
 						g_strdup (mount_point), NULL);
-
-			hal_device_property_remove (dev, "info.hal_mount.created_mount_point");
-			hal_device_property_remove (dev, "info.hal_mount.mounted_by_uid");
-
 		}
 
-		g_free (mount_point_hal_file);
 		g_free (mount_point);
 	}
 	g_slist_free (volumes);
@@ -1078,22 +1183,55 @@ force_unmount_cb (HalDevice *d, guint32 
 static void
 force_unmount (HalDevice *d, void *end_token)
 {
-	char *unmount_stdin;
-	char *extra_env[2];
+	const char *device_file;
+	const char *mount_point;
+
+	device_file = hal_device_property_get_string (d, "block.device");
+	mount_point = hal_device_property_get_string (d, "volume.mount_point");
+
+	/* look up in /media/.hal-mtab to see if we mounted this one */
+	if (mount_point != NULL && strlen (mount_point) > 0 && is_mounted_by_hald (mount_point)) {
+		char *unmount_stdin;
+		char *extra_env[2];
 
-	extra_env[0] = "HAL_METHOD_INVOKED_BY_UID=0";
-	extra_env[1] = NULL;
+		extra_env[0] = "HAL_METHOD_INVOKED_BY_UID=0";
+		extra_env[1] = NULL;
+		
+		HAL_INFO (("force_unmount for udi='%s'", d->udi));
+		syslog (LOG_NOTICE, "forcibly attempting to lazy unmount %s as enclosing drive was disconnected", device_file);
+		
+		unmount_stdin = "lazy\n";
+		
+		/* so, yea, calling the Unmount methods handler.. is cheating a bit :-) */
+		hald_runner_run_method (d, 
+					"hal-storage-unmount", 
+					extra_env, 
+					unmount_stdin, TRUE,
+					0,
+					force_unmount_cb,
+					end_token, NULL);
+
+/*
+		char *cleanup_stdin;
+		char *extra_env[2];
+		
+		HAL_INFO (("Cleaning up directory '%s' since it was created by HAL's Mount()", mount_point));
+		
+		extra_env[0] = g_strdup_printf ("HALD_CLEANUP=%s", mount_point);
+		extra_env[1] = NULL;
+		cleanup_stdin = "\n";
+		
+		hald_runner_run_method (dev, 
+					"hal-storage-cleanup-mountpoint", 
+					extra_env, 
+					cleanup_stdin, TRUE,
+					0,
+					cleanup_mountpoint_cb,
+					g_strdup (mount_point), NULL);
+*/
+	}
 
-	HAL_INFO (("force_unmount for udi='%s'", d->udi));
 
-	unmount_stdin = "lazy\n";
-
-	hald_runner_run_method (d, 
-				"hal-system-storage-unmount", extra_env, 
-				unmount_stdin, TRUE,
-				0,
-				force_unmount_cb,
-				end_token, NULL);
 }
 
 void
diff --git a/hald/linux2/probing/probe-input.c b/hald/linux2/probing/probe-input.c
index e37c78d..9e8191c 100644
--- a/hald/linux2/probing/probe-input.c
+++ b/hald/linux2/probing/probe-input.c
@@ -191,10 +191,12 @@ main (int argc, char *argv[])
 	dbg ("probe-input: id.bustype=%i", id.bustype);
 	if (physical_device == NULL) {
 		switch (id.bustype) {
-		case 17: /* TODO: x86 legacy port; use symbol instead of hardcoded constant */
-		case 21: /* BUS_HOST, not hotpluggable */
-		case 23: /* ADB on Apple computers */
+		case BUS_I8042: /* x86 legacy port */
+		case BUS_HOST: /* not hotpluggable */
+		case BUS_PARPORT: /* XXX: really needed? */
+		case BUS_ADB: /* ADB on Apple computers */
 			break;
+
 		default:
 			goto out;
 		}
diff --git a/hald/linux2/probing/shared.h b/hald/linux2/probing/shared.h
index ef49535..3805b71 100644
--- a/hald/linux2/probing/shared.h
+++ b/hald/linux2/probing/shared.h
@@ -110,4 +110,65 @@ drop_privileges (int keep_auxgroups)
 	}
 }
 
+#ifdef __linux__
+extern char **environ;
+#endif
+
+static char **argv_buffer = NULL;
+static size_t argv_size = 0;
+
+static void
+hal_set_proc_title_init (int argc, char *argv[])
+{
+#ifdef __linux__
+	unsigned int i;
+	char **new_environ, *endptr;
+
+	/* This code is really really ugly. We make some memory layout
+	 * assumptions and reuse the environment array as memory to store
+	 * our process title in */
+	
+	for (i = 0; environ[i] != NULL; i++)
+		;
+	
+	endptr = i ? environ[i-1] + strlen (environ[i-1]) : argv[argc-1] + strlen (argv[argc-1]);
+	
+	argv_buffer = argv;
+	argv_size = endptr - argv_buffer[0];
+	
+	/* Make a copy of environ */
+	
+	new_environ = malloc (sizeof(char*) * (i + 1));
+	for (i = 0; environ[i] != NULL; i++)
+		new_environ[i] = strdup (environ[i]);
+	new_environ[i] = NULL;
+	
+	environ = new_environ;
+#endif
+}
+
+/* this code borrowed from avahi-daemon's setproctitle.c (LGPL v2) */
+static void
+hal_set_proc_title (const char *format, ...)
+{
+#ifdef __linux__
+	size_t len;
+	va_list ap;
+
+	if (argv_buffer == NULL)
+		goto out;
+		
+	va_start (ap, format);
+	vsnprintf (argv_buffer[0], argv_size, format, ap);
+	va_end (ap);
+ 	
+	len = strlen (argv_buffer[0]);
+ 	   
+	memset (argv_buffer[0] + len, 0, argv_size - len);
+	argv_buffer[1] = NULL;
+out:
+	;
+#endif
+}
+
 #endif /* SHARED_H */
diff --git a/tools/Makefile.am b/tools/Makefile.am
index cff25dd..1deb321 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -49,13 +49,29 @@ hal_find_by_property_LDADD = @DBUS_LIBS@
 hal_device_SOURCES = hal-device.c
 hal_device_LDADD = @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la
 
-libexec_PROGRAMS =               \
-	hal-storage-mount	 \
+libexec_PROGRAMS =                          \
+	hal-storage-mount	            \
+	hal-storage-unmount 	            \
+	hal-storage-eject	            \
+	hal-storage-cleanup-mountpoint      \
+	hal-storage-cleanup-all-mountpoints \
 	hal-system-power-pmu
 
-hal_storage_mount_SOURCES = hal-storage-mount.c
+hal_storage_mount_SOURCES = hal-storage-mount.c hal-storage-shared.c hal-storage-shared.h
 hal_storage_mount_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
 
+hal_storage_unmount_SOURCES = hal-storage-unmount.c hal-storage-shared.c hal-storage-shared.h
+hal_storage_unmount_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
+
+hal_storage_eject_SOURCES = hal-storage-eject.c hal-storage-shared.c hal-storage-shared.h
+hal_storage_eject_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
+
+hal_storage_cleanup_mountpoint_SOURCES = hal-storage-cleanup-mountpoint.c hal-storage-shared.c hal-storage-shared.h
+hal_storage_cleanup_mountpoint_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
+
+hal_storage_cleanup_all_mountpoints_SOURCES = hal-storage-cleanup-all-mountpoints.c hal-storage-shared.c hal-storage-shared.h
+hal_storage_cleanup_all_mountpoints_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
+
 hal_system_power_pmu_SOURCES = hal-system-power-pmu.c
 hal_system_power_pmu_LDADD = @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la
 
diff --git a/tools/hal-luks-remove b/tools/hal-luks-remove
index 5d84e29..31f1bfd 100755
--- a/tools/hal-luks-remove
+++ b/tools/hal-luks-remove
@@ -13,8 +13,9 @@ if [ -z "$HAL_PROP_BLOCK_DEVICE" ] || [ 
         exit 1
 fi
 
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
-    exec $0-$HALD_UNAME_S $@
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-luks-remove-$HALD_UNAME_S ]; then
+    exec ./$HALD_UNAME_S/hal-luks-remove-$HALD_UNAME_S $@
 else
     echo "org.freedesktop.Hal.Device.UnknownError" >&2
     echo "No back-end for your operating system" >&2
diff --git a/tools/hal-luks-setup b/tools/hal-luks-setup
index 5d84e29..247fe0c 100755
--- a/tools/hal-luks-setup
+++ b/tools/hal-luks-setup
@@ -13,8 +13,9 @@ if [ -z "$HAL_PROP_BLOCK_DEVICE" ] || [ 
         exit 1
 fi
 
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
-    exec $0-$HALD_UNAME_S $@
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-luks-setup-$HALD_UNAME_S ]; then
+    exec ./$HALD_UNAME_S/hal-luks-setup-$HALD_UNAME_S $@
 else
     echo "org.freedesktop.Hal.Device.UnknownError" >&2
     echo "No back-end for your operating system" >&2
diff --git a/tools/hal-luks-teardown b/tools/hal-luks-teardown
index 5aa9a89..f6e8359 100755
--- a/tools/hal-luks-teardown
+++ b/tools/hal-luks-teardown
@@ -14,8 +14,9 @@ if [ -z "$HAL_PROP_BLOCK_DEVICE" ] || [ 
         exit 1
 fi
 
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
-    exec $0-$HALD_UNAME_S $@
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-luks-teardown-$HALD_UNAME_S ]; then
+    exec ./$HALD_UNAME_S/hal-luks-teardown-$HALD_UNAME_S $@
 else
     echo "org.freedesktop.Hal.Device.UnknownError" >&2
     echo "No back-end for your operating system" >&2
diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index da178ff..2dfcb3d 100644
--- a/tools/hal-storage-mount.c
+++ b/tools/hal-storage-mount.c
@@ -43,22 +43,14 @@
 #endif
 #include <sys/types.h>
 #include <unistd.h>
+#include <errno.h>
+#include <syslog.h>
 
 #include <libhal/libhal.h>
 #include <libhal-storage/libhal-storage.h>
 #include <libpolkit.h>
 
-/*#define DEBUG*/
-#define DEBUG
-
-#ifdef __FreeBSD__
-struct mtab_handle
-{
-  struct statfs	*mounts;
-  int		n_mounts;
-  int		iter;
-};
-#endif
+#include "hal-storage-shared.h"
 
 #ifdef __FreeBSD__
 #define MOUNT		"/sbin/mount"
@@ -71,15 +63,7 @@ struct mtab_handle
 static void
 usage (void)
 {
-	fprintf (stderr, "This script should only be started by hald.\n");
-	exit (1);
-}
-
-static void
-unknown_error (void)
-{
-	fprintf (stderr, "org.freedesktop.Hal.Device.UnknownError\n");
-	fprintf (stderr, "An unexpected error occured\n");
+	fprintf (stderr, "This program should only be started by hald.\n");
 	exit (1);
 }
 
@@ -255,59 +239,55 @@ out:
 	return f;
 }
 
-static gboolean
-fstab_open (gpointer *handle)
-{
-#ifdef __FreeBSD__
-	return setfsent () == 1;
-#else
-	*handle = fopen ("/etc/fstab", "r");
-	return *handle != NULL;
-#endif
-}
-
-static char *
-fstab_next (gpointer handle)
+static LibHalVolume *
+volume_findby (LibHalContext *hal_ctx, const char *property, const char *value)
 {
-#ifdef __FreeBSD__
-	struct fstab *fstab;
+	int i;
+	char **hal_udis;
+	int num_hal_udis;
+	LibHalVolume *result = NULL;
+	char *found_udi = NULL;
+	DBusError error;
 
-	fstab = getfsent ();
+	dbus_error_init (&error);
+	if ((hal_udis = libhal_manager_find_device_string_match (hal_ctx, property, 
+								 value, &num_hal_udis, &error)) == NULL)
+		goto out;
+
+	for (i = 0; i < num_hal_udis; i++) {
+		char *udi;
+		udi = hal_udis[i];
+		if (libhal_device_query_capability (hal_ctx, udi, "volume", &error)) {
+			found_udi = strdup (udi);
+			break;
+		}
+	}
 
-	return fstab ? fstab->fs_spec : NULL;
-#else
-	struct mntent *mnt;
+	libhal_free_string_array (hal_udis);
 
-	mnt = getmntent (handle);
+	if (found_udi != NULL)
+		result = libhal_volume_from_udi (hal_ctx, found_udi);
 
-	return mnt ? mnt->mnt_fsname : NULL;
-#endif
-}
-
-static void
-fstab_close (gpointer handle)
-{
-#ifdef __FreeBSD__
-	endfsent ();
-#else
-	fclose (handle);
-#endif
+	free (found_udi);
+out:
+	return result;
 }
 
 static void
-bailout_if_in_fstab (const char *device, const char *label, const char *uuid)
+bailout_if_in_fstab (LibHalContext *hal_ctx, const char *device, const char *label, const char *uuid)
 {
 	gpointer handle;
 	char *entry;
+	char *_mount_point;
 
 	printf (" label '%s'  uuid '%s'\n", label, uuid);
 
 	/* check if /etc/fstab mentions this device... (with symlinks etc) */
 	if (! fstab_open (&handle)) {
 		printf ("cannot open /etc/fstab\n");
-		unknown_error ();		
+		unknown_error ("Cannot open /etc/fstab");		
 	}
-	while ((entry = fstab_next (handle)) != NULL) {
+	while ((entry = fstab_next (handle, &_mount_point)) != NULL) {
 		char *resolved;
 
 #ifdef DEBUG
@@ -315,82 +295,77 @@ bailout_if_in_fstab (const char *device,
 #endif
 		if (label != NULL && g_str_has_prefix (entry, "LABEL=")) {
 			if (strcmp (entry + 6, label) == 0) {
-				printf ("%s found in /etc/fstab. Not mounting.\n", entry);
-				permission_denied_etc_fstab (device);
-			}
-		} 
+				gboolean skip_fstab_entry;
+
+				skip_fstab_entry = FALSE;
+
+				/* (heck, we also do the stuff below in gnome-mount) */
+
+				/* OK, so what's if someone attaches an external disk with the label '/' and
+				 * /etc/fstab has
+				 *
+				 *    LABEL=/    /    ext3    defaults    1 1
+				 *
+				 * in /etc/fstab as most Red Hat systems do? Bugger, this is a very common use
+				 * case; suppose that you take the disk from your Fedora server and attaches it
+				 * to your laptop. Bingo, you now have two disks with the label '/'. One must
+				 * seriously wonder if using things like LABEL=/ for / is a good idea; just
+				 * what happens if you boot in this configuration? (answer: the initrd gets
+				 * it wrong most of the time.. sigh)
+				 *
+				 * To work around this, check if the listed entry in /etc/fstab is already mounted,
+				 * if it is, then check if it's the same device_file as the given one...
+				 */
 
-		if (uuid != NULL && g_str_has_prefix (entry, "UUID=")) {
+				/* see if a volume is mounted at this mount point  */
+				if (_mount_point != NULL) {
+					LibHalVolume *mounted_vol;
+
+					mounted_vol = volume_findby (hal_ctx, "volume.mount_point", _mount_point);
+					if (mounted_vol != NULL) {
+						const char *mounted_vol_device_file;
+
+						mounted_vol_device_file = libhal_volume_get_device_file (mounted_vol);
+						/* no need to resolve symlinks, hal uses the canonical device file */
+						if (mounted_vol_device_file != NULL &&
+						    strcmp (mounted_vol_device_file, device) !=0) {
+#ifdef DEBUG
+							printf ("Wanting to mount %s that has label %s, but /etc/fstab says LABEL=%s is to be mounted at mount point '%s'. However %s (that also has label %s), is already mounted at said mount point. So, skipping said /etc/fstab entry.\n", 
+								   device, label, label, _mount_point, mounted_vol_device_file, _mount_point);
+#endif
+							skip_fstab_entry = TRUE;
+						}
+						libhal_volume_free (mounted_vol);
+					}
+				}
+				
+				if (!skip_fstab_entry) {
+					printf ("%s found in /etc/fstab. Not mounting.\n", entry);
+					permission_denied_etc_fstab (device);
+				}
+			}
+		} else if (uuid != NULL && g_str_has_prefix (entry, "UUID=")) {
 			if (strcmp (entry + 5, uuid) == 0) {
 				printf ("%s found in /etc/fstab. Not mounting.\n", entry);
 				permission_denied_etc_fstab (device);
 			}
-		} 
+		} else {
 
-		resolved = resolve_symlink (entry);
+			resolved = resolve_symlink (entry);
 #ifdef DEBUG
-		printf ("/etc/fstab: device %s -> %s \n", entry, resolved);
+			printf ("/etc/fstab: device %s -> %s \n", entry, resolved);
 #endif
-		if (strcmp (device, resolved) == 0) {
-			printf ("%s (-> %s) found in /etc/fstab. Not mounting.\n", entry, resolved);
-			permission_denied_etc_fstab (device);
-		}
+			if (strcmp (device, resolved) == 0) {
+				printf ("%s (-> %s) found in /etc/fstab. Not mounting.\n", entry, resolved);
+				permission_denied_etc_fstab (device);
+			}
 
-		g_free (resolved);
+			g_free (resolved);
+		}
 	}
 	fstab_close (handle);
 }
 
-static gboolean
-mtab_open (gpointer *handle)
-{
-#ifdef __FreeBSD__
-	struct mtab_handle *mtab;
-
-	mtab = g_new0 (struct mtab_handle, 1);
-	mtab->n_mounts = getmntinfo (&mtab->mounts, MNT_NOWAIT);
-	if (mtab->n_mounts == 0) {
-		g_free (mtab);
-		return FALSE;
-	}
-
-	*handle = mtab;
-	return TRUE;
-#else
-	*handle = fopen ("/proc/mounts", "r");
-	return *handle != NULL;
-#endif
-}
-
-static char *
-mtab_next (gpointer handle)
-{
-#ifdef __FreeBSD__
-	struct mtab_handle *mtab = handle;
-
-	if (mtab->iter < mtab->n_mounts)
-		return mtab->mounts[mtab->iter++].f_mntfromname;
-	else
-		return NULL;
-#else
-	struct mntent *mnt;
-
-	mnt = getmntent (handle);
-
-	return mnt ? mnt->mnt_fsname : NULL;
-#endif
-}
-
-static void
-mtab_close (gpointer handle)
-{
-#ifdef __FreeBSD__
-	g_free (handle);
-#else
-	fclose (handle);
-#endif
-}
-
 static void
 bailout_if_mounted (const char *device)
 {
@@ -400,7 +375,7 @@ bailout_if_mounted (const char *device)
 	/* check if /proc/mounts mentions this device... (with symlinks etc) */
 	if (! mtab_open (&handle)) {
 		printf ("cannot open mount list\n");
-		unknown_error ();		
+		unknown_error ("Cannot open /etc/mtab or equivalent");		
 	}
 	while ((entry = mtab_next (handle)) != NULL) {
 		char *resolved;
@@ -449,8 +424,6 @@ handle_mount (LibHalContext *hal_ctx, Li
 	char **given_options;
 	gboolean wants_to_change_uid;
 	char *mount_dir;
-	char *cbh_path;
-	FILE *cbh;
 	GError *err = NULL;
 	char *sout = NULL;
 	char *serr = NULL;
@@ -503,7 +476,7 @@ handle_mount (LibHalContext *hal_ctx, Li
 		uuid = NULL;
 	}
 
-	bailout_if_in_fstab (device, label, uuid);
+	bailout_if_in_fstab (hal_ctx, device, label, uuid);
 
 	/* TODO: sanity check that what hal exports is correct (cf. Martin Pitt's email) */
 
@@ -519,11 +492,19 @@ handle_mount (LibHalContext *hal_ctx, Li
 		mount_options [strlen (mount_options) - 1] = '\0';
 	/* validate that input from stdin is UTF-8 */
 	if (!g_utf8_validate (mount_point, -1, &end))
-		unknown_error ();
+		unknown_error ("Error validating mount_point as UTF-8");
 	if (!g_utf8_validate (mount_fstype, -1, &end))
-		unknown_error ();
+		unknown_error ("Error validating mount_fstype as UTF-8");
 	if (!g_utf8_validate (mount_options, -1, &end))
-		unknown_error ();
+		unknown_error ("Error validating mount_options as UTF-8");
+
+	for (i = 0; mount_point[i] != '\0'; i++) {
+		if (mount_point[i] == '\n' ||
+		    mount_point[i] == G_DIR_SEPARATOR) {
+			unknown_error ("mount_point cannot contain the following characters: newline, G_DIR_SEPARATOR (usually /)");
+		}
+	}
+
 #ifdef DEBUG
 	printf ("mount_point    = '%s'\n", mount_point);
 	printf ("mount_fstype   = '%s'\n", mount_fstype);
@@ -604,12 +585,10 @@ handle_mount (LibHalContext *hal_ctx, Li
 		i++;
 	}
 
-	/* TODO: possible race here... need to have only one hal-storage-mount copy run at a time */
-
 	dbus_error_init (&error);
 	allowed_options = libhal_device_get_property_strlist (hal_ctx, udi, "volume.mount.valid_options", &error);
 	if (dbus_error_is_set (&error)) {
-		unknown_error ();
+		unknown_error ("Cannot get volume.mount.valid_options");
 	}
 
 #ifdef DEBUG
@@ -647,7 +626,7 @@ handle_mount (LibHalContext *hal_ctx, Li
 					uid = (uid_t) strtol (given + allow_len, &endp, 10);
 					if (*endp != '\0') {
 						printf ("'%s' is not a number?\n", given);
-						unknown_error ();
+						unknown_error ("option uid is malformed");
 					}
 #ifdef DEBUG
 					printf ("%s with uid %d\n", allow, uid);
@@ -717,7 +696,7 @@ handle_mount (LibHalContext *hal_ctx, Li
 						    &is_temporary_privilege,
 						    NULL) != LIBPOLKIT_RESULT_OK) {
 		printf ("cannot lookup privilege\n");
-		unknown_error ();
+		unknown_error ("Cannot lookup privilege from PolicyKit");
 	}
 
 	if (!allowed_by_privilege) {
@@ -729,10 +708,10 @@ handle_mount (LibHalContext *hal_ctx, Li
 	printf ("passed privilege\n");
 #endif
 
-	/* create directory and the .created-by-hal file */
+	/* create directory */
 	if (g_mkdir (mount_dir, 0700) != 0) {
 		printf ("Cannot create '%s'\n", mount_dir);
-		unknown_error ();
+		unknown_error ("Cannot create mount directory");
 	}
 
 #ifdef __FreeBSD__
@@ -751,29 +730,22 @@ handle_mount (LibHalContext *hal_ctx, Li
 	}
 #endif
 
-	cbh_path = g_strdup_printf ("%s/.created-by-hal", mount_dir);
-	cbh = fopen (cbh_path, "w");
-	if (cbh == NULL) {
-		printf ("Cannot create '%s'\n", cbh_path);
-		g_rmdir (mount_dir);
-		unknown_error ();
-	}
-	fclose (cbh);
+	char *mount_option_commasep = NULL;
+	char *mount_do_fstype = "auto";
 
 	/* construct arguments to mount */
 	na = 0;
 	args[na++] = MOUNT;
 	if (strlen (mount_fstype) > 0) {
-		args[na++] = "-t";
-		args[na++] = (char *) map_fstype (mount_fstype);
+		mount_do_fstype = (char *) map_fstype (mount_fstype);
 	} else if (volume == NULL) {
 		/* non-pollable drive; force auto */
-		args[na++] = "-t";
-		args[na++] = "auto";
+		mount_do_fstype = "auto";
 	} else if (libhal_volume_get_fstype (volume) != NULL && strlen (libhal_volume_get_fstype (volume)) > 0) {
-		args[na++] = "-t";
-		args[na++] = (char *) map_fstype (libhal_volume_get_fstype (volume));
+		mount_do_fstype = (char *) map_fstype (libhal_volume_get_fstype (volume));
 	}
+	args[na++] = "-t";
+	args[na++] = mount_do_fstype;
 
 	args[na++] = "-o";
 	mount_option_str = g_string_new(MOUNT_OPTIONS);
@@ -781,11 +753,84 @@ handle_mount (LibHalContext *hal_ctx, Li
 		g_string_append (mount_option_str, ",");
 		g_string_append (mount_option_str, given_options[i]);
 	}
-	args[na++] = g_string_free (mount_option_str, FALSE); /* leak! */
+	mount_option_commasep = g_string_free (mount_option_str, FALSE); /* leak! */
+	args[na++] = mount_option_commasep;
 	args[na++] = (char *) device;
 	args[na++] = mount_dir;
 	args[na++] = NULL;
 
+	FILE *hal_mtab;
+	char *mount_dir_escaped;
+
+	/* Maintain a list in /media/.hal-mtab with entries of the following format
+	 *
+	 *  <device_file>\t<uid>\t<session-id>\t<fstype>\t<options_sep_by_comma>\t<mount point>\n
+	 *
+	 * where session-id currently is unused and thus set to 0.
+	 *
+	 * Example:
+	 *
+	 *  /dev/sda2	500	0	hfsplus	noexec,nosuid,nodev	/media/Macintosh HD
+	 *  /dev/sda4	500	0	ntfs	noexec,nosuid,nodev,umask=222	/media/Windows
+	 *  /dev/sdb1	500	0	vfat	noexec,nosuid,nodev,shortname=winnt,uid=500	/media/davidz
+	 */
+
+	FILE *hal_mtab_orig;
+	int hal_mtab_orig_len;
+	int num_read;
+	char *hal_mtab_buf;
+	char *hal_mtab_buf_old;
+
+	if (g_file_test ("/media/.hal-mtab", G_FILE_TEST_EXISTS)) {
+		hal_mtab_orig = fopen ("/media/.hal-mtab", "r");
+		if (hal_mtab_orig == NULL) {
+			unknown_error ("Cannot open /media/.hal-mtab");
+		}
+		if (fseek (hal_mtab_orig, 0L, SEEK_END) != 0) {
+			unknown_error ("Cannot seek to end of /media/.hal-mtab");
+		}
+		hal_mtab_orig_len = ftell (hal_mtab_orig);
+		if (hal_mtab_orig_len < 0) {
+			unknown_error ("Cannot determine size of /media/.hal-mtab");
+		}
+		rewind (hal_mtab_orig);
+		hal_mtab_buf = g_new0 (char, hal_mtab_orig_len + 1);
+		num_read = fread (hal_mtab_buf, 1, hal_mtab_orig_len, hal_mtab_orig);
+		if (num_read != hal_mtab_orig_len) {
+			unknown_error ("Cannot read from /media/.hal-mtab");
+		}
+		fclose (hal_mtab_orig);
+	} else {
+		hal_mtab_buf = g_strdup ("");
+	}
+	
+	mount_dir_escaped = g_strescape (mount_dir, NULL);
+#ifdef DEBUG
+	printf ("%d: XYA creating /media/.hal-mtab~\n", getpid ());
+#endif
+	hal_mtab = fopen ("/media/.hal-mtab~", "w");
+	if (hal_mtab == NULL) {
+		unknown_error ("Cannot create /media/.hal-mtab~");
+	}
+	hal_mtab_buf_old = hal_mtab_buf;
+	hal_mtab_buf = g_strdup_printf ("%s%s\t%s\t0\t%s\t%s\t%s\n", 
+					hal_mtab_buf_old,
+					device, invoked_by_uid, mount_do_fstype, 
+					mount_option_commasep, mount_dir_escaped);
+	g_free (hal_mtab_buf_old);
+	if (hal_mtab_buf_old == NULL) {
+		unknown_error ("Out of memory appending to /media/.hal-mtab~");
+	}
+	if (fwrite (hal_mtab_buf, 1, strlen (hal_mtab_buf), hal_mtab) != strlen (hal_mtab_buf)) {
+		unknown_error ("Cannot write to /media/.hal-mtab~");
+	}
+	fclose (hal_mtab);
+	g_free (hal_mtab_buf);
+	g_free (mount_dir_escaped);
+#ifdef DEBUG
+	printf ("%d: XYA closing /media/.hal-mtab~\n", getpid ());
+#endif
+
 	/* now try to mount */
 	if (!g_spawn_sync ("/",
 			   args,
@@ -798,43 +843,53 @@ handle_mount (LibHalContext *hal_ctx, Li
 			   &exit_status,
 			   &err)) {
 		printf ("Cannot execute %s\n", MOUNT);
-		g_unlink (cbh_path);
 		g_rmdir (mount_dir);
-		unknown_error ();
+		unlink ("/media/.hal-mtab~");
+		unknown_error ("Cannot spawn " MOUNT);
 	}
 
 
 	if (exit_status != 0) {
-		char errstr[] = "mount: unknown filesystem type";
+		char errstr[]  = "mount: unknown filesystem type";
 
 		printf ("%s error %d, stdout='%s', stderr='%s'\n", MOUNT, exit_status, sout, serr);
 
-		g_unlink (cbh_path);
 		g_rmdir (mount_dir);
+		unlink ("/media/.hal-mtab~");
 
 		if (strncmp (errstr, serr, sizeof (errstr) - 1) == 0) {
 			unknown_filesystem (strlen (mount_fstype) > 0 ? 
 					    mount_fstype : 
 					    (volume != NULL ? libhal_volume_get_fstype (volume) : "") );
+		} else {
+			int n;
+			for (n = 0; serr[n] != '\0'; n++) {
+				if (serr[n] == '\n') {
+					serr[n] = ' ';
+				}
+			}
+			unknown_error (serr);
 		}
-		unknown_error ();
 	}
 
-	dbus_error_init (&error);
-	libhal_device_set_property_string (hal_ctx, udi, 
-					   "info.hal_mount.created_mount_point",
-					   mount_dir,
-					   &error);
+	if (rename ("/media/.hal-mtab~", "/media/.hal-mtab") != 0) {
+		printf ("rename(2) failed, errno=%d -> '%s'\n", errno, strerror (errno));
+		unlink ("/media/.hal-mtab~");
+#ifdef DEBUG
+	printf ("%d: XYA failed renaming /media/.hal-mtab~ to /media/.hal-mtab\n", getpid ());
+#endif
+		unknown_error ("Cannot rename /media/.hal-mtab~ to /media/.hal-mtab");
+	}
+#ifdef DEBUG
+	printf ("%d: XYA done renaming /media/.hal-mtab~ to /media/.hal-mtab\n", getpid ());
+#endif
 
-	dbus_error_init (&error);
-	libhal_device_set_property_int (hal_ctx, udi, 
-					"info.hal_mount.mounted_by_uid",
-					(dbus_int32_t) atoi (invoked_by_uid),
-					&error);
+	openlog ("hald", 0, LOG_DAEMON);
+	syslog (LOG_INFO, "mounted %s at '%s' on behalf of uid %s", device, mount_dir, invoked_by_uid);
+	closelog ();
 
 	g_free (sout);
 	g_free (serr);
-	g_free (cbh_path);
 	g_free (mount_dir);
 	libhal_free_string_array (allowed_options);
 	g_strfreev (given_options);
@@ -854,6 +909,10 @@ main (int argc, char *argv[])
 	char *invoked_by_uid;
 	char *invoked_by_syscon_name;
 
+	if (!lock_hal_mtab ()) {
+		unknown_error ("Cannot obtain lock on /media/.hal-mtab");
+	}
+
 	device = getenv ("HAL_PROP_BLOCK_DEVICE");
 	if (device == NULL)
 		usage ();
@@ -881,7 +940,7 @@ main (int argc, char *argv[])
 	pol_ctx = libpolkit_new_context (system_bus);
 	if (pol_ctx == NULL) {
 		printf ("Cannot get libpolkit context\n");
-		unknown_error ();
+		unknown_error ("Cannot get libpolkit context");
 	}
 
 	volume = libhal_volume_from_udi (hal_ctx, udi);
@@ -903,17 +962,17 @@ main (int argc, char *argv[])
 		drive_udi = libhal_volume_get_storage_device_udi (volume);
 		
 		if (drive_udi == NULL)
-			unknown_error ();
+			unknown_error ("Cannot get drive_udi from volume");
 		drive = libhal_drive_from_udi (hal_ctx, drive_udi);
 		if (drive == NULL)
-			unknown_error ();
+			unknown_error ("Cannot get drive from hal");
 
 		handle_mount (hal_ctx, pol_ctx, udi, volume, drive, device, invoked_by_uid, 
 			      invoked_by_syscon_name);
 
 	}
 
+	unlock_hal_mtab ();
+
 	return 0;
 }
-
-
diff --git a/tools/linux/hal-luks-remove-linux b/tools/linux/hal-luks-remove-linux
index a9b3dc6..1393dfc 100755
--- a/tools/linux/hal-luks-remove-linux
+++ b/tools/linux/hal-luks-remove-linux
@@ -8,22 +8,23 @@
 
 CRYPTSETUP=/sbin/cryptsetup
 
+echo LUKS cryptotext device $HAL_PROP_INFO_UDI is going away
+
 # make sure that the cleartext volume is unmounted
 CLEARTEXT_VOLUME_UDI=`hal-find-by-property --key volume.crypto_luks.clear.backing_volume --string $HAL_PROP_INFO_UDI`
 RET=$?
 if [ x$RET = x0 ]; then
-    MOUNT_POINT=`hal-get-property --udi $CLEARTEXT_VOLUME_UDI --key volume.mount_point`
-    if [ ! x${#MOUNT_POINT} = x0 ]; then
-	/bin/umount -l "$MOUNT_POINT"
-        # remove directory only if HAL has created it
-	if [ -e "$MOUNT_POINT/.created-by-hal" ]; then
-	    rm -f "$MOUNT_POINT/.created-by-hal"
-	    rmdir --ignore-fail-on-non-empty "$MOUNT_POINT"
-	fi
-	
-    fi
+    echo Attempting unmount of corresponding LUKS cleartext volume $CLEARTEXT_VOLUME_UDI
+    # lazy unmount via D-BUS
+    dbus-send --print-reply --system \
+	      --dest=org.freedesktop.Hal \
+	      $CLEARTEXT_VOLUME_UDI \
+	      org.freedesktop.Hal.Device.Volume.Unmount \
+	      array:string:lazy
 fi
 
+echo Tearing down LUKS cryptotext volume
+
 if [ ! -f $CRYPTSETUP ]; then
 	echo Error removing $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
 	exit 1



More information about the hal-commit mailing list