[gvfs/gnome-2-28] [SMB] Support querying filesystem size and free space
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-2-28] [SMB] Support querying filesystem size and free space
- Date: Fri, 27 Nov 2009 14:16:04 +0000 (UTC)
commit 94140ae2c7d31b12bb64d1f809d2728b9c076b8b
Author: Tomas Bzatek <tbzatek redhat com>
Date: Tue Nov 10 18:11:12 2009 +0100
[SMB] Support querying filesystem size and free space
Requires libsmbclient >= 3.2.0
Fixes rfe bug 565337
(cherry picked from commit 72d716e37bd8a26361608a69beb60089981dee19)
daemon/gvfsbackendsmb.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index bc8c415..1f8dc6b 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1591,8 +1591,36 @@ do_query_fs_info (GVfsBackend *backend,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher)
{
+ GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend);
+ smbc_statvfs_fn smbc_statvfs;
+ struct statvfs st = {0};
+ char *uri;
+ int res;
+
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "cifs");
-
+
+#ifdef DEPRECATED_SMBC_INTERFACE
+ if (g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_SIZE) ||
+ g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE) ||
+ g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
+ {
+ uri = create_smb_uri (op_backend->server, op_backend->share, filename);
+ smbc_statvfs = smbc_getFunctionStatVFS (op_backend->smb_context);
+ res = smbc_statvfs (op_backend->smb_context, uri, &st);
+ g_free (uri);
+
+ 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);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, st.f_flag & SMBC_VFS_FEATURE_RDONLY);
+ }
+ }
+#endif
+
g_vfs_job_succeeded (G_VFS_JOB (job));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]