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 "LRU_List.h" 00046 #include "log.h" 00047 #include "HashData.h" 00048 #include "HashTable.h" 00049 #include "fsal.h" 00050 #include "cache_inode.h" 00051 00052 #include <unistd.h> 00053 #include <sys/types.h> 00054 #include <sys/param.h> 00055 #include <time.h> 00056 #include <pthread.h> 00057 #include <assert.h> 00058 00072 cache_entry_t *cache_inode_make_root(cache_inode_fsal_data_t *fsdata, 00073 fsal_op_context_t *context, 00074 cache_inode_status_t *status) 00075 { 00076 cache_entry_t *entry = NULL; 00077 fsal_attrib_list_t attr; 00078 /* sanity check */ 00079 if(status == NULL) 00080 return NULL; 00081 00082 /* Set the return default to CACHE_INODE_SUCCESS */ 00083 *status = CACHE_INODE_SUCCESS; 00084 00085 if((entry = cache_inode_get(fsdata, 00086 &attr, 00087 context, 00088 NULL, 00089 status)) != NULL) 00090 { 00091 /* The root directory is its own parent. (Even though this is a 00092 weakref, it shouldn't be broken in practice.) */ 00093 pthread_rwlock_wrlock(&entry->content_lock); 00094 entry->object.dir.parent = entry->weakref; 00095 entry->object.dir.root = TRUE; 00096 pthread_rwlock_unlock(&entry->content_lock); 00097 } 00098 00099 return entry; 00100 } /* cache_inode_make_root */