Mercurial > hg > nginx
annotate src/core/ngx_open_file_cache.h @ 2749:ccaf43725ff6
change ngx_log_create_errlog() interface
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 24 Apr 2009 14:27:36 +0000 |
parents | 732bf367dc08 |
children | 09cab3f8d92e |
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 | |
2277 | 15 #define NGX_OPEN_FILE_DIRECTIO_OFF NGX_MAX_OFF_T_VALUE |
16 | |
17 | |
1453 | 18 typedef struct { |
19 ngx_fd_t fd; | |
20 ngx_file_uniq_t uniq; | |
21 time_t mtime; | |
22 off_t size; | |
2129 | 23 off_t directio; |
1453 | 24 ngx_err_t err; |
25 | |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1765
diff
changeset
|
26 time_t valid; |
1453 | 27 |
1772 | 28 ngx_uint_t min_uses; |
29 | |
1453 | 30 unsigned test_dir:1; |
2072 | 31 unsigned log:1; |
1453 | 32 unsigned errors:1; |
1457 | 33 unsigned events:1; |
1453 | 34 |
35 unsigned is_dir:1; | |
36 unsigned is_file:1; | |
37 unsigned is_link:1; | |
38 unsigned is_exec:1; | |
2231
8564129d49b6
*) handle unaligned file part for directio
Igor Sysoev <igor@sysoev.ru>
parents:
2129
diff
changeset
|
39 unsigned is_directio:1; |
1453 | 40 } ngx_open_file_info_t; |
41 | |
42 | |
43 typedef struct ngx_cached_open_file_s ngx_cached_open_file_t; | |
44 | |
45 struct ngx_cached_open_file_s { | |
46 ngx_rbtree_node_t node; | |
1765 | 47 ngx_queue_t queue; |
1453 | 48 |
49 u_char *name; | |
50 time_t created; | |
51 time_t accessed; | |
52 | |
53 ngx_fd_t fd; | |
54 ngx_file_uniq_t uniq; | |
55 time_t mtime; | |
56 off_t size; | |
57 ngx_err_t err; | |
58 | |
1772 | 59 uint32_t uses; |
60 | |
1453 | 61 unsigned count:24; |
62 unsigned close:1; | |
1775 | 63 unsigned use_event:1; |
1453 | 64 |
65 unsigned is_dir:1; | |
66 unsigned is_file:1; | |
67 unsigned is_link:1; | |
68 unsigned is_exec:1; | |
2246
987831d73bd8
cache directio flag in open file cache
Igor Sysoev <igor@sysoev.ru>
parents:
2231
diff
changeset
|
69 unsigned is_directio:1; |
1453 | 70 |
71 ngx_event_t *event; | |
72 }; | |
73 | |
74 | |
75 typedef struct { | |
76 ngx_rbtree_t rbtree; | |
1761 | 77 ngx_rbtree_node_t sentinel; |
1765 | 78 ngx_queue_t expire_queue; |
1453 | 79 |
80 ngx_uint_t current; | |
81 ngx_uint_t max; | |
82 time_t inactive; | |
83 } ngx_open_file_cache_t; | |
84 | |
85 | |
86 typedef struct { | |
87 ngx_open_file_cache_t *cache; | |
88 ngx_cached_open_file_t *file; | |
1772 | 89 ngx_uint_t min_uses; |
1453 | 90 ngx_log_t *log; |
91 } ngx_open_file_cache_cleanup_t; | |
92 | |
93 | |
94 typedef struct { | |
95 | |
96 /* ngx_connection_t stub to allow use c->fd as event ident */ | |
97 void *data; | |
98 ngx_event_t *read; | |
99 ngx_event_t *write; | |
100 ngx_fd_t fd; | |
101 | |
102 ngx_cached_open_file_t *file; | |
103 ngx_open_file_cache_t *cache; | |
104 } ngx_open_file_cache_event_t; | |
105 | |
106 | |
107 ngx_open_file_cache_t *ngx_open_file_cache_init(ngx_pool_t *pool, | |
108 ngx_uint_t max, time_t inactive); | |
109 ngx_int_t ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name, | |
110 ngx_open_file_info_t *of, ngx_pool_t *pool); | |
111 | |
112 | |
113 #endif /* _NGX_OPEN_FILE_CACHE_H_INCLUDED_ */ |