lighttpd1.4/src/stat_cache.h

70 lines
2.4 KiB
C
Raw Normal View History

#ifndef _FILE_CACHE_H_
#define _FILE_CACHE_H_
#include "first.h"
#include "base_decls.h"
#include "buffer.h"
2019-12-05 08:16:25 +00:00
#include "array.h"
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
typedef struct stat stat_cache_st;
typedef struct stat_cache_entry {
2019-12-05 08:16:25 +00:00
buffer name;
time_t stat_ts;
int fd;
int refcnt;
#if defined(HAVE_FAM_H) || defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_SYS_EVENT_H)
2019-12-05 08:16:25 +00:00
void *fam_dir;
#endif
2019-12-05 08:16:25 +00:00
buffer etag;
buffer content_type;
struct stat st;
} stat_cache_entry;
__attribute_cold__
int stat_cache_choose_engine (const buffer *stat_cache_string, log_error_st *errh);
struct fdevents; /* declaration */
__attribute_cold__
int stat_cache_init(struct fdevents *ev, log_error_st *errh);
__attribute_cold__
2019-12-05 08:16:25 +00:00
void stat_cache_free(void);
void stat_cache_entry_refchg(void *data, int mod);
2019-12-05 08:16:25 +00:00
__attribute_cold__
void stat_cache_xattrname (const char *name);
const buffer * stat_cache_mimetype_by_ext(const array *mimetypes, const char *name, uint32_t nlen);
2019-12-05 08:16:25 +00:00
#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, r) stat_cache_content_type_get_by_xattr((sce), (r)->conf.mimetypes, (r)->conf.use_xattr)
2019-12-05 08:16:25 +00:00
#else
const buffer * stat_cache_content_type_get_by_ext(stat_cache_entry *sce, const array *mimetypes);
#define stat_cache_content_type_get(con, r) stat_cache_content_type_get_by_ext((sce), (r)->conf.mimetypes)
2019-12-05 08:16:25 +00:00
#endif
2019-11-16 01:26:54 +00:00
const buffer * stat_cache_etag_get(stat_cache_entry *sce, int flags);
void stat_cache_update_entry(const char *name, uint32_t len, struct stat *st, buffer *etagb);
void stat_cache_delete_entry(const char *name, uint32_t len);
void stat_cache_delete_dir(const char *name, uint32_t len);
void stat_cache_invalidate_entry(const char *name, uint32_t len);
2019-12-05 08:16:25 +00:00
stat_cache_entry * stat_cache_get_entry(const buffer *name);
stat_cache_entry * stat_cache_get_entry_open(const buffer *name, int symlinks);
const stat_cache_st * stat_cache_path_stat(const buffer *name);
2020-10-09 17:33:48 +00:00
int stat_cache_path_isdir(const buffer *name);
__attribute_cold__
2019-12-05 08:16:25 +00:00
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);
2019-12-05 08:16:25 +00:00
void stat_cache_trigger_cleanup(void);
#endif