summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2008-04-18 06:06:35 +0000
committerDavid Zeuthen <davidz@src.gnome.org>2008-04-18 06:06:35 +0000
commit5b126c763d3f753b0309c923a849c25898278f52 (patch)
tree53402c02c6863897ee53effa0e64d4184abb901f
parentc6a61a512c926774c26879d53245ba25470fae8b (diff)
downloadgvfs-5b126c763d3f753b0309c923a849c25898278f52.tar.gz
Avoid having GVolume and GMount objects for mounts for which the mount
2008-04-16 David Zeuthen <davidz@redhat.com> * hal/ghalvolumemonitor.c: (should_mount_be_ignored), (should_volume_be_ignored), (update_mounts): Avoid having GVolume and GMount objects for mounts for which the mount point will make g_unix_mount_guess_should_display() return FALSE. This fixes a problem where e.g. live cd installers mounts some file system somewhere (e.g. a /boot partition at /mnt/installer_boot). svn path=/trunk/; revision=1745
-rw-r--r--ChangeLog11
-rw-r--r--hal/ghalvolumemonitor.c47
2 files changed, 57 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 607962ec..00f57da1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-16 David Zeuthen <davidz@redhat.com>
+
+ * hal/ghalvolumemonitor.c: (should_mount_be_ignored),
+ (should_volume_be_ignored), (update_mounts):
+
+ Avoid having GVolume and GMount objects for mounts for which the
+ mount point will make g_unix_mount_guess_should_display() return
+ FALSE. This fixes a problem where e.g. live cd installers mounts
+ some file system somewhere (e.g. a /boot partition at
+ /mnt/installer_boot).
+
2008-04-16 Matthias Clasen <mclasen@redhat.com>
Bug 526793 – unmount hangs with some backends
diff --git a/hal/ghalvolumemonitor.c b/hal/ghalvolumemonitor.c
index 6baaaa6c..001e885e 100644
--- a/hal/ghalvolumemonitor.c
+++ b/hal/ghalvolumemonitor.c
@@ -845,6 +845,32 @@ get_mount_point_for_device (HalDevice *d, GList *fstab_mount_points)
}
static gboolean
+should_mount_be_ignored (HalPool *pool, HalDevice *d)
+{
+ const char *device_mount_point;
+
+ device_mount_point = hal_device_get_property_string (d, "volume.mount_point");
+ if (device_mount_point != NULL && strlen (device_mount_point) > 0)
+ {
+ GUnixMountEntry *mount_entry;
+
+ /*g_warning ("device_mount_point = '%s'", device_mount_point);*/
+
+ mount_entry = g_unix_mount_at (device_mount_point, NULL);
+ if (mount_entry != NULL) {
+ if (!g_unix_mount_guess_should_display (mount_entry))
+ {
+ g_unix_mount_free (mount_entry);
+ return TRUE;
+ }
+ g_unix_mount_free (mount_entry);
+ }
+ }
+
+ return FALSE;
+}
+
+static gboolean
should_volume_be_ignored (HalPool *pool, HalDevice *d, GList *fstab_mount_points)
{
gboolean volume_ignore;
@@ -893,6 +919,9 @@ should_volume_be_ignored (HalPool *pool, HalDevice *d, GList *fstab_mount_points
if (mount_point != NULL && !_g_unix_mount_point_guess_should_display (mount_point))
return TRUE;
+ if (hal_device_get_property_bool (d, "volume.is_mounted"))
+ return should_mount_be_ignored (pool, d);
+
return FALSE;
}
@@ -1207,13 +1236,29 @@ update_mounts (GHalVolumeMonitor *monitor,
{
GList *new_mounts;
GList *removed, *added;
- GList *l;
+ GList *l, *ll;
GHalMount *mount;
GHalVolume *volume;
const char *device_path;
const char *mount_path;
new_mounts = g_unix_mounts_get (NULL);
+
+ /* remove mounts we want to ignore - we do it here so we get to reevaluate
+ * on the next update whether they should still be ignored
+ */
+ for (l = new_mounts; l != NULL; l = ll)
+ {
+ GUnixMountEntry *mount_entry = l->data;
+ ll = l->next;
+
+ /* keep in sync with should_mount_be_ignored() */
+ if (!g_unix_mount_guess_should_display (mount_entry))
+ {
+ g_unix_mount_free (mount_entry);
+ new_mounts = g_list_delete_link (new_mounts, l);
+ }
+ }
new_mounts = g_list_sort (new_mounts, (GCompareFunc) g_unix_mount_compare);