diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-11-11 14:56:32 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-11-15 16:55:54 +0200 |
commit | 66f204655a7ca44a20dea2dae267c456c714c4af (patch) | |
tree | dd50d32576c232e746a606ba79b4e26063c99687 /daemon/gvfsbackendsmb.c | |
parent | e355526f0c6c00bbb7593d02accd4075c4da800f (diff) | |
download | gvfs-66f204655a7ca44a20dea2dae267c456c714c4af.tar.gz |
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
Diffstat (limited to 'daemon/gvfsbackendsmb.c')
-rw-r--r-- | daemon/gvfsbackendsmb.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c index f2d2599a..d24d00ed 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); } } |