[gvfs] Pass the 'flush' mount option for vfat



commit 8488ee446cf2ddb1380065bc0f983dc60682f7fc
Author: David Zeuthen <davidz redhat com>
Date:   Wed Apr 15 14:41:27 2009 -0400

    Pass the 'flush' mount option for vfat
    
    This mount option makes the vfat filesystem driver flush data more
    often. As a consequence
    
     1. users never get to see the gnome-disk-utility notification daemon
        dialog just added
    
         http://people.freedesktop.org/~david/gdu-unmount-busy-1.png
    
        but that's useful for other filesystems as well.
    
     2. The Nautilus copy dialog stays up until things are on the disk
    
    We do this in gvfs rather than DeviceKit-disks because in some
    scenarios 'flush' may be unwanted and there is currently no way to
    turn it off (e.g. no 'noflush' or 'flush=0' option).
    
    Ideally the kernel would get this kind of thing right by itself.
---
 monitor/gdu/ggduvolume.c |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index 49494a1..871a1c5 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -648,6 +648,27 @@ g_gdu_volume_get_mount (GVolume *volume)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+static gchar **
+get_mount_options (GduDevice *device)
+{
+  gchar **ret;
+
+  /* one day we might read this from user settings */
+  if (g_strcmp0 (gdu_device_id_get_usage (device), "filesystem") == 0 &&
+      g_strcmp0 (gdu_device_id_get_type (device), "vfat") == 0)
+    {
+      ret = g_new0 (gchar *, 2);
+      ret[0] = g_strdup ("flush");
+      ret[1] = NULL;
+    }
+  else
+    ret = NULL;
+
+  return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 struct MountOpData
 {
   GGduVolume *volume;
@@ -735,8 +756,11 @@ mount_obtain_authz_cb (GObject *source_object,
     }
   else
     {
+      gchar **mount_options;
       /* got the authz, now try again */
-      gdu_device_op_filesystem_mount (data->device_to_mount, mount_cb, data);
+      mount_options = get_mount_options (data->device_to_mount);
+      gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
+      g_strfreev (mount_options);
       goto out;
     }
 
@@ -842,7 +866,10 @@ mount_cleartext_device (MountOpData *data,
     }
   else
     {
-      gdu_device_op_filesystem_mount (data->device_to_mount, mount_cb, data);
+      gchar **mount_options;
+      mount_options = get_mount_options (data->device_to_mount);
+      gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
+      g_strfreev (mount_options);
     }
 
   g_object_unref (pool);
@@ -1260,8 +1287,11 @@ g_gdu_volume_mount (GVolume             *_volume,
     }
   else
     {
+      gchar **mount_options;
       data->device_to_mount = g_object_ref (device);
-      gdu_device_op_filesystem_mount (data->device_to_mount, mount_cb, data);
+      mount_options = get_mount_options (data->device_to_mount);
+      gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
+      g_strfreev (mount_options);
     }
 
  out:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]