diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2009-11-18 13:16:03 +0100 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2009-11-18 13:16:03 +0100 |
commit | 922d398b8896684e166808ae047764633836913f (patch) | |
tree | ee6e8598dac00f70540e17e7170cc6620dc0f9b4 | |
parent | 02ee90989d201f3730a928e7756d79cfcfb582bf (diff) | |
download | gvfs-922d398b8896684e166808ae047764633836913f.tar.gz |
[SMB] Fix free space calculation for Windows hosts
Needs more testing, it's just a workaround.
libsmbclient docs missing!
-rw-r--r-- | daemon/gvfsbackendsmb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c index 1f8dc6b0..37c6c201 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); } } |