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 "log.h" 00046 #include "HashData.h" 00047 #include "HashTable.h" 00048 #include "fsal.h" 00049 #include "cache_inode.h" 00050 #include "sal_data.h" 00051 #include "cache_inode_lru.h" 00052 #include "cache_inode_weakref.h" 00053 00054 #include <unistd.h> 00055 #include <sys/types.h> 00056 #include <sys/param.h> 00057 #include <time.h> 00058 #include <pthread.h> 00059 00073 hash_table_t *cache_inode_init(cache_inode_parameter_t param, 00074 cache_inode_status_t *status) 00075 { 00076 hash_table_t *ht = NULL; 00077 00078 cache_inode_entry_pool = pool_init("Entry Pool", 00079 sizeof(cache_entry_t), 00080 pool_basic_substrate, 00081 NULL, NULL, NULL); 00082 if(!(cache_inode_entry_pool)) 00083 { 00084 LogCrit(COMPONENT_CACHE_INODE, 00085 "Can't init Entry Pool"); 00086 *status = CACHE_INODE_INVALID_ARGUMENT; 00087 return NULL; 00088 } 00089 cache_inode_symlink_pool = pool_init("Symlink Pool", 00090 sizeof(cache_inode_symlink_t), 00091 pool_basic_substrate, 00092 NULL, NULL, NULL); 00093 if(!(cache_inode_symlink_pool)) 00094 { 00095 LogCrit(COMPONENT_CACHE_INODE, 00096 "Can't init Symlink Pool"); 00097 *status = CACHE_INODE_INVALID_ARGUMENT; 00098 return NULL; 00099 } 00100 00101 cache_inode_dir_entry_pool = pool_init("Directory entry pool", 00102 sizeof(cache_inode_dir_entry_t), 00103 pool_basic_substrate, 00104 NULL, NULL, NULL); 00105 if(!(cache_inode_dir_entry_pool)) 00106 { 00107 LogCrit(COMPONENT_CACHE_INODE, 00108 "Can't init Dir Entry Pool"); 00109 *status = CACHE_INODE_INVALID_ARGUMENT; 00110 return NULL; 00111 } 00112 00113 00114 00115 ht = HashTable_Init(¶m.hparam); 00116 00117 if(ht != NULL) 00118 *status = CACHE_INODE_SUCCESS; 00119 else 00120 *status = CACHE_INODE_INVALID_ARGUMENT; 00121 LogInfo(COMPONENT_CACHE_INODE, "Hash Table initiated"); 00122 00123 cache_inode_weakref_init(); 00124 00125 return ht; 00126 } /* cache_inode_init */