1ebebde639
- SMB: Fix free space calculation for older samba servers - fuse: Fix setting timestamps
43 lines
2.3 KiB
Diff
43 lines
2.3 KiB
Diff
From dd3e17181854c91f7c9123360652ae2ec28ea03e Mon Sep 17 00:00:00 2001
|
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
Date: Mon, 30 Nov 2009 15:24:10 +0100
|
|
Subject: [PATCH] [SMB] Fix free space calculation for older samba servers
|
|
|
|
Samba servers older than 3.0.28 report zero values.
|
|
---
|
|
daemon/gvfsbackendsmb.c | 18 +++++++++++-------
|
|
1 files changed, 11 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
|
|
index f53b8cb..88dac26 100644
|
|
--- a/daemon/gvfsbackendsmb.c
|
|
+++ b/daemon/gvfsbackendsmb.c
|
|
@@ -1615,13 +1615,17 @@ do_query_fs_info (GVfsBackend *backend,
|
|
|
|
if (res == 0)
|
|
{
|
|
- /* FIXME: inconsistent return values (libsmbclient-3.4.2)
|
|
- * - for linux samba hosts, f_frsize is zero and f_bsize is a real block size
|
|
- * - for some Windows hosts (XP), f_frsize and f_bsize should be multiplied to get real block size
|
|
- */
|
|
- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, st.f_bsize * st.f_blocks * ((st.f_frsize == 0) ? 1 : st.f_frsize));
|
|
- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, st.f_bsize * st.f_bfree * ((st.f_frsize == 0) ? 1 : st.f_frsize));
|
|
- g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, st.f_flag & SMBC_VFS_FEATURE_RDONLY);
|
|
+ /* older samba versions ( < 3.0.28) return zero values in struct statvfs */
|
|
+ if (st.f_blocks > 0)
|
|
+ {
|
|
+ /* FIXME: inconsistent return values (libsmbclient-3.4.2)
|
|
+ * - for linux samba hosts, f_frsize is zero and f_bsize is a real block size
|
|
+ * - for some Windows hosts (XP), f_frsize and f_bsize should be multiplied to get real block size
|
|
+ */
|
|
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, st.f_bsize * st.f_blocks * ((st.f_frsize == 0) ? 1 : st.f_frsize));
|
|
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, st.f_bsize * st.f_bfree * ((st.f_frsize == 0) ? 1 : st.f_frsize));
|
|
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, st.f_flag & SMBC_VFS_FEATURE_RDONLY);
|
|
+ }
|
|
}
|
|
}
|
|
#endif
|
|
--
|
|
1.6.5.2
|
|
|