[gvfs/gnome-2-28] [SMB] Fix free space calculation for Windows hosts
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-2-28] [SMB] Fix free space calculation for Windows hosts
- Date: Fri, 27 Nov 2009 14:16:09 +0000 (UTC)
commit 64f936f3ad40ca52e115099b62b3b4912323a800
Author: Tomas Bzatek <tbzatek redhat com>
Date: Wed Nov 18 13:16:03 2009 +0100
[SMB] Fix free space calculation for Windows hosts
Needs more testing, it's just a workaround.
libsmbclient docs missing!
(cherry picked from commit 922d398b8896684e166808ae047764633836913f)
daemon/gvfsbackendsmb.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 1f8dc6b..37c6c20 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1614,8 +1614,12 @@ do_query_fs_info (GVfsBackend *backend,
if (res == 0)
{
- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, st.f_bsize * st.f_blocks);
- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, st.f_bsize * st.f_bavail);
+ /* 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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]