diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2008-10-10 23:05:06 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2008-10-10 23:05:06 +0800 |
commit | 96a9d000ec5cf1a453485c440adb14a771d52c41 (patch) | |
tree | c0d5c8a7059ec6062c755d4d14ca38c03fc1b66d /sysutils/hal/files | |
parent | 7b434cc841653c1de94d75421c53c9e44c30ed07 (diff) | |
download | marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.tar marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.tar.gz marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.tar.bz2 marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.tar.lz marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.tar.xz marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.tar.zst marcuscom-ports-96a9d000ec5cf1a453485c440adb14a771d52c41.zip |
Pull out the fuse patches as they made a bad assumption. More work needs
to be done.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@11677 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'sysutils/hal/files')
-rw-r--r-- | sysutils/hal/files/patch-hald_freebsd_hf-volume.c | 100 | ||||
-rw-r--r-- | sysutils/hal/files/patch-tools_hal-storage-mount.c | 86 | ||||
-rw-r--r-- | sysutils/hal/files/patch-tools_hal-storage-shared.c | 43 |
3 files changed, 3 insertions, 226 deletions
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-volume.c b/sysutils/hal/files/patch-hald_freebsd_hf-volume.c deleted file mode 100644 index b34ee563b..000000000 --- a/sysutils/hal/files/patch-hald_freebsd_hf-volume.c +++ /dev/null @@ -1,100 +0,0 @@ ---- hald/freebsd/hf-volume.c.orig 2008-05-07 19:24:03.000000000 -0400 -+++ hald/freebsd/hf-volume.c 2008-10-09 01:07:34.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,11 @@ 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); -+ } - } - - hal_device_property_set_bool(device, "volume.is_mounted", mount != NULL); diff --git a/sysutils/hal/files/patch-tools_hal-storage-mount.c b/sysutils/hal/files/patch-tools_hal-storage-mount.c index 390d35111..c270893c2 100644 --- a/sysutils/hal/files/patch-tools_hal-storage-mount.c +++ b/sysutils/hal/files/patch-tools_hal-storage-mount.c @@ -1,91 +1,11 @@ ---- 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 @@ +--- 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 @@ #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 deleted file mode 100644 index 9a19c9d4f..000000000 --- a/sysutils/hal/files/patch-tools_hal-storage-shared.c +++ /dev/null @@ -1,43 +0,0 @@ ---- tools/hal-storage-shared.c.orig 2008-05-07 19:24:24.000000000 -0400 -+++ tools/hal-storage-shared.c 2008-10-09 01:09:33.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; -+#endif - - #ifdef DEBUG - printf ("device = %s\n", device); -@@ -473,7 +476,18 @@ line_found: - #endif - if (option_force) - args[na++] = "-f"; -- args[na++] = (char *) device; -+#ifdef __FreeBSD__ -+ dbus_error_init (&error); -+ 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 +511,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); |