summaryrefslogtreecommitdiff
path: root/sysutils/hal/files
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/hal/files')
-rw-r--r--sysutils/hal/files/README.fuse31
-rw-r--r--sysutils/hal/files/hald.in1
-rw-r--r--sysutils/hal/files/mount-fuse129
-rw-r--r--sysutils/hal/files/patch-consolekit0387
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_addons_Makefile.in13
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_addons_addon-mouse.c182
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_hf-volume.c102
-rw-r--r--sysutils/hal/files/patch-tools_hal-storage-eject.c11
-rw-r--r--sysutils/hal/files/patch-tools_hal-storage-mount.c86
-rw-r--r--sysutils/hal/files/patch-tools_hal-storage-shared.c45
10 files changed, 647 insertions, 40 deletions
diff --git a/sysutils/hal/files/README.fuse b/sysutils/hal/files/README.fuse
new file mode 100644
index 000000000000..75adcab7d589
--- /dev/null
+++ b/sysutils/hal/files/README.fuse
@@ -0,0 +1,31 @@
+Mounting Fuse File Systems with HAL
+-----------------------------------
+
+$FreeBSD$
+
+Hal supports mounting Fuse device-backed file systems (e.g. NTFS). To enable
+this feature, copy the included %%LOCALBASE%%/share/hal/mount-fuse script
+to /sbin. Make sure this script is executable. Edit the script, and change
+the FUSE_HELPER environment variable to the name of the executable which
+will actually mount the Fuse volume (e.g. for NTFS, this is ``ntfs-3g'').
+
+Finally, the script must be renamed to ``mount_FSNAME''. FSNAME is the name
+of the file system type (e.g. for NTFS, this is ``ntfs''). If there is
+already an executable in /sbin or /usr/sbin with this name, the
+existing executable must be renamed or deleted.
+
+As is stated in the examples above, overriding FreeBSD's existing NTFS
+support with Fuse's ntfs-3g is the most common use case for this. The
+ntfs-3g Fuse driver uses different mount options than FreeBSD's included
+mount_ntfs. GNOME transparently supports switching between ntfs and
+ntfs-3g. Simply edit the following GConf key in the GNOME
+Configuration Editor (i.e. gconf-editor):
+
+/system/storage/default_options/ntfs/fstype_override
+
+Set the value to ``ntfs-3g'', then add your desired ntfs-3g options to the
+following GConf key:
+
+/system/storage/default_options/ntfs-3g/mount_options
+
+Other desktop systems may have similar options.
diff --git a/sysutils/hal/files/hald.in b/sysutils/hal/files/hald.in
index 7f8f2c659c86..04e784e6ce6f 100644
--- a/sysutils/hal/files/hald.in
+++ b/sysutils/hal/files/hald.in
@@ -1,6 +1,7 @@
#!/bin/sh
#
# $FreeBSD$
+# $MCom: ports/sysutils/hal/files/hald.in,v 1.14 2008/08/21 16:04:48 mezz Exp $
#
# PROVIDE: hald
# REQUIRE: DAEMON usbd devd dbus
diff --git a/sysutils/hal/files/mount-fuse b/sysutils/hal/files/mount-fuse
new file mode 100644
index 000000000000..ae906a8140d3
--- /dev/null
+++ b/sysutils/hal/files/mount-fuse
@@ -0,0 +1,129 @@
+#!/bin/sh
+# Wrapper script for FreeBSD and PC-BSD, which takes calls from HAL
+# for running mount_ntfs, and performs it with a given FUSE helper.
+###################################################################
+
+## Modify this next variable to point to the correct FUSE helper.
+FUSE_HELPER="ntfs-3g"
+## DO NOT modify anything below this.
+
+FUSEDB="/tmp"
+if [ -n "${TMPDIR}" ]
+then
+ FUSEDB=${TMPDIR}
+fi
+
+FUSEDB="${FUSEDB}/.fuse-mnts"
+MNTSTRING=""
+OPTIONS=""
+FOUNDOPT="0"
+FOUNDU="0"
+HWDEV=""
+FOUNDDEV="0"
+
+for i in $@
+do
+ if [ "$FOUNDOPT" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o ${i}"
+ elif [ "${FOUNDU}" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o uid=${i}"
+ else
+
+ if [ "${FOUNDDEV}" = "1" ]
+ then
+ # Save the mount-point, will be used later
+ MNTPOINT="${i}"
+ FOUNDDEV="2"
+ fi
+
+ echo ${i}| grep -q "/dev" 2>/dev/null
+ if [ "$?" = "0" -a "${FOUNDDEV}" = "0" ]
+ then
+ FOUNDDEV="1"
+ # Lets check if we were given a fuse[] device
+ # or a real device name
+ echo "${i}" | grep -q "fuse" 2>/dev/null
+ if [ "$?" = "0" ]
+ then
+ # Lets save the old fuse device name we had saved
+ OLDFUSE="${i}"
+
+ # Lets get the *real* device name for FUSE helper
+ REALHWDEV="`cat ${FUSEDB} | grep ${i} | cut -d '=' -f 2`"
+
+ # Now lets change the string we will be saving
+ i="${REALHWDEV}"
+ else
+ # We are doing a first time mount of this device
+
+ # Set the real device name for mounting
+ REALHWDEV="${i}"
+ fi
+ fi
+
+ # Add the value to our mount string
+ if [ "${i}" != "-o" -a "${i}" != "-u" ]
+ then
+ MNTSTRING="${MNTSTRING} ${i}"
+ fi
+
+ fi
+
+ # Check if we are on a -u flag now
+ if [ "${i}" = "-u" ]
+ then
+ FOUNDU="1"
+ else
+ FOUNDU="0"
+ fi
+
+ # Check if we are on a -o option
+ if [ "${i}" = "-o" ]
+ then
+ FOUNDOPT="1"
+ else
+ FOUNDOPT="0"
+ fi
+done
+
+# Save our final string which our FUSE helper will use
+FINALSTRING="${MNTSTRING} ${OPTIONS}"
+
+
+# Check that fuse.ko is loaded
+kldstat | grep -q fuse 2>/dev/null
+if [ "$?" != "0" ]
+then
+ kldload /usr/local/modules/fuse.ko
+fi
+
+# Run the FUSE helper command now, with the options in the right order
+${FUSE_HELPER} ${FINALSTRING}
+
+# If we have an OLDFUSE variable, lets clear it from the list
+if [ ! -z "${OLDFUSE}" -a -e ${FUSEDB} ]
+then
+ cat ${FUSEDB} | grep -v "${OLDFUSE}=" > /tmp/.newfuse
+ mv /tmp/.newfuse ${FUSEDB}
+fi
+
+# Now lets figure out which fuse device was used and save it to DB
+NEWFUSE="`mount | tr -s ' ' | grep \" ${MNTPOINT} \" | cut -d ' ' -f 1`"
+
+# Make sure we don't already have this fuse device listed
+if [ -e ${FUSEDB} ]
+then
+ cat ${FUSEDB} | grep -v "${NEWFUSE}=" > /tmp/.newfuse
+ mv /tmp/.newfuse ${FUSEDB}
+else
+ touch ${FUSEDB}
+fi
+
+# Save the fuse device to our DB
+echo "${NEWFUSE}=${REALHWDEV}" >> ${FUSEDB}
+
+
+# Finished!
+exit 0
diff --git a/sysutils/hal/files/patch-consolekit03 b/sysutils/hal/files/patch-consolekit03
new file mode 100644
index 000000000000..a948b189b18e
--- /dev/null
+++ b/sysutils/hal/files/patch-consolekit03
@@ -0,0 +1,87 @@
+diff -p -up hal-0.5.11/configure.in.ck03 hal-0.5.11/configure.in
+--- hal-0.5.11/configure.in.ck03 2008-05-07 19:24:31.000000000 -0400
++++ configure.in 2008-08-11 06:18:07.000000000 -0400
+@@ -485,6 +485,20 @@ if test "x$enable_console_kit" != "xno";
+ AM_CONDITIONAL(HAVE_CONKIT, true)
+ AC_DEFINE(HAVE_CONKIT, [], [Set if we use ConsoleKit])
+ msg_conkit=yes
++ # yes this is ugly, but there is no other way to get the version of CK
++ AC_MSG_CHECKING([if ConsoleKit version 0.3.0 or newer])
++ if $PKG_CONFIG --atleast-version=0.3.0 ck-connector; then
++ AC_MSG_RESULT([yes])
++ AC_DEFINE(HAVE_CK_0_3, 1, [Define to 1 if ConsoleKit is v0.3.0 or newer])
++ else
++ if $PKG_CONFIG --max-version=0.2.10 ck-connector; then
++ AC_MSG_RESULT([no])
++ else
++ #assume we have the latest version
++ AC_MSG_WARN([Couldn't detect ConsoleKit version, install the devel package, assume for now you use >= 0.3.0])
++ AC_DEFINE(HAVE_CK_0_3, 1, [Define to 1 if ConsoleKit is v0.3.0 or newer])
++ fi
++ fi
+ fi
+
+ AC_PATH_PROG(GPERF, [gperf], [no])
+diff -p -up hal-0.5.11/hald/ck-tracker.c.ck03 hal-0.5.11/hald/ck-tracker.c
+--- hal-0.5.11/hald/ck-tracker.c.ck03 2008-05-07 19:23:48.000000000 -0400
++++ hald/ck-tracker.c 2008-08-12 12:34:47.000000000 -0400
+@@ -256,7 +256,11 @@ ck_session_get_info (CKTracker *tracker,
+ goto error;
+ }
+ if (!dbus_message_get_args (reply, NULL,
++#ifdef HAVE_CK_0_3
++ DBUS_TYPE_UINT32, &(session->user),
++#else
+ DBUS_TYPE_INT32, &(session->user),
++#endif
+ DBUS_TYPE_INVALID)) {
+ HAL_ERROR (("Invalid GetUnixUser reply from CK"));
+ goto error;
+@@ -531,7 +535,11 @@ ck_tracker_process_system_bus_message (C
+ seat_objpath = dbus_message_get_path (message);
+
+ if (!dbus_message_get_args (message, NULL,
++#ifdef HAVE_CK_0_3
++ DBUS_TYPE_OBJECT_PATH, &seat_objpath,
++#else
+ DBUS_TYPE_STRING, &seat_objpath,
++#endif
+ DBUS_TYPE_INVALID)) {
+ HAL_ERROR (("Invalid SeatAdded signal from CK"));
+ goto out;
+@@ -558,7 +566,11 @@ ck_tracker_process_system_bus_message (C
+ seat_objpath = dbus_message_get_path (message);
+
+ if (!dbus_message_get_args (message, NULL,
++#ifdef HAVE_CK_0_3
++ DBUS_TYPE_OBJECT_PATH, &seat_objpath,
++#else
+ DBUS_TYPE_STRING, &seat_objpath,
++#endif
+ DBUS_TYPE_INVALID)) {
+ HAL_ERROR (("Invalid SeatRemoved signal from CK"));
+ goto out;
+@@ -588,7 +600,11 @@ ck_tracker_process_system_bus_message (C
+ seat_objpath = dbus_message_get_path (message);
+
+ if (!dbus_message_get_args (message, NULL,
++#ifdef HAVE_CK_0_3
++ DBUS_TYPE_OBJECT_PATH, &session_objpath,
++#else
+ DBUS_TYPE_STRING, &session_objpath,
++#endif
+ DBUS_TYPE_INVALID)) {
+ HAL_ERROR (("Invalid SessionAdded signal from CK"));
+ goto out;
+@@ -624,7 +640,11 @@ ck_tracker_process_system_bus_message (C
+ seat_objpath = dbus_message_get_path (message);
+
+ if (!dbus_message_get_args (message, NULL,
++#ifdef HAVE_CK_0_3
++ DBUS_TYPE_OBJECT_PATH, &session_objpath,
++#else
+ DBUS_TYPE_STRING, &session_objpath,
++#endif
+ DBUS_TYPE_INVALID)) {
+ HAL_ERROR (("Invalid SessionRemoved signal from CK"));
+ goto out;
diff --git a/sysutils/hal/files/patch-hald_freebsd_addons_Makefile.in b/sysutils/hal/files/patch-hald_freebsd_addons_Makefile.in
index beb677fa943a..f554c0650f3e 100644
--- a/sysutils/hal/files/patch-hald_freebsd_addons_Makefile.in
+++ b/sysutils/hal/files/patch-hald_freebsd_addons_Makefile.in
@@ -1,5 +1,5 @@
---- hald/freebsd/addons/Makefile.in.orig 2008-03-27 00:45:50.000000000 -0400
-+++ hald/freebsd/addons/Makefile.in 2008-03-27 00:48:15.000000000 -0400
+--- hald/freebsd/addons/Makefile.in.orig 2008-12-13 12:08:36.000000000 -0500
++++ hald/freebsd/addons/Makefile.in 2008-12-20 21:16:41.000000000 -0500
@@ -33,7 +33,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@@ -39,19 +39,20 @@
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-@@ -227,6 +239,11 @@ hald_addon_storage_SOURCES = addon-stora
+@@ -229,6 +241,12 @@ hald_addon_storage_SOURCES = addon-stora
hald_addon_storage_LDADD = \
$(top_builddir)/hald/freebsd/libprobe/libhald_freebsd_probe.la
+hald_addon_mouse_sysmouse_SOURCES = addon-mouse.c
+hald_addon_mouse_sysmouse_CFLAGS = $(AM_CPPFLAGS) @GLIB_CFLAGS@
+hald_addon_mouse_sysmouse_LDADD = @GLIB_LIBS@ \
++ -lutil \
+ $(top_builddir)/hald/freebsd/libprobe/libhald_freebsd_probe.la
+
all: all-am
.SUFFIXES:
-@@ -288,6 +305,9 @@ clean-libexecPROGRAMS:
+@@ -290,6 +308,9 @@ clean-libexecPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
@@ -61,7 +62,7 @@
hald-addon-storage$(EXEEXT): $(hald_addon_storage_OBJECTS) $(hald_addon_storage_DEPENDENCIES)
@rm -f hald-addon-storage$(EXEEXT)
$(LINK) $(hald_addon_storage_OBJECTS) $(hald_addon_storage_LDADD) $(LIBS)
-@@ -299,6 +319,7 @@ distclean-compile:
+@@ -301,6 +322,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addon-storage.Po@am__quote@
@@ -69,7 +70,7 @@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@@ -321,6 +342,20 @@ distclean-compile:
+@@ -323,6 +345,20 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
diff --git a/sysutils/hal/files/patch-hald_freebsd_addons_addon-mouse.c b/sysutils/hal/files/patch-hald_freebsd_addons_addon-mouse.c
index 21e413123908..70da9b2af8c6 100644
--- a/sysutils/hal/files/patch-hald_freebsd_addons_addon-mouse.c
+++ b/sysutils/hal/files/patch-hald_freebsd_addons_addon-mouse.c
@@ -1,6 +1,6 @@
---- hald/freebsd/addons/addon-mouse.c.orig 2008-03-31 04:53:42.000000000 -0400
-+++ hald/freebsd/addons/addon-mouse.c 2008-03-31 05:07:19.000000000 -0400
-@@ -0,0 +1,216 @@
+--- hald/freebsd/addons/addon-mouse.c.orig 2008-12-21 01:15:41.000000000 -0500
++++ hald/freebsd/addons/addon-mouse.c 2008-12-21 01:17:03.000000000 -0500
+@@ -0,0 +1,336 @@
+/***************************************************************************
+ * CVSID: $Id$
+ *
@@ -28,6 +28,13 @@
+# include <config.h>
+#endif
+
++#include <sys/param.h>
++#if __FreeBSD_version >= 800058
++#include <sys/types.h>
++#include <sys/user.h>
++#include <sys/sysctl.h>
++#include <libutil.h>
++#endif
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
@@ -38,7 +45,9 @@
+
+#include "../libprobe/hfp.h"
+
++#if __FreeBSD_version < 800058
+#define CMD "/usr/bin/fstat %s"
++#endif
+
+#define MOUSE_DRIVER "mouse"
+#define MOUSED_DEVICE "/dev/sysmouse"
@@ -47,11 +56,121 @@
+
+static struct
+{
-+ const struct timespec update_interval;
-+ char *device_file;
-+ struct timespec next_update;
++ const struct timespec update_interval;
++ char *device_file;
++ struct timespec next_update;
+} addon = { { 2, 0 } };
+
++#if __FreeBSD_version >= 800058
++static struct kinfo_proc *
++hfp_kinfo_getproc (int *cntp)
++{
++ int mib[3];
++ int error;
++ int cnt;
++ size_t len;
++ char *buf, *bp, *eb;
++ struct kinfo_proc *kip, *kp, *ki;
++
++ *cntp = 0;
++
++ len = 0;
++ mib[0] = CTL_KERN;
++ mib[1] = KERN_PROC;
++ mib[2] = KERN_PROC_PROC;
++
++ error = sysctl(mib, 3, NULL, &len, NULL, 0);
++ if (error)
++ return NULL;
++
++ len = len * 4 / 3;
++ buf = (char *) g_malloc(len);
++ if (buf == NULL)
++ return NULL;
++
++ error = sysctl(mib, 3, buf, &len, NULL, 0);
++ if (error)
++ {
++ g_free(buf);
++ return NULL;
++ }
++
++ cnt = 0;
++ bp = buf;
++ eb = buf + len;
++ while (bp < eb)
++ {
++ ki = (struct kinfo_proc *) (uintptr_t) bp;
++ bp += ki->ki_structsize;
++ cnt++;
++ }
++
++ kip = calloc(cnt, sizeof (*kip));
++ if (kip == NULL)
++ {
++ g_free(buf);
++ return NULL;
++ }
++
++ bp = buf;
++ eb = buf + len;
++ kp = kip;
++ while (bp < eb)
++ {
++ ki = (struct kinfo_proc *) (uintptr_t) bp;
++ memcpy(kp, ki, ki->ki_structsize);
++ bp += ki->ki_structsize;
++ kp->ki_structsize = sizeof(*kp);
++ kp++;
++ }
++
++ g_free(buf);
++ *cntp = cnt;
++ return kip;
++}
++
++static gboolean
++device_opened_by_proc (const char *device, const char *proc)
++{
++ struct kinfo_proc *kip, *pfreep;
++ int cnt, i;
++
++ pfreep = hfp_kinfo_getproc(&cnt);
++ if (pfreep == NULL)
++ return FALSE;
++
++ for (i = 0; i < cnt; i++)
++ {
++ kip = &pfreep[i];
++
++ if (! strcmp(kip->ki_comm, proc))
++ {
++ struct kinfo_file *kif, *ffreep;
++ int fcnt, j;
++
++ ffreep = kinfo_getfile(kip->ki_pid, &fcnt);
++ if (ffreep == NULL)
++ continue;
++ for (j = 0; j < fcnt; j++)
++ {
++ kif = &ffreep[j];
++
++ if (kif->kf_type == KF_TYPE_VNODE &&
++ ! strcmp(kif->kf_path, device))
++ {
++ g_free(ffreep);
++ g_free(pfreep);
++ return TRUE;
++ }
++ }
++ g_free(ffreep);
++ }
++ }
++ g_free(pfreep);
++
++ return FALSE;
++}
++#else
+static gboolean
+device_opened_by_proc (const char *device, const char *proc)
+{
@@ -91,16 +210,16 @@
+ if (len < 2)
+ {
+ g_strfreev(fields);
-+ continue;
-+ }
++ continue;
++ }
+ for (j = 1; j < len && fields[j] && *fields[j] == '\0'; j++)
+ ;
+ if (j < len && fields[j] && ! strcmp(fields[j], proc))
+ {
+ found = TRUE;
+ g_strfreev(fields);
-+ break;
-+ }
++ break;
++ }
+ g_strfreev(fields);
+ }
+
@@ -111,6 +230,7 @@
+
+ return found;
+}
++#endif
+
+static const char *
+get_mouse_device (const char *device)
@@ -186,27 +306,27 @@
+ {
+ /* process dbus traffic until update interval has elapsed */
+ while (TRUE)
-+ {
-+ struct timespec now;
-+
-+ hfp_clock_gettime(&now);
-+ if (hfp_timespeccmp(&now, &addon.next_update, <))
-+ {
-+ struct timespec timeout;
-+
-+ timeout = addon.next_update;
-+ hfp_timespecsub(&timeout, &now);
-+
-+ if (timeout.tv_sec < 0) /* current time went backwards */
-+ timeout = addon.update_interval;
-+
-+ dbus_connection_read_write_dispatch(connection, timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000);
-+ if (! dbus_connection_get_is_connected(connection))
-+ goto end;
-+ }
-+ else
-+ break;
-+ }
++ {
++ struct timespec now;
++
++ hfp_clock_gettime(&now);
++ if (hfp_timespeccmp(&now, &addon.next_update, <))
++ {
++ struct timespec timeout;
++
++ timeout = addon.next_update;
++ hfp_timespecsub(&timeout, &now);
++
++ if (timeout.tv_sec < 0) /* current time went backwards */
++ timeout = addon.update_interval;
++
++ dbus_connection_read_write_dispatch(connection, timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000);
++ if (! dbus_connection_get_is_connected(connection))
++ goto end;
++ }
++ else
++ break;
++ }
+
+ poll_for_moused();
+
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-volume.c b/sysutils/hal/files/patch-hald_freebsd_hf-volume.c
new file mode 100644
index 000000000000..039a1a6760f4
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_hf-volume.c
@@ -0,0 +1,102 @@
+--- hald/freebsd/hf-volume.c.orig 2008-05-07 19:24:03.000000000 -0400
++++ hald/freebsd/hf-volume.c 2008-10-26 15:17:09.000000000 -0400
+@@ -45,6 +45,7 @@
+ #include "hf-util.h"
+
+ #define PROBE_VOLUME_TIMEOUT (HAL_HELPER_TIMEOUT * 6)
++#define HF_VOLUME_FUSE_DB "/tmp/.fuse-mnts"
+
+ static void
+ hf_volume_get_mounts (struct statfs **mounts, int *n_mounts)
+@@ -60,6 +61,55 @@ hf_volume_get_mounts (struct statfs **mo
+ }
+ }
+
++static char *
++hf_volume_resolve_fuse (const char *special)
++{
++ gchar *contents;
++ gchar **lines;
++ gsize len;
++ int i;
++
++ g_return_val_if_fail(special != NULL, NULL);
++
++ if (! g_file_get_contents(HF_VOLUME_FUSE_DB, &contents, &len, NULL))
++ return g_strdup(special);
++
++ lines = g_strsplit(contents, "\n", 0);
++ g_free(contents);
++
++ for (i = 0; lines && lines[i]; i++)
++ {
++ gchar **fields;
++
++ fields = g_strsplit(lines[i], "=", 2);
++ if (fields && g_strv_length(fields) == 2)
++ {
++ if (strcmp(fields[0], special) == 0)
++ {
++ g_strfreev(fields);
++ g_strfreev(lines);
++ return g_strdup(fields[1]);
++ }
++ }
++ g_strfreev(fields);
++ }
++
++ g_strfreev(lines);
++
++ return g_strdup(special);
++}
++
++static char *
++hf_volume_resolve_special (const char *special)
++{
++ g_return_val_if_fail(special != NULL, NULL);
++
++ if (strstr(special, "fuse"))
++ return hf_volume_resolve_fuse(special);
++
++ return g_strdup(special);
++}
++
+ static const struct statfs *
+ hf_volume_mounts_find (const struct statfs *mounts,
+ int n_mounts,
+@@ -71,8 +121,18 @@ hf_volume_mounts_find (const struct stat
+ g_return_val_if_fail(special != NULL, NULL);
+
+ for (i = 0; i < n_mounts; i++)
+- if (! strcmp(mounts[i].f_mntfromname, special))
+- return &mounts[i];
++ {
++ char *resolved;
++
++ resolved = hf_volume_resolve_special(mounts[i].f_mntfromname);
++ if (! strcmp(resolved, special))
++ {
++ g_free(resolved);
++ return &mounts[i];
++ }
++
++ g_free(resolved);
++ }
+
+ return NULL;
+ }
+@@ -92,7 +152,13 @@ hf_volume_device_update_mount_properties
+
+ special = hal_device_property_get_string(device, "block.device");
+ if (special)
+- mount = hf_volume_mounts_find(mounts, n_mounts, special);
++ {
++ mount = hf_volume_mounts_find(mounts, n_mounts, special);
++ if (mount && strcmp(special, mount->f_mntfromname))
++ hal_device_property_set_string(device, "volume.freebsd.real_mounted_device", mount->f_mntfromname);
++ else
++ hal_device_property_remove(device, "volume.freebsd.real_mounted_device");
++ }
+ }
+
+ hal_device_property_set_bool(device, "volume.is_mounted", mount != NULL);
diff --git a/sysutils/hal/files/patch-tools_hal-storage-eject.c b/sysutils/hal/files/patch-tools_hal-storage-eject.c
new file mode 100644
index 000000000000..730e2a076d1c
--- /dev/null
+++ b/sysutils/hal/files/patch-tools_hal-storage-eject.c
@@ -0,0 +1,11 @@
+--- tools/hal-storage-eject.c.orig 2008-10-27 13:23:11.000000000 -0400
++++ tools/hal-storage-eject.c 2008-10-27 13:23:23.000000000 -0400
+@@ -190,7 +190,7 @@ main (int argc, char *argv[])
+ unknown_eject_error ("Cannot obtain lock on /media/.hal-mtab");
+ }
+ handle_unmount (hal_ctx,
+- udi, volume_to_unmount, drive,
++ volume_udi, volume_to_unmount, drive,
+ libhal_volume_get_device_file (volume_to_unmount),
+ invoked_by_uid, invoked_by_syscon_name,
+ FALSE, FALSE); /* use neither lazy nor force */
diff --git a/sysutils/hal/files/patch-tools_hal-storage-mount.c b/sysutils/hal/files/patch-tools_hal-storage-mount.c
index c270893c2b2c..390d35111481 100644
--- a/sysutils/hal/files/patch-tools_hal-storage-mount.c
+++ b/sysutils/hal/files/patch-tools_hal-storage-mount.c
@@ -1,11 +1,91 @@
---- tools/hal-storage-mount.c.orig 2008-04-29 20:05:38.000000000 -0400
-+++ tools/hal-storage-mount.c 2008-04-29 20:05:44.000000000 -0400
-@@ -56,7 +56,7 @@
+--- tools/hal-storage-mount.c.orig 2008-05-07 19:24:23.000000000 -0400
++++ tools/hal-storage-mount.c 2008-10-09 00:54:34.000000000 -0400
+@@ -56,8 +56,9 @@
#ifdef __FreeBSD__
#define MOUNT "/sbin/mount"
-#define MOUNT_OPTIONS "noexec,nosuid"
+#define MOUNT_OPTIONS "nosuid"
#define MOUNT_TYPE_OPT "-t"
++#define FUSE_DB "/tmp/.fuse-mnts"
#elif sun
#define MOUNT "/sbin/mount"
+ #define MOUNT_OPTIONS "noexec,nosuid"
+@@ -255,6 +256,51 @@ out:
+ return f;
+ }
+
++#ifdef __FreeBSD__
++static char *
++resolve_fuse (const char *special)
++{
++ gchar *contents;
++ gchar **lines;
++ gsize len;
++ int i;
++
++ if (! g_file_get_contents (FUSE_DB, &contents, &len, NULL))
++ return g_strdup (special);
++
++ lines = g_strsplit (contents, "\n", 0);
++ g_free (contents);
++
++ for (i = 0; lines && lines[i]; i++) {
++ gchar **fields;
++
++ fields = g_strsplit (lines[i], "=", 2);
++ if (fields && g_strv_length (fields) == 2) {
++ if (strcmp (fields[0], special) == 0) {
++ g_strfreev (fields);
++ g_strfreev (lines);
++ return g_strdup (fields[1]);
++ }
++ }
++ g_strfreev (fields);
++ }
++
++ g_strfreev (lines);
++
++ return g_strdup (special);
++}
++#endif
++
++static char *
++resolve_special (const char *special)
++{
++#ifdef __FreeBSD__
++ if (strstr(special, "fuse"))
++ return resolve_fuse (special);
++#endif
++ return g_strdup (special);
++}
++
+ static LibHalVolume *
+ volume_findby (LibHalContext *hal_ctx, const char *property, const char *value)
+ {
+@@ -400,18 +446,20 @@ device_is_mounted (const char *device, c
+ unknown_error ("Cannot open /etc/mtab or equivalent");
+ }
+ while (((entry = mtab_next (handle, mount_point)) != NULL) && (ret == FALSE)) {
+- char *resolved;
++ char *resolved, *rspecial;
+
+ resolved = resolve_symlink (entry);
++ rspecial = resolve_special (resolved);
++ g_free (resolved);
+ #ifdef DEBUG
+- printf ("/proc/mounts: device %s -> %s \n", entry, resolved);
++ printf ("/proc/mounts: device %s -> %s \n", entry, rspecial);
+ #endif
+- if (strcmp (device, resolved) == 0) {
+- printf ("%s (-> %s) found in mount list. Not mounting.\n", entry, resolved);
++ if (strcmp (device, rspecial) == 0) {
++ printf ("%s (-> %s) found in mount list. Not mounting.\n", entry, rspecial);
+ ret = TRUE;
+ }
+
+- g_free (resolved);
++ g_free (rspecial);
+ }
+ mtab_close (handle);
+ return ret;
diff --git a/sysutils/hal/files/patch-tools_hal-storage-shared.c b/sysutils/hal/files/patch-tools_hal-storage-shared.c
new file mode 100644
index 000000000000..1ed7fe907bac
--- /dev/null
+++ b/sysutils/hal/files/patch-tools_hal-storage-shared.c
@@ -0,0 +1,45 @@
+--- tools/hal-storage-shared.c.orig 2008-05-07 19:24:24.000000000 -0400
++++ tools/hal-storage-shared.c 2008-10-20 14:53:35.000000000 -0400
+@@ -297,6 +297,9 @@ handle_unmount (LibHalContext *hal_ctx,
+ char *mount_point_to_unmount;
+ gboolean mounted_by_other_uid;
+ FILE *hal_mtab_new;
++#ifdef __FreeBSD__
++ char *rdevice = NULL;
++#endif
+
+ #ifdef DEBUG
+ printf ("device = %s\n", device);
+@@ -473,7 +476,20 @@ line_found:
+ #endif
+ if (option_force)
+ args[na++] = "-f";
+- args[na++] = (char *) device;
++#ifdef __FreeBSD__
++ dbus_error_init (&error);
++ if (libhal_device_property_exists (hal_ctx, udi, "volume.freebsd.real_mounted_device", NULL)) {
++ rdevice = libhal_device_get_property_string (hal_ctx, udi, "volume.freebsd.real_mounted_device", &error);
++ if (dbus_error_is_set (&error)) {
++ dbus_error_free (&error);
++ unknown_error ("Error while getting volume.freebsd.real_mounted_device");
++ }
++ }
++ if (rdevice)
++ args[na++] = rdevice;
++ else
++#endif
++ args[na++] = (char *) device;
+ args[na++] = NULL;
+
+ #ifdef DEBUG
+@@ -497,6 +513,10 @@ line_found:
+ unknown_error ("Cannot spawn " UMOUNT);
+ }
+
++#ifdef __FreeBSD__
++ g_free (rdevice);
++#endif
++
+ /* check if unmount was succesful */
+ if (exit_status != 0) {
+ printf ("%s error %d, stdout='%s', stderr='%s'\n", UMOUNT, exit_status, sout, serr);