Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 105 lines (84 sloc) 3.164 kB
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /* Cherokee
4 *
5 * Authors:
6 * Alvaro Lopez Ortega <alvaro@alobbs.com>
7 *
920e20b @alobbs Happy new year!
alobbs authored
8 * Copyright (C) 2001-2011 Alvaro Lopez Ortega
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
2c39092 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2660 5dc97367-9…
alobbs authored
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301, USA.
72f6444 @alobbs Clean up: Trims trailing spaces.
alobbs authored
23 */
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
24
dfd9ca5 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2237 5dc97367-9…
alobbs authored
25 #if !defined (CHEROKEE_INSIDE_CHEROKEE_H) && !defined (CHEROKEE_COMPILATION)
26 # error "Only <cherokee/cherokee.h> can be included directly, this file may disappear or change contents."
27 #endif
28
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
29 #ifndef CHEROKEE_IOCACHE_H
30 #define CHEROKEE_IOCACHE_H
31
32 #include <cherokee/common.h>
33 #include <cherokee/server.h>
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
34 #include <cherokee/cache.h>
d8bf318 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2188 5dc97367-9…
alobbs authored
35 #include <cherokee/config_node.h>
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
36
37 #include <sys/types.h>
38 #include <sys/stat.h>
39 #include <unistd.h>
40
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
41 typedef struct {
0e1abd9 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2116 5dc97367-9…
alobbs authored
42 cherokee_cache_t cache;
d8bf318 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2188 5dc97367-9…
alobbs authored
43
44 /* Limits */
45 cuint_t max_file_size;
46 cuint_t min_file_size;
47 cuint_t lasting_mmap;
48 cuint_t lasting_stat;
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
49 } cherokee_iocache_t;
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
50
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
51 typedef enum {
52 iocache_nothing = 0,
53 iocache_stat = 1,
54 iocache_mmap = 1 << 1
55 } cherokee_iocache_info_t;
56
0e1abd9 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2116 5dc97367-9…
alobbs authored
57 typedef struct {
58 /* Inheritance */
59 cherokee_cache_entry_t base;
60 cherokee_iocache_info_t info;
61
62 /* Information to cache */
63 struct stat state;
33c9d33 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2661 5dc97367-9…
alobbs authored
64 ret_t state_ret;
0e1abd9 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2116 5dc97367-9…
alobbs authored
65 void *mmaped;
66 size_t mmaped_len;
67 } cherokee_iocache_entry_t;
68
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
69 #define IOCACHE(x) ((cherokee_iocache_t *)(x))
70 #define IOCACHE_ENTRY(x) ((cherokee_iocache_entry_t *)(x))
71
0e1abd9 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2116 5dc97367-9…
alobbs authored
72
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
73 /* I/O cache
74 */
a957ffd @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2119 5dc97367-9…
alobbs authored
75 ret_t cherokee_iocache_new (cherokee_iocache_t **iocache);
76 ret_t cherokee_iocache_free (cherokee_iocache_t *iocache);
77
12f1ecb @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2107 5dc97367-9…
alobbs authored
78 ret_t cherokee_iocache_init (cherokee_iocache_t *iocache);
79 ret_t cherokee_iocache_mrproper (cherokee_iocache_t *iocache);
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
80
d8bf318 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2188 5dc97367-9…
alobbs authored
81 ret_t cherokee_iocache_configure (cherokee_iocache_t *iocache,
82 cherokee_config_node_t *conf);
83
9a294ab @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1673 5dc97367-9…
alobbs authored
84 /* I/O cache entry
85 */
86 ret_t cherokee_iocache_entry_unref (cherokee_iocache_entry_t **entry);
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
87
33c9d33 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2661 5dc97367-9…
alobbs authored
88 /* Autoget: Get or Update
89 */
90 ret_t cherokee_iocache_autoget (cherokee_iocache_t *iocache,
91 cherokee_buffer_t *file,
92 cherokee_iocache_info_t info,
93 cherokee_iocache_entry_t **ret_io);
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
94
33c9d33 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2661 5dc97367-9…
alobbs authored
95 ret_t cherokee_iocache_autoget_fd (cherokee_iocache_t *iocache,
96 cherokee_buffer_t *file,
97 cherokee_iocache_info_t info,
72f6444 @alobbs Clean up: Trims trailing spaces.
alobbs authored
98 int *fd,
33c9d33 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2661 5dc97367-9…
alobbs authored
99 cherokee_iocache_entry_t **ret_io);
9db754d @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@771 5dc97367-97…
alobbs authored
100
a957ffd @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2119 5dc97367-9…
alobbs authored
101 /* Misc */
33c9d33 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2661 5dc97367-9…
alobbs authored
102 ret_t cherokee_iocache_get_mmaped_size (cherokee_iocache_t *iocache, size_t *total);
a957ffd @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2119 5dc97367-9…
alobbs authored
103
ae9d971 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@243 5dc97367-97…
alobbs authored
104 #endif /* CHEROKEE_IOCACHE_H */
Something went wrong with that request. Please try again.