[gvfs/wip/udisks2] Set should_automount and can_mount properties to make automounting work
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/udisks2] Set should_automount and can_mount properties to make automounting work
- Date: Fri, 6 Jan 2012 18:27:48 +0000 (UTC)
commit b4800b987b4a8423a52306c9aef35b3777464cc5
Author: David Zeuthen <davidz redhat com>
Date: Fri Jan 6 13:27:14 2012 -0500
Set should_automount and can_mount properties to make automounting work
Signed-off-by: David Zeuthen <davidz redhat com>
monitor/udisks2/gvfsudisks2volume.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c
index bc11868..ea21d79 100644
--- a/monitor/udisks2/gvfsudisks2volume.c
+++ b/monitor/udisks2/gvfsudisks2volume.c
@@ -311,6 +311,31 @@ update_volume (GVfsUDisks2Volume *volume)
if (media_icon != NULL)
g_object_unref (media_icon);
+ /* Only automount filesystems from drives of known types/interconnects:
+ *
+ * - USB
+ * - Firewire
+ * - sdio
+ * - optical discs
+ *
+ * The mantra here is "be careful" - we really don't want to
+ * automount filesystems from all devices in a SAN etc - We
+ * REALLY need to be CAREFUL here.
+ *
+ * Fortunately udisks provides a property just for this.
+ */
+ if (udisks_drive_get_removable (udisks_drive))
+ {
+ /* Also, if a volume (partition) appear _much later_ than when media was inserted it
+ * can only be because the media was repartitioned. We don't want to automount
+ * such volumes. So only mark volumes appearing just after their drive.
+ */
+ if (g_get_real_time () - udisks_drive_get_time_media_detected (udisks_drive) < 5 * G_USEC_PER_SEC)
+ {
+ volume->should_automount = TRUE;
+ }
+ }
+
g_object_unref (udisks_drive);
}
@@ -371,6 +396,9 @@ update_volume (GVfsUDisks2Volume *volume)
volume->icon = gvfs_udisks2_utils_icon_from_fs_type (g_unix_mount_point_get_fs_type (volume->mount_point));
}
+ if (volume->mount == NULL)
+ volume->can_mount = TRUE;
+
/* ---------------------------------------------------------------------------------------------------- */
/* fallbacks */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]