Mercurial > hg > nginx-quic
annotate src/core/ngx_open_file_cache.h @ 1778:14510c3cc6cb
ssl_session_cache off
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 26 Dec 2007 20:27:22 +0000 |
parents | 108576aef610 |
children | ee2fecdfdef7 |
rev | line source |
---|---|
1453 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
11 #ifndef _NGX_OPEN_FILE_CACHE_H_INCLUDED_ | |
12 #define _NGX_OPEN_FILE_CACHE_H_INCLUDED_ | |
13 | |
14 | |
15 typedef struct { | |
16 ngx_fd_t fd; | |
17 ngx_file_uniq_t uniq; | |
18 time_t mtime; | |
19 off_t size; | |
20 ngx_err_t err; | |
21 | |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1765
diff
changeset
|
22 time_t valid; |
1453 | 23 |
1772 | 24 ngx_uint_t min_uses; |
25 | |
1453 | 26 unsigned test_dir:1; |
27 unsigned errors:1; | |
1457 | 28 unsigned events:1; |
1453 | 29 |
30 unsigned is_dir:1; | |
31 unsigned is_file:1; | |
32 unsigned is_link:1; | |
33 unsigned is_exec:1; | |
34 } ngx_open_file_info_t; | |
35 | |
36 | |
37 typedef struct ngx_cached_open_file_s ngx_cached_open_file_t; | |
38 | |
39 struct ngx_cached_open_file_s { | |
40 ngx_rbtree_node_t node; | |
1765 | 41 ngx_queue_t queue; |
1453 | 42 |
43 u_char *name; | |
44 time_t created; | |
45 time_t accessed; | |
46 | |
47 ngx_fd_t fd; | |
48 ngx_file_uniq_t uniq; | |
49 time_t mtime; | |
50 off_t size; | |
51 ngx_err_t err; | |
52 | |
1772 | 53 uint32_t uses; |
54 | |
1453 | 55 unsigned count:24; |
56 unsigned close:1; | |
1775 | 57 unsigned use_event:1; |
1453 | 58 |
59 unsigned is_dir:1; | |
60 unsigned is_file:1; | |
61 unsigned is_link:1; | |
62 unsigned is_exec:1; | |
63 | |
64 ngx_event_t *event; | |
65 }; | |
66 | |
67 | |
68 typedef struct { | |
69 ngx_rbtree_t rbtree; | |
1761 | 70 ngx_rbtree_node_t sentinel; |
1765 | 71 ngx_queue_t expire_queue; |
1453 | 72 |
73 ngx_uint_t current; | |
74 ngx_uint_t max; | |
75 time_t inactive; | |
76 } ngx_open_file_cache_t; | |
77 | |
78 | |
79 typedef struct { | |
80 ngx_open_file_cache_t *cache; | |
81 ngx_cached_open_file_t *file; | |
1772 | 82 ngx_uint_t min_uses; |
1453 | 83 ngx_log_t *log; |
84 } ngx_open_file_cache_cleanup_t; | |
85 | |
86 | |
87 typedef struct { | |
88 | |
89 /* ngx_connection_t stub to allow use c->fd as event ident */ | |
90 void *data; | |
91 ngx_event_t *read; | |
92 ngx_event_t *write; | |
93 ngx_fd_t fd; | |
94 | |
95 ngx_cached_open_file_t *file; | |
96 ngx_open_file_cache_t *cache; | |
97 } ngx_open_file_cache_event_t; | |
98 | |
99 | |
100 ngx_open_file_cache_t *ngx_open_file_cache_init(ngx_pool_t *pool, | |
101 ngx_uint_t max, time_t inactive); | |
102 ngx_int_t ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name, | |
103 ngx_open_file_info_t *of, ngx_pool_t *pool); | |
104 | |
105 | |
106 #endif /* _NGX_OPEN_FILE_CACHE_H_INCLUDED_ */ |