0
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
|
4 */
|
|
5
|
|
6
|
|
7 #ifndef _NGX_FILE_H_INCLUDED_
|
|
8 #define _NGX_FILE_H_INCLUDED_
|
|
9
|
|
10
|
|
11 #include <ngx_config.h>
|
|
12 #include <ngx_core.h>
|
|
13
|
|
14
|
|
15 struct ngx_file_s {
|
503
|
16 ngx_fd_t fd;
|
|
17 ngx_str_t name;
|
|
18 ngx_file_info_t info;
|
0
|
19
|
503
|
20 off_t offset;
|
|
21 off_t sys_offset;
|
0
|
22
|
503
|
23 ngx_log_t *log;
|
0
|
24
|
503
|
25 unsigned valid_info:1;
|
|
26 unsigned directio:1;
|
0
|
27 };
|
|
28
|
|
29 #define NGX_MAX_PATH_LEVEL 3
|
|
30
|
503
|
31
|
507
|
32 typedef time_t (*ngx_path_manager_pt) (void *data);
|
503
|
33
|
16
|
34
|
503
|
35 typedef struct {
|
|
36 ngx_str_t name;
|
|
37 size_t len;
|
|
38 size_t level[3];
|
|
39
|
507
|
40 ngx_path_manager_pt manager;
|
503
|
41 void *data;
|
|
42
|
|
43 u_char *conf_file;
|
|
44 ngx_uint_t line;
|
|
45 } ngx_path_t;
|
0
|
46
|
|
47
|
|
48 typedef struct {
|
503
|
49 ngx_str_t name;
|
|
50 size_t level[3];
|
|
51 } ngx_path_init_t;
|
|
52
|
0
|
53
|
503
|
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;
|
182
|
60
|
503
|
61 ngx_uint_t access;
|
|
62
|
|
63 unsigned log_level:8;
|
|
64 unsigned persistent:1;
|
|
65 unsigned clean:1;
|
0
|
66 } ngx_temp_file_t;
|
|
67
|
|
68
|
362
|
69 typedef struct {
|
503
|
70 ngx_uint_t access;
|
|
71 ngx_uint_t path_access;
|
|
72 time_t time;
|
|
73 ngx_fd_t fd;
|
|
74 ngx_err_t rename_error;
|
362
|
75
|
503
|
76 unsigned create_path:1;
|
|
77 unsigned delete_file:1;
|
|
78 unsigned log_rename_error:1;
|
362
|
79
|
503
|
80 ngx_log_t *log;
|
362
|
81 } ngx_ext_rename_file_t;
|
|
82
|
|
83
|
272
|
84 typedef struct ngx_tree_ctx_s ngx_tree_ctx_t;
|
|
85
|
276
|
86 typedef ngx_int_t (*ngx_tree_init_handler_pt) (void *ctx, void *prev);
|
272
|
87 typedef ngx_int_t (*ngx_tree_handler_pt) (ngx_tree_ctx_t *ctx, ngx_str_t *name);
|
|
88
|
|
89 struct ngx_tree_ctx_s {
|
276
|
90 off_t size;
|
|
91 ngx_uint_t access;
|
|
92 time_t mtime;
|
|
93
|
272
|
94 ngx_tree_init_handler_pt init_handler;
|
|
95 ngx_tree_handler_pt file_handler;
|
|
96 ngx_tree_handler_pt pre_tree_handler;
|
|
97 ngx_tree_handler_pt post_tree_handler;
|
|
98 ngx_tree_handler_pt spec_handler;
|
276
|
99
|
272
|
100 void *data;
|
276
|
101 size_t alloc;
|
|
102
|
272
|
103 ngx_log_t *log;
|
|
104 };
|
|
105
|
|
106
|
16
|
107 ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain);
|
|
108 ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
|
278
|
109 ngx_pool_t *pool, ngx_uint_t persistent, ngx_uint_t clean,
|
|
110 ngx_uint_t access);
|
356
|
111 void ngx_create_hashed_filename(ngx_path_t *path, u_char *file, size_t len);
|
16
|
112 ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path);
|
218
|
113 ngx_err_t ngx_create_full_path(u_char *dir, ngx_uint_t access);
|
28
|
114 ngx_int_t ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot);
|
16
|
115 ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user);
|
362
|
116 ngx_int_t ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to,
|
|
117 ngx_ext_rename_file_t *ext);
|
272
|
118 ngx_int_t ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree);
|
0
|
119
|
48
|
120 void ngx_init_temp_number(void);
|
44
|
121 ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision);
|
0
|
122
|
|
123 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
503
|
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);
|
318
|
126 char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
0
|
127
|
|
128
|
|
129 #endif /* _NGX_FILE_H_INCLUDED_ */
|