nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 * 00004 * Copyright CEA/DAM/DIF (2008) 00005 * contributeur : Philippe DENIEL philippe.deniel@cea.fr 00006 * Thomas LEIBOVICI thomas.leibovici@cea.fr 00007 * 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 3 of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 * --------------------------------------- 00024 */ 00025 00037 #ifdef HAVE_CONFIG_H 00038 #include "config.h" 00039 #endif 00040 00041 #ifdef _SOLARIS 00042 #include "solaris_port.h" 00043 #endif /* _SOLARIS */ 00044 00045 #include <stdio.h> 00046 #include <string.h> 00047 #include <pthread.h> 00048 #include <fcntl.h> 00049 #include <sys/file.h> /* for having FNDELAY */ 00050 #include "HashData.h" 00051 #include "HashTable.h" 00052 #include "log.h" 00053 #include "nfs23.h" 00054 #include "nfs4.h" 00055 #include "mount.h" 00056 #include "nfs_core.h" 00057 #include "cache_inode.h" 00058 #include "nfs_exports.h" 00059 #include "nfs_creds.h" 00060 #include "nfs_proto_functions.h" 00061 #include "nfs_tools.h" 00062 #include "nfs_proto_tools.h" 00063 00064 00065 cache_inode_status_t cache_inode_statfs(cache_entry_t *entry, 00066 fsal_dynamicfsinfo_t *dynamicinfo, 00067 fsal_op_context_t *context, 00068 cache_inode_status_t *status) 00069 { 00070 fsal_status_t fsal_status = {0, 0}; 00071 00072 /* Sanity check */ 00073 if(!entry || !context || !dynamicinfo || !status) 00074 { 00075 *status = CACHE_INODE_INVALID_ARGUMENT; 00076 return *status; 00077 } 00078 00079 /* Default return value */ 00080 *status = CACHE_INODE_SUCCESS; 00081 00082 /* Get FSAL to get dynamic info */ 00083 if(FSAL_IS_ERROR 00084 ((fsal_status = FSAL_dynamic_fsinfo(&entry->handle, 00085 context, 00086 dynamicinfo)))) 00087 { 00088 *status = cache_inode_error_convert(fsal_status); 00089 if (fsal_status.major == ERR_FSAL_STALE) { 00090 cache_inode_kill_entry(entry); 00091 } 00092 return *status; 00093 } 00094 LogFullDebug(COMPONENT_CACHE_INODE, 00095 "cache_inode_statfs: dynamicinfo: {total_bytes = %zu, " 00096 "free_bytes = %zu, avail_bytes = %zu, total_files = %llu, " 00097 "free_files = %llu, avail_files = %llu}", 00098 dynamicinfo->total_bytes, dynamicinfo->free_bytes, 00099 dynamicinfo->avail_bytes, dynamicinfo->total_files, 00100 dynamicinfo->free_files, dynamicinfo->avail_files); 00101 return CACHE_INODE_SUCCESS; 00102 } /* cache_inode_statfs */