[Pkg-utopia-commits] r109 - in packages/gnome-volume-manager/trunk/debian: . patches
Sjoerd Simons
sjoerd@haydn.debian.org
Fri, 19 Nov 2004 06:00:00 -0700
Author: sjoerd
Date: 2004-11-19 05:59:55 -0700 (Fri, 19 Nov 2004)
New Revision: 109
Added:
packages/gnome-volume-manager/trunk/debian/patches/25_improve_mounting.patch
Removed:
packages/gnome-volume-manager/trunk/debian/patches/04_honor_automount_enabled_hint.patch
packages/gnome-volume-manager/trunk/debian/patches/25_ignore_empty_fsusage.patch
Modified:
packages/gnome-volume-manager/trunk/debian/changelog
packages/gnome-volume-manager/trunk/debian/patches/20_specify_mountprogram.patch
Log:
Move all the mounting improvents into the gvm_device_mount function. Is a lot
clearer, more consistent and even fixes some bugs!
Modified: packages/gnome-volume-manager/trunk/debian/changelog
===================================================================
--- packages/gnome-volume-manager/trunk/debian/changelog 2004-11-18 22:32:59 UTC (rev 108)
+++ packages/gnome-volume-manager/trunk/debian/changelog 2004-11-19 12:59:55 UTC (rev 109)
@@ -15,8 +15,6 @@
+ Removed. Obsoleted by debian/patches/00_set_defaults.patch
* debian/patches/07_default_photo_command.patch
+ Removed. Obsoleted by debian/patches/00_set_defaults.patch
- * debian/patches/04_honor_automount_enabled_hint.patch
- + Added. honor hal's storage.automount_enabled_hint property
* debian/patches/06_mount_at_start.patch
+ Updated. Removed gui option to not mount static drives. This should be
done by a hal fdi file now.
@@ -26,9 +24,10 @@
* Use pmount-hal and pumount as commands for mounting and unmounting.
* debian/patches/02_search_fstab.patch
+ Removed. pmount searches fstab now, so we don't have too.
- * debian/patches/25_ignore_empty_fsusage.patch
- + Added. When hal couldn't determine the filesystem usage, assume it's a
- filesystem.
+ * debian/patches/25_improve-mounting.patch
+ + Added. Don't mount if the volume is already mounted. Don't mount if the
+ volume doesn't have a sensible filesystem. Don't mount if
+ storage.automount_enabled_hint is false.
-- Sjoerd Simons <sjoerd@debian.org> Wed, 17 Nov 2004 11:44:57 +0100
Deleted: packages/gnome-volume-manager/trunk/debian/patches/04_honor_automount_enabled_hint.patch
===================================================================
--- packages/gnome-volume-manager/trunk/debian/patches/04_honor_automount_enabled_hint.patch 2004-11-18 22:32:59 UTC (rev 108)
+++ packages/gnome-volume-manager/trunk/debian/patches/04_honor_automount_enabled_hint.patch 2004-11-19 12:59:55 UTC (rev 109)
@@ -1,84 +0,0 @@
-diff -ruN gnome-volume-manager-old/src/manager.c gnome-volume-manager/src/manager.c
---- gnome-volume-manager-old/src/manager.c 2004-11-18 15:04:19.500931000 +0100
-+++ gnome-volume-manager/src/manager.c 2004-11-18 15:04:19.696942980 +0100
-@@ -243,6 +243,26 @@
- return retval;
- }
-
-+/* Returns true if the storage policy indicates this should be manually
-+ * mounted */
-+static gboolean
-+gvm_is_manual_mount(LibHalContext *ctx, const char *udi) {
-+ gchar *parent;
-+ gboolean ret = FALSE;
-+
-+ parent = hal_device_get_property_string(ctx, udi, "info.parent");
-+ if (hal_device_property_exists (hal_ctx, parent,
-+ "storage.automount_enabled_hint")) {
-+ ret = !hal_device_get_property_bool (hal_ctx, parent,
-+ "storage.automount_enabled_hint");
-+ }
-+ if (hal_device_property_exists (hal_ctx, udi,
-+ "storage.automount_enabled_hint")) {
-+ ret = !hal_device_get_property_bool (hal_ctx, udi,
-+ "storage.automount_enabled_hint");
-+ }
-+ return ret;
-+}
- /*
- * gvm_check_dvd - is this a Video DVD? If so, do something about it.
- *
-@@ -558,6 +578,8 @@
-
- switch (action) {
- case MOUNT:
-+ if (gvm_is_manual_mount(hal_ctx, udi))
-+ break;
- gvm_device_mount (device);
- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
- break;
-@@ -634,7 +656,7 @@
- } else if (has_audio && has_data) {
- gvm_ask_mixed (udi);
- } else if (has_data) {
-- if (config.automount_media) {
-+ if (config.automount_media && !gvm_is_manual_mount(hal_ctx, udi)) {
- gvm_device_mount (device);
- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
- }
-@@ -692,9 +714,10 @@
- } else {
- dbg ("Added: %s\n", device);
-
-- if (config.automount_drives) {
-+ if (config.automount_drives && !gvm_is_manual_mount(hal_ctx, udi)) {
- gvm_device_mount (device);
-- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
-+ mounted_volumes_policy_queue =
-+ g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
- }
- }
-
-@@ -756,9 +779,10 @@
- /* folks, we have a new device! */
- dbg ("Added: %s\n", device);
-
-- if (config.automount_drives) {
-+ if (config.automount_drives && !gvm_is_manual_mount(ctx, udi)) {
- gvm_device_mount (device);
-- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
-+ mounted_volumes_policy_queue =
-+ g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
- }
-
- out:
-@@ -967,6 +991,9 @@
- "volume.fsusage"),
- "filesystem") != 0)
- continue;
-+ /* only automagically mount when manual_mount is not specified */
-+ if (gvm_is_manual_mount(ctx, udi))
-+ continue;
-
- device_file = hal_device_get_property_string (ctx, udi,
- "block.device");
Modified: packages/gnome-volume-manager/trunk/debian/patches/20_specify_mountprogram.patch
===================================================================
--- packages/gnome-volume-manager/trunk/debian/patches/20_specify_mountprogram.patch 2004-11-18 22:32:59 UTC (rev 108)
+++ packages/gnome-volume-manager/trunk/debian/patches/20_specify_mountprogram.patch 2004-11-19 12:59:55 UTC (rev 109)
@@ -1,6 +1,6 @@
diff -ruN gnome-volume-manager-old/configure gnome-volume-manager/configure
--- gnome-volume-manager-old/configure 2004-10-30 17:12:10.000000000 +0200
-+++ gnome-volume-manager/configure 2004-11-18 15:07:32.017555854 +0100
++++ gnome-volume-manager/configure 2004-11-19 13:24:52.476201352 +0100
@@ -309,7 +309,7 @@
# include <unistd.h>
#endif"
@@ -394,7 +394,7 @@
sed "$ac_vpsub
diff -ruN gnome-volume-manager-old/configure.in gnome-volume-manager/configure.in
--- gnome-volume-manager-old/configure.in 2004-10-30 17:10:32.000000000 +0200
-+++ gnome-volume-manager/configure.in 2004-11-18 15:07:32.460582602 +0100
++++ gnome-volume-manager/configure.in 2004-11-19 13:24:52.478201467 +0100
@@ -8,12 +8,21 @@
AC_PROG_CC
@@ -422,8 +422,8 @@
diff -ruN gnome-volume-manager-old/src/manager.c gnome-volume-manager/src/manager.c
---- gnome-volume-manager-old/src/manager.c 2004-11-18 15:07:31.741539000 +0100
-+++ gnome-volume-manager/src/manager.c 2004-11-18 15:09:38.676203127 +0100
+--- gnome-volume-manager-old/src/manager.c 2004-11-19 13:24:52.270189000 +0100
++++ gnome-volume-manager/src/manager.c 2004-11-19 13:26:33.237995524 +0100
@@ -145,20 +145,20 @@
gvm_config_changed, NULL, NULL, NULL);
}
@@ -536,7 +536,7 @@
}
/*
-@@ -477,23 +520,9 @@
+@@ -457,23 +500,9 @@
* @return TRUE iff the mount was succesful
*/
static gboolean
@@ -562,7 +562,7 @@
}
/*
-@@ -505,23 +534,8 @@
+@@ -485,23 +514,8 @@
* @return TRUE iff the mount was succesful
*/
static gboolean
@@ -588,43 +588,43 @@
}
/*
-@@ -580,7 +594,7 @@
+@@ -558,7 +572,7 @@
+
+ switch (action) {
case MOUNT:
- if (gvm_is_manual_mount(hal_ctx, udi))
- break;
- gvm_device_mount (device);
+ gvm_device_mount (udi, device);
mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
break;
case PLAY:
-@@ -657,7 +671,7 @@
+@@ -635,7 +649,7 @@
gvm_ask_mixed (udi);
} else if (has_data) {
- if (config.automount_media && !gvm_is_manual_mount(hal_ctx, udi)) {
+ if (config.automount_media) {
- gvm_device_mount (device);
-+ gvm_device_mount (udi,device);
++ gvm_device_mount (udi, device);
mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
}
} else if (is_blank) {
-@@ -715,7 +729,7 @@
+@@ -693,7 +707,7 @@
dbg ("Added: %s\n", device);
- if (config.automount_drives && !gvm_is_manual_mount(hal_ctx, udi)) {
+ if (config.automount_drives) {
- gvm_device_mount (device);
+ gvm_device_mount (udi, device);
- mounted_volumes_policy_queue =
- g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
+ mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
}
-@@ -780,7 +794,7 @@
+ }
+@@ -757,7 +771,7 @@
dbg ("Added: %s\n", device);
- if (config.automount_drives && !gvm_is_manual_mount(ctx, udi)) {
+ if (config.automount_drives) {
- gvm_device_mount (device);
+ gvm_device_mount (udi, device);
- mounted_volumes_policy_queue =
- g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
+ mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
}
-@@ -861,7 +875,7 @@
+
+@@ -837,7 +851,7 @@
policy_udi = g_slist_find_custom (mounted_volumes_policy_queue,
udi,
@@ -633,7 +633,7 @@
if (policy_udi != NULL) {
g_free (policy_udi->data);
mounted_volumes_policy_queue = g_slist_delete_link (mounted_volumes_policy_queue,
-@@ -1072,7 +1086,7 @@
+@@ -1045,7 +1059,7 @@
dbg ("mount_all: mounting %s\n", device_file);
@@ -642,7 +642,7 @@
hal_free_string (device_file);
} else
-@@ -1111,7 +1125,7 @@
+@@ -1084,7 +1098,7 @@
dbg ("unmount_all: unmounting %s\n", device_file);
Deleted: packages/gnome-volume-manager/trunk/debian/patches/25_ignore_empty_fsusage.patch
===================================================================
--- packages/gnome-volume-manager/trunk/debian/patches/25_ignore_empty_fsusage.patch 2004-11-18 22:32:59 UTC (rev 108)
+++ packages/gnome-volume-manager/trunk/debian/patches/25_ignore_empty_fsusage.patch 2004-11-19 12:59:55 UTC (rev 109)
@@ -1,17 +0,0 @@
-diff -ruN gnome-volume-manager-old/src/manager.c gnome-volume-manager/src/manager.c
---- gnome-volume-manager-old/src/manager.c 2004-11-18 15:18:47.437344000 +0100
-+++ gnome-volume-manager/src/manager.c 2004-11-18 15:21:59.411942343 +0100
-@@ -1057,9 +1057,10 @@
- /* only mount if the block device got a sensible filesystem */
- if (!hal_device_property_exists (ctx, udi,
- "volume.fsusage") ||
-- strcmp (hal_device_get_property_string (ctx, udi,
-- "volume.fsusage"),
-- "filesystem") != 0)
-+ (strcmp (hal_device_get_property_string (ctx, udi,
-+ "volume.fsusage"), "filesystem") != 0
-+ && strcmp (hal_device_get_property_string (ctx, udi,
-+ "volume.fsusage"), "") != 0))
- continue;
- /* only automagically mount when manual_mount is not specified */
- if (gvm_is_manual_mount(ctx, udi))
Added: packages/gnome-volume-manager/trunk/debian/patches/25_improve_mounting.patch
===================================================================
--- packages/gnome-volume-manager/trunk/debian/patches/25_improve_mounting.patch 2004-11-18 22:32:59 UTC (rev 108)
+++ packages/gnome-volume-manager/trunk/debian/patches/25_improve_mounting.patch 2004-11-19 12:59:55 UTC (rev 109)
@@ -0,0 +1,163 @@
+diff -ruN gnome-volume-manager-old/src/manager.c gnome-volume-manager/src/manager.c
+--- gnome-volume-manager-old/src/manager.c 2004-11-19 13:27:47.299259000 +0100
++++ gnome-volume-manager/src/manager.c 2004-11-19 13:55:09.235092324 +0100
+@@ -491,6 +491,27 @@
+ hal_free_string (mount_point);
+ }
+
++/* Returns true if the storage policy indicates this should be manually
++ * mounted */
++static gboolean
++gvm_is_manual_mount(LibHalContext *ctx, const char *udi) {
++ gchar *parent;
++ gboolean ret = FALSE;
++
++ parent = hal_device_get_property_string(ctx, udi, "info.parent");
++ if (hal_device_property_exists (hal_ctx, parent,
++ "storage.automount_enabled_hint")) {
++ ret = !hal_device_get_property_bool (hal_ctx, parent,
++ "storage.automount_enabled_hint");
++ }
++ if (hal_device_property_exists (hal_ctx, udi,
++ "storage.automount_enabled_hint")) {
++ ret = !hal_device_get_property_bool (hal_ctx, udi,
++ "storage.automount_enabled_hint");
++ }
++ return ret;
++}
++
+ /*
+ * gvm_device_mount - use BIN_MOUNT to mount the given device node.
+ *
+@@ -500,9 +521,46 @@
+ * @return TRUE iff the mount was succesful
+ */
+ static gboolean
+-gvm_device_mount (const char *udi, const char *device)
++gvm_device_mount (const char *udi, const char *device, gboolean run_policy)
+ {
+- return (gvm_run_command_sync(device , BIN_MOUNT, NULL, udi) == 0);
++ gboolean ret = FALSE;
++ /* don't attempt to mount if the automount_hint is false */
++ if (gvm_is_manual_mount(hal_ctx, udi)) {
++ dbg("%s has storage.automount_enabled_hint == false, not mounting", udi);
++ return FALSE;
++ }
++ /* don't attempt to mount already mounted volumes */
++ if (!hal_device_property_exists (hal_ctx, udi,
++ "volume.is_mounted") ||
++ hal_device_get_property_bool (hal_ctx, udi,
++ "volume.is_mounted")) {
++ dbg("%s already mounted, not mounting again", udi);
++ return FALSE;
++ }
++
++ /* only mount if the block device got a sensible filesystem
++ * or when hal couldn't detect the filesystem */
++ if (!hal_device_property_exists (hal_ctx, udi,
++ "volume.fsusage") ||
++ (strcmp (hal_device_get_property_string (hal_ctx, udi,
++ "volume.fsusage"), "filesystem") != 0
++ && strcmp (hal_device_get_property_string (hal_ctx, udi,
++ "volume.fsusage"), "") != 0)) {
++ dbg("%s isn't use as a filesystem\n", udi);
++ return FALSE;
++ }
++
++ ret = (gvm_run_command_sync(device , BIN_MOUNT, NULL, udi) == 0);
++ if (ret) {
++ /* add to list of all volumes mounted during lifetime */
++ all_mounted_volumes =
++ g_slist_append (all_mounted_volumes, g_strdup (udi));
++ }
++ if (ret && run_policy) {
++ mounted_volumes_policy_queue =
++ g_slist_append (mounted_volumes_policy_queue, g_strdup(udi));
++ }
++ return ret;
+ }
+
+ /*
+@@ -572,8 +630,7 @@
+
+ switch (action) {
+ case MOUNT:
+- gvm_device_mount (udi, device);
+- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
++ gvm_device_mount (udi, device, TRUE);
+ break;
+ case PLAY:
+ gvm_run_cdplayer (device, device, udi);
+@@ -649,8 +706,7 @@
+ gvm_ask_mixed (udi);
+ } else if (has_data) {
+ if (config.automount_media) {
+- gvm_device_mount (udi, device);
+- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
++ gvm_device_mount (udi, device, TRUE);
+ }
+ } else if (is_blank) {
+ if (gvm_device_is_writer (drive_udi))
+@@ -707,8 +763,7 @@
+ dbg ("Added: %s\n", device);
+
+ if (config.automount_drives) {
+- gvm_device_mount (udi, device);
+- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
++ gvm_device_mount (udi, device, TRUE);
+ }
+ }
+
+@@ -771,8 +826,7 @@
+ dbg ("Added: %s\n", device);
+
+ if (config.automount_drives) {
+- gvm_device_mount (udi, device);
+- mounted_volumes_policy_queue = g_slist_append (mounted_volumes_policy_queue, g_strdup (udi));
++ gvm_device_mount (udi, device, TRUE);
+ }
+
+ out:
+@@ -845,10 +899,6 @@
+
+ dbg ("Mounted: %s\n", udi);
+
+- /* add to list of all volumes mounted during lifetime */
+- all_mounted_volumes = g_slist_append (all_mounted_volumes,
+- g_strdup (udi));
+-
+ policy_udi = g_slist_find_custom (mounted_volumes_policy_queue,
+ udi,
+ (GCompareFunc)g_ascii_strcasecmp);
+@@ -1022,22 +1072,6 @@
+ volumes = hal_find_device_by_capability (ctx, "volume", &num_volumes);
+ for (i = 0; i < num_volumes; i++) {
+ udi = volumes [i];
+-
+- /* don't attempt to mount already mounted volumes */
+- if (!hal_device_property_exists (ctx, udi,
+- "volume.is_mounted") ||
+- hal_device_get_property_bool (ctx, udi,
+- "volume.is_mounted"))
+- continue;
+-
+- /* only mount if the block device got a sensible filesystem */
+- if (!hal_device_property_exists (ctx, udi,
+- "volume.fsusage") ||
+- strcmp (hal_device_get_property_string (ctx, udi,
+- "volume.fsusage"),
+- "filesystem") != 0)
+- continue;
+-
+ drive_udi = hal_device_get_property_string(ctx, udi, "info.parent");
+
+ if (hal_device_property_exists(ctx, drive_udi, "storage.hotpluggable") &&
+@@ -1059,7 +1093,7 @@
+
+ dbg ("mount_all: mounting %s\n", device_file);
+
+- gvm_device_mount (udi, device_file);
++ gvm_device_mount (udi, device_file, FALSE);
+
+ hal_free_string (device_file);
+ } else