nfs-ganesha 1.4

cache_content_cache_behaviour.c

Go to the documentation of this file.
00001 /*
00002  * vim:expandtab:shiftwidth=8:tabstop=8:
00003  */
00004 
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020 
00021 #ifdef _SOLARIS
00022 #include "solaris_port.h"
00023 #endif
00024 
00025 #include "LRU_List.h"
00026 #include "log.h"
00027 #include "HashData.h"
00028 #include "HashTable.h"
00029 #include "fsal.h"
00030 #include "cache_inode.h"
00031 #include "cache_content.h"
00032 #include "cache_content_policy.h"
00033 
00034 #include <unistd.h>
00035 #include <sys/types.h>
00036 #include <sys/param.h>
00037 #include <time.h>
00038 #include <pthread.h>
00039 #include <errno.h>
00040 
00058 cache_content_caching_type_t cache_content_cache_behaviour(cache_entry_t * pentry_inode,
00059                                                            cache_content_policy_data_t *
00060                                                            ppolicy_data,
00061                                                            cache_content_client_t *
00062                                                            pclient,
00063                                                            cache_content_status_t *
00064                                                            pstatus)
00065 {
00066   *pstatus = CACHE_CONTENT_FULLY_CACHED;
00067 
00068   if(pentry_inode->type != REGULAR_FILE)
00069     {
00070       *pstatus = CACHE_CONTENT_INVALID_ARGUMENT;
00071       return *pstatus;
00072     }
00073 
00074   if(ppolicy_data->UseMaxCacheSize)
00075     {
00076       if(pentry_inode->attributes.filesize > ppolicy_data->MaxCacheSize)
00077         *pstatus = CACHE_CONTENT_TOO_LARGE_FOR_CACHE;
00078     }
00079 
00080   return *pstatus;
00081 }                               /* cache_content_cache_behaviour */