nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 */ 00004 00014 #ifdef HAVE_CONFIG_H 00015 #include "config.h" 00016 #endif 00017 00018 #include "fsal.h" 00019 #include "fsal_internal.h" 00020 #include "fsal_convert.h" 00021 00041 fsal_status_t ZFSFSAL_dynamic_fsinfo(fsal_handle_t * filehandle, /* IN */ 00042 fsal_op_context_t * p_context, /* IN */ 00043 fsal_dynamicfsinfo_t * dynamicinfo /* OUT */ 00044 ) 00045 { 00046 00047 /* sanity checks. */ 00048 if(!filehandle || !dynamicinfo || !p_context) 00049 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_dynamic_fsinfo); 00050 00051 TakeTokenFSCall(); 00052 00053 struct statvfs statfs; 00054 int rc = libzfswrap_statfs(((zfsfsal_op_context_t *)p_context)->export_context->p_vfs, 00055 &statfs); 00056 00057 ReleaseTokenFSCall(); 00058 00059 /* >> interpret returned status << */ 00060 if(rc) 00061 Return(posix2fsal_error(rc), 0, INDEX_FSAL_dynamic_fsinfo); 00062 00063 dynamicinfo->total_bytes = statfs.f_frsize * statfs.f_blocks; 00064 dynamicinfo->free_bytes = statfs.f_frsize * statfs.f_bfree; 00065 dynamicinfo->avail_bytes = statfs.f_frsize * statfs.f_bavail; 00066 00067 dynamicinfo->total_files = statfs.f_files; 00068 dynamicinfo->free_files = statfs.f_ffree; 00069 dynamicinfo->avail_files = statfs.f_favail; 00070 00071 dynamicinfo->time_delta.seconds = 1; 00072 dynamicinfo->time_delta.nseconds = 0; 00073 00074 00075 Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_dynamic_fsinfo); 00076 }