Mercurial > hg > nginx-quic
annotate src/core/ngx_file.h @ 2456:d4b69804cffa
bump version
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 19 Jan 2009 16:37:22 +0000 |
parents | dbe746851b31 |
children | 3a8a53c0c42f |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
5 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
6 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #ifndef _NGX_FILE_H_INCLUDED_ |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #define _NGX_FILE_H_INCLUDED_ |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
11 #include <ngx_config.h> |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
12 #include <ngx_core.h> |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
14 typedef struct ngx_path_s ngx_path_t; |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
15 |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
16 #include <ngx_garbage_collector.h> |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
17 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
18 |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 struct ngx_file_s { |
467 | 20 ngx_fd_t fd; |
21 ngx_str_t name; | |
22 ngx_file_info_t info; | |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
23 |
467 | 24 off_t offset; |
25 off_t sys_offset; | |
35
79c1fce18e71
nginx-0.0.1-2002-12-21-20:14:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
26 |
467 | 27 ngx_log_t *log; |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
28 |
2231
8564129d49b6
*) handle unaligned file part for directio
Igor Sysoev <igor@sysoev.ru>
parents:
1909
diff
changeset
|
29 unsigned valid_info:1; |
8564129d49b6
*) handle unaligned file part for directio
Igor Sysoev <igor@sysoev.ru>
parents:
1909
diff
changeset
|
30 unsigned directio:1; |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 }; |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
33 #define NGX_MAX_PATH_LEVEL 3 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
35 struct ngx_path_s { |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
36 ngx_str_t name; |
517 | 37 size_t len; |
38 size_t level[3]; | |
479 | 39 ngx_gc_handler_pt cleaner; |
467 | 40 |
41 u_char *conf_file; | |
42 ngx_uint_t line; | |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
43 }; |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
44 |
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
45 |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
46 typedef struct { |
467 | 47 ngx_file_t file; |
48 off_t offset; | |
49 ngx_path_t *path; | |
50 ngx_pool_t *pool; | |
51 char *warn; | |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
52 |
1046 | 53 ngx_uint_t access; |
633 | 54 |
637 | 55 unsigned log_level:8; |
467 | 56 unsigned persistent:1; |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1058
diff
changeset
|
57 unsigned clean:1; |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
58 } ngx_temp_file_t; |
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
59 |
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
60 |
1827
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
61 typedef struct { |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
62 ngx_uint_t access; |
2394
dbe746851b31
use ngx_ext_rename_file() for single file MOVE
Igor Sysoev <igor@sysoev.ru>
parents:
2231
diff
changeset
|
63 ngx_uint_t path_access; |
1827
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
64 time_t time; |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
65 ngx_fd_t fd; |
2394
dbe746851b31
use ngx_ext_rename_file() for single file MOVE
Igor Sysoev <igor@sysoev.ru>
parents:
2231
diff
changeset
|
66 ngx_err_t rename_error; |
1827
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
67 |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
68 unsigned create_path:1; |
1909 | 69 unsigned delete_file:1; |
2394
dbe746851b31
use ngx_ext_rename_file() for single file MOVE
Igor Sysoev <igor@sysoev.ru>
parents:
2231
diff
changeset
|
70 unsigned log_rename_error:1; |
1827
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
71 |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
72 ngx_log_t *log; |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
73 } ngx_ext_rename_file_t; |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
74 |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
75 |
956 | 76 typedef struct ngx_tree_ctx_s ngx_tree_ctx_t; |
77 | |
1058
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
78 typedef ngx_int_t (*ngx_tree_init_handler_pt) (void *ctx, void *prev); |
956 | 79 typedef ngx_int_t (*ngx_tree_handler_pt) (ngx_tree_ctx_t *ctx, ngx_str_t *name); |
80 | |
81 struct ngx_tree_ctx_s { | |
1058
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
82 off_t size; |
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
83 ngx_uint_t access; |
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
84 time_t mtime; |
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
85 |
956 | 86 ngx_tree_init_handler_pt init_handler; |
87 ngx_tree_handler_pt file_handler; | |
88 ngx_tree_handler_pt pre_tree_handler; | |
89 ngx_tree_handler_pt post_tree_handler; | |
90 ngx_tree_handler_pt spec_handler; | |
1058
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
91 |
956 | 92 void *data; |
1058
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
93 size_t alloc; |
01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
94 |
956 | 95 ngx_log_t *log; |
96 }; | |
97 | |
98 | |
467 | 99 ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain); |
100 ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, | |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1058
diff
changeset
|
101 ngx_pool_t *pool, ngx_uint_t persistent, ngx_uint_t clean, |
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1058
diff
changeset
|
102 ngx_uint_t access); |
1748
91d381e4e691
ngx_create_hashed_filename() does not need ngx_file_t
Igor Sysoev <igor@sysoev.ru>
parents:
1695
diff
changeset
|
103 void ngx_create_hashed_filename(ngx_path_t *path, u_char *file, size_t len); |
467 | 104 ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path); |
669 | 105 ngx_err_t ngx_create_full_path(u_char *dir, ngx_uint_t access); |
479 | 106 ngx_int_t ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot); |
467 | 107 ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user); |
1827
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
108 ngx_int_t ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to, |
cb9d4278b476
add declaration missed in previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
1748
diff
changeset
|
109 ngx_ext_rename_file_t *ext); |
956 | 110 ngx_int_t ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree); |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
111 |
499 | 112 void ngx_init_temp_number(void); |
495 | 113 ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision); |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
114 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
115 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
116 char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
117 |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
118 |
479 | 119 #define ngx_conf_merge_path_value(curr, prev, path, l1, l2, l3, clean, cf) \ |
120 if (curr == NULL) { \ | |
121 if (prev == NULL) { \ | |
501 | 122 curr = ngx_palloc(cf->pool, sizeof(ngx_path_t)); \ |
123 if (curr == NULL) { \ | |
479 | 124 return NGX_CONF_ERROR; \ |
125 } \ | |
126 \ | |
127 curr->name.len = sizeof(path) - 1; \ | |
128 curr->name.data = (u_char *) path; \ | |
129 \ | |
1352 | 130 if (ngx_conf_full_name(cf->cycle, &curr->name, 0) == NGX_ERROR) { \ |
479 | 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 } \ | |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
148 } |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
149 |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
150 |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
151 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
152 #endif /* _NGX_FILE_H_INCLUDED_ */ |