diff options
Diffstat (limited to 'src/core/ngx_file.h')
-rw-r--r-- | src/core/ngx_file.h | 119 |
1 files changed, 48 insertions, 71 deletions
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h index 344da0957..7890c48cc 100644 --- a/src/core/ngx_file.h +++ b/src/core/ngx_file.h @@ -11,65 +11,73 @@ #include <ngx_config.h> #include <ngx_core.h> -typedef struct ngx_path_s ngx_path_t; - -#include <ngx_garbage_collector.h> - struct ngx_file_s { - ngx_fd_t fd; - ngx_str_t name; - ngx_file_info_t info; + ngx_fd_t fd; + ngx_str_t name; + ngx_file_info_t info; - off_t offset; - off_t sys_offset; + off_t offset; + off_t sys_offset; - ngx_log_t *log; + ngx_log_t *log; - unsigned valid_info:1; - unsigned directio:1; + unsigned valid_info:1; + unsigned directio:1; }; #define NGX_MAX_PATH_LEVEL 3 -struct ngx_path_s { - ngx_str_t name; - size_t len; - size_t level[3]; - ngx_gc_handler_pt cleaner; - u_char *conf_file; - ngx_uint_t line; -}; +typedef time_t (*ngx_path_cleaner_pt) (void *data); + + +typedef struct { + ngx_str_t name; + size_t len; + size_t level[3]; + + ngx_path_cleaner_pt cleaner; + void *data; + + u_char *conf_file; + ngx_uint_t line; +} ngx_path_t; typedef struct { - ngx_file_t file; - off_t offset; - ngx_path_t *path; - ngx_pool_t *pool; - char *warn; + ngx_str_t name; + size_t level[3]; +} ngx_path_init_t; - ngx_uint_t access; - unsigned log_level:8; - unsigned persistent:1; - unsigned clean:1; +typedef struct { + ngx_file_t file; + off_t offset; + ngx_path_t *path; + ngx_pool_t *pool; + char *warn; + + ngx_uint_t access; + + unsigned log_level:8; + unsigned persistent:1; + unsigned clean:1; } ngx_temp_file_t; typedef struct { - ngx_uint_t access; - ngx_uint_t path_access; - time_t time; - ngx_fd_t fd; - ngx_err_t rename_error; + ngx_uint_t access; + ngx_uint_t path_access; + time_t time; + ngx_fd_t fd; + ngx_err_t rename_error; - unsigned create_path:1; - unsigned delete_file:1; - unsigned log_rename_error:1; + unsigned create_path:1; + unsigned delete_file:1; + unsigned log_rename_error:1; - ngx_log_t *log; + ngx_log_t *log; } ngx_ext_rename_file_t; @@ -113,40 +121,9 @@ void ngx_init_temp_number(void); ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision); char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char *ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, + ngx_path_t *prev, ngx_path_init_t *init); char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -#define ngx_conf_merge_path_value(curr, prev, path, l1, l2, l3, clean, cf) \ - if (curr == NULL) { \ - if (prev == NULL) { \ - curr = ngx_palloc(cf->pool, sizeof(ngx_path_t)); \ - if (curr == NULL) { \ - return NGX_CONF_ERROR; \ - } \ - \ - curr->name.len = sizeof(path) - 1; \ - curr->name.data = (u_char *) path; \ - \ - if (ngx_conf_full_name(cf->cycle, &curr->name, 0) == NGX_ERROR) { \ - return NGX_CONF_ERROR; \ - } \ - \ - curr->level[0] = l1; \ - curr->level[1] = l2; \ - curr->level[2] = l3; \ - curr->len = l1 + l2 + l3 + (l1 ? 1:0) + (l2 ? 1:0) + (l3 ? 1:0); \ - curr->cleaner = clean; \ - curr->conf_file = NULL; \ - \ - if (ngx_add_path(cf, &curr) == NGX_ERROR) { \ - return NGX_CONF_ERROR; \ - } \ - \ - } else { \ - curr = prev; \ - } \ - } - - - #endif /* _NGX_FILE_H_INCLUDED_ */ |