diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2019-12-05 03:16:25 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-07-08 19:54:28 -0400 |
commit | 68d8d4c532c51cdc5ac4959e002c0ba5cf34a2c1 (patch) | |
tree | 624ed9d55263abcbe8aa6c55b74a01c11d0424e9 /src/stat_cache.h | |
parent | b5775b995156f91d94185ec58410a4ccfb7560a4 (diff) | |
download | lighttpd-git-68d8d4c532c51cdc5ac4959e002c0ba5cf34a2c1.tar.gz |
[multiple] stat_cache singleton
Diffstat (limited to 'src/stat_cache.h')
-rw-r--r-- | src/stat_cache.h | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/stat_cache.h b/src/stat_cache.h index aad27e7c..46c0bf12 100644 --- a/src/stat_cache.h +++ b/src/stat_cache.h @@ -4,48 +4,53 @@ #include "base_decls.h" #include "buffer.h" +#include "array.h" #include "etag.h" #include <sys/types.h> #include <sys/time.h> #include <sys/stat.h> -struct stat_cache; /* declaration */ - typedef struct { - buffer *name; - buffer *etag; - - struct stat st; - - time_t stat_ts; - + buffer name; + time_t stat_ts; #ifdef HAVE_FAM_H - void *fam_dir; + void *fam_dir; #endif - - buffer *content_type; + buffer etag; + buffer content_type; + struct stat st; } stat_cache_entry; __attribute_cold__ int stat_cache_choose_engine (server *srv, const buffer *stat_cache_string); __attribute_cold__ -struct stat_cache *stat_cache_init(server *srv); +int stat_cache_init(server *srv); __attribute_cold__ -void stat_cache_free(struct stat_cache *fc); +void stat_cache_free(void); -const buffer * stat_cache_mimetype_by_ext(const connection *con, const char *name, size_t nlen); -const buffer * stat_cache_content_type_get(const connection *con, const buffer *name, stat_cache_entry *sce); +__attribute_cold__ +void stat_cache_xattrname (const char *name); + +const buffer * stat_cache_mimetype_by_ext(const array *mimetypes, const char *name, size_t nlen); +#if defined(HAVE_XATTR) || defined(HAVE_EXTATTR) +const buffer * stat_cache_mimetype_by_xattr(const char *name); +const buffer * stat_cache_content_type_get_by_xattr(stat_cache_entry *sce, const array *mimetypes, int use_xattr); +#define stat_cache_content_type_get(con, sce) stat_cache_content_type_get_by_xattr((sce), (con)->conf.mimetypes, (con)->conf.use_xattr) +#else +const buffer * stat_cache_content_type_get_by_ext(stat_cache_entry *sce, const array *mimetypes); +#define stat_cache_content_type_get(con, sce) stat_cache_content_type_get_by_ext((sce), (con)->conf.mimetypes) +#endif const buffer * stat_cache_etag_get(stat_cache_entry *sce, int flags); -void stat_cache_update_entry(server *srv, const char *name, size_t len, struct stat *st, buffer *etagb); -void stat_cache_delete_entry(server *srv, const char *name, size_t len); -void stat_cache_delete_dir(server *srv, const char *name, size_t len); -void stat_cache_invalidate_entry(server *srv, const char *name, size_t len); -handler_t stat_cache_get_entry(connection *con, buffer *name, stat_cache_entry **sce); -int stat_cache_path_contains_symlink(connection *con, const buffer *name); +void stat_cache_update_entry(const char *name, size_t len, struct stat *st, buffer *etagb); +void stat_cache_delete_entry(const char *name, size_t len); +void stat_cache_delete_dir(const char *name, size_t len); +void stat_cache_invalidate_entry(const char *name, size_t len); +stat_cache_entry * stat_cache_get_entry(const buffer *name); +int stat_cache_path_contains_symlink(const buffer *name, log_error_st *errh); int stat_cache_open_rdonly_fstat (const buffer *name, struct stat *st, int symlinks); -int stat_cache_trigger_cleanup(server *srv); +void stat_cache_trigger_cleanup(void); #endif |