comparison src/core/ngx_file.h @ 464:c8cfb6c462ef NGINX_0_7_44

nginx 0.7.44 *) Feature: the ngx_http_proxy_module preliminary cache support. *) Feature: the --with-pcre option in the configure. *) Feature: the "try_files" directive is now allowed on the server block level. *) Bugfix: the "try_files" directive handled incorrectly a query string in a fallback parameter. *) Bugfix: the "try_files" directive might test incorrectly directories. *) Bugfix: if there is the single server for given address:port pair, then captures in regular expressions in a "server_name" directive did not work.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Mar 2009 00:00:00 +0300
parents dac47e9ef0d5
children 56baf312c1b5
comparison
equal deleted inserted replaced
463:51cb914e6d3a 464:c8cfb6c462ef
9 9
10 10
11 #include <ngx_config.h> 11 #include <ngx_config.h>
12 #include <ngx_core.h> 12 #include <ngx_core.h>
13 13
14 typedef struct ngx_path_s ngx_path_t;
15
16 #include <ngx_garbage_collector.h>
17
18 14
19 struct ngx_file_s { 15 struct ngx_file_s {
20 ngx_fd_t fd; 16 ngx_fd_t fd;
21 ngx_str_t name; 17 ngx_str_t name;
22 ngx_file_info_t info; 18 ngx_file_info_t info;
23 19
24 off_t offset; 20 off_t offset;
25 off_t sys_offset; 21 off_t sys_offset;
26 22
27 ngx_log_t *log; 23 ngx_log_t *log;
28 24
29 unsigned valid_info:1; 25 unsigned valid_info:1;
30 unsigned directio:1; 26 unsigned directio:1;
31 }; 27 };
32 28
33 #define NGX_MAX_PATH_LEVEL 3 29 #define NGX_MAX_PATH_LEVEL 3
34 30
35 struct ngx_path_s {
36 ngx_str_t name;
37 size_t len;
38 size_t level[3];
39 ngx_gc_handler_pt cleaner;
40 31
41 u_char *conf_file; 32 typedef time_t (*ngx_path_cleaner_pt) (void *data);
42 ngx_uint_t line;
43 };
44 33
45 34
46 typedef struct { 35 typedef struct {
47 ngx_file_t file; 36 ngx_str_t name;
48 off_t offset; 37 size_t len;
49 ngx_path_t *path; 38 size_t level[3];
50 ngx_pool_t *pool;
51 char *warn;
52 39
53 ngx_uint_t access; 40 ngx_path_cleaner_pt cleaner;
41 void *data;
54 42
55 unsigned log_level:8; 43 u_char *conf_file;
56 unsigned persistent:1; 44 ngx_uint_t line;
57 unsigned clean:1; 45 } ngx_path_t;
46
47
48 typedef struct {
49 ngx_str_t name;
50 size_t level[3];
51 } ngx_path_init_t;
52
53
54 typedef struct {
55 ngx_file_t file;
56 off_t offset;
57 ngx_path_t *path;
58 ngx_pool_t *pool;
59 char *warn;
60
61 ngx_uint_t access;
62
63 unsigned log_level:8;
64 unsigned persistent:1;
65 unsigned clean:1;
58 } ngx_temp_file_t; 66 } ngx_temp_file_t;
59 67
60 68
61 typedef struct { 69 typedef struct {
62 ngx_uint_t access; 70 ngx_uint_t access;
63 ngx_uint_t path_access; 71 ngx_uint_t path_access;
64 time_t time; 72 time_t time;
65 ngx_fd_t fd; 73 ngx_fd_t fd;
66 ngx_err_t rename_error; 74 ngx_err_t rename_error;
67 75
68 unsigned create_path:1; 76 unsigned create_path:1;
69 unsigned delete_file:1; 77 unsigned delete_file:1;
70 unsigned log_rename_error:1; 78 unsigned log_rename_error:1;
71 79
72 ngx_log_t *log; 80 ngx_log_t *log;
73 } ngx_ext_rename_file_t; 81 } ngx_ext_rename_file_t;
74 82
75 83
76 typedef struct ngx_tree_ctx_s ngx_tree_ctx_t; 84 typedef struct ngx_tree_ctx_s ngx_tree_ctx_t;
77 85
111 119
112 void ngx_init_temp_number(void); 120 void ngx_init_temp_number(void);
113 ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision); 121 ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision);
114 122
115 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 123 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
124 char *ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path,
125 ngx_path_t *prev, ngx_path_init_t *init);
116 char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 126 char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
117 127
118 128
119 #define ngx_conf_merge_path_value(curr, prev, path, l1, l2, l3, clean, cf) \
120 if (curr == NULL) { \
121 if (prev == NULL) { \
122 curr = ngx_palloc(cf->pool, sizeof(ngx_path_t)); \
123 if (curr == NULL) { \
124 return NGX_CONF_ERROR; \
125 } \
126 \
127 curr->name.len = sizeof(path) - 1; \
128 curr->name.data = (u_char *) path; \
129 \
130 if (ngx_conf_full_name(cf->cycle, &curr->name, 0) == NGX_ERROR) { \
131 return NGX_CONF_ERROR; \
132 } \
133 \
134 curr->level[0] = l1; \
135 curr->level[1] = l2; \
136 curr->level[2] = l3; \
137 curr->len = l1 + l2 + l3 + (l1 ? 1:0) + (l2 ? 1:0) + (l3 ? 1:0); \
138 curr->cleaner = clean; \
139 curr->conf_file = NULL; \
140 \
141 if (ngx_add_path(cf, &curr) == NGX_ERROR) { \
142 return NGX_CONF_ERROR; \
143 } \
144 \
145 } else { \
146 curr = prev; \
147 } \
148 }
149
150
151
152 #endif /* _NGX_FILE_H_INCLUDED_ */ 129 #endif /* _NGX_FILE_H_INCLUDED_ */