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