[gvfs] smb: Report number of bytes used on the filesystem
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] smb: Report number of bytes used on the filesystem
- Date: Fri, 15 Nov 2013 14:59:45 +0000 (UTC)
commit 66f204655a7ca44a20dea2dae267c456c714c4af
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Mon Nov 11 14:56:32 2013 +0200
smb: Report number of bytes used on the filesystem
Calculated the number of bytes used by subtracting the size from the
number of bytes free, as done with local files.
https://bugzilla.gnome.org/show_bug.cgi?id=711838
daemon/gvfsbackendsmb.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index f2d2599..d24d00e 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1723,6 +1723,8 @@ do_query_fs_info (GVfsBackend *backend,
g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE) ||
g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_USED) ||
+ g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
{
uri = create_smb_uri (op_backend->server, op_backend->port, op_backend->share, filename);
@@ -1740,8 +1742,12 @@ do_query_fs_info (GVfsBackend *backend,
* - 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));
+ guint64 size, free_space;
+ size = st.f_bsize * st.f_blocks * ((st.f_frsize == 0) ? 1 : st.f_frsize);
+ free_space = st.f_bsize * st.f_bfree * ((st.f_frsize == 0) ? 1 : st.f_frsize);
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, size);
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, free_space);
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USED, size - free_space);
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]