gvfs/gvfs-1.9.2-fuse-statfs.patch
Tomas Bzatek 535a3425bb Update to 1.9.2
Enable real statfs calls in the fuse daemon
2011-07-27 17:44:41 +02:00

117 lines
3.5 KiB
Diff

From 41eaac3a128459b41a13bc2b7da0d48b275f954b Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed, 27 Jul 2011 12:15:04 +0200
Subject: [PATCH] fuse: Bring back real statfs()
https://bugzilla.gnome.org/show_bug.cgi?id=655401
---
client/gvfsfusedaemon.c | 67 ++++++++++++----------------------------------
1 files changed, 18 insertions(+), 49 deletions(-)
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 4a772fa..b41e83b 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -634,12 +634,6 @@ file_from_full_path (const gchar *path)
* VFS functions *
* ------------- */
-#if 0
-
-/* A stat -f <path> on a FUSE mount always results in this function being called with a path
- * of '/'. This means we can't return valid info for the various mounts. Hopefully we can
- * fix this in the future. */
-
static gint
vfs_statfs (const gchar *path, struct statvfs *stbuf)
{
@@ -649,32 +643,35 @@ vfs_statfs (const gchar *path, struct statvfs *stbuf)
debug_print ("vfs_statfs: %s\n", path);
+ memset (stbuf, 0, sizeof (*stbuf));
+
+ /* Fallback case */
+ stbuf->f_bsize = 4096;
+ stbuf->f_frsize = 4096; /* Ignored by FUSE */
+ stbuf->f_blocks = 0;
+ stbuf->f_bfree = 0;
+ stbuf->f_bavail = 0;
+ stbuf->f_files = 0;
+ stbuf->f_ffree = 0;
+ stbuf->f_favail = 0; /* Ignored by FUSE */
+ stbuf->f_fsid = 1; /* Ignored by FUSE */
+ stbuf->f_flag = 0; /* Ignored by FUSE */
+ stbuf->f_namemax = 1024;
+
if ((file = file_from_full_path (path)))
{
GFileInfo *file_info;
- file_info = g_file_get_filesystem_info (file, "*", NULL, &error);
+ file_info = g_file_query_filesystem_info (file, "filesystem::*", NULL, &error);
if (file_info)
{
- memset (stbuf, 0, sizeof (*stbuf));
-
- stbuf->f_bsize = 4096;
- stbuf->f_frsize = 4096; /* Ignored by FUSE */
- stbuf->f_blocks = 0;
- stbuf->f_bfree = 0;
- stbuf->f_bavail = 0;
- stbuf->f_files = 0;
- stbuf->f_ffree = 0;
- stbuf->f_favail = 0; /* Ignored by FUSE */
- stbuf->f_fsid = 1; /* Ignored by FUSE */
- stbuf->f_flag = 0; /* Ignored by FUSE */
- stbuf->f_namemax = 1024;
-
if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE))
stbuf->f_blocks = g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE) / 4096;
if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE))
stbuf->f_bfree = stbuf->f_bavail = g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE) / 4096;
+
+ g_object_unref (file_info);
}
else if (error)
{
@@ -694,34 +691,6 @@ vfs_statfs (const gchar *path, struct statvfs *stbuf)
return result;
}
-#endif
-
-static gint
-vfs_statfs (const gchar *path, struct statvfs *stbuf)
-{
- gint result = 0;
-
- debug_print ("vfs_statfs: %s\n", path);
-
- memset (stbuf, 0, sizeof (*stbuf));
-
- stbuf->f_bsize = 4096;
- stbuf->f_frsize = 4096; /* Ignored by FUSE */
- stbuf->f_blocks = 0;
- stbuf->f_bfree = 0;
- stbuf->f_bavail = 0;
- stbuf->f_files = 0;
- stbuf->f_ffree = 0;
- stbuf->f_favail = 0; /* Ignored by FUSE */
- stbuf->f_fsid = 1; /* Ignored by FUSE */
- stbuf->f_flag = 0; /* Ignored by FUSE */
- stbuf->f_namemax = 1024;
-
- debug_print ("vfs_statfs: -> %s\n", g_strerror (-result));
-
- return result;
-}
-
static mode_t
file_info_get_stat_mode (GFileInfo *file_info)
{
--
1.7.6