comparison src/core/ngx_file.h @ 0:f0b350454894 NGINX_0_1_0

nginx 0.1.0 *) The first public version.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Oct 2004 00:00:00 +0400
parents
children 80ba094c6b3e
comparison
equal deleted inserted replaced
-1:000000000000 0:f0b350454894
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 typedef struct ngx_path_s ngx_path_t;
15
16 #include <ngx_garbage_collector.h>
17
18
19 struct ngx_file_s {
20 ngx_fd_t fd;
21 ngx_str_t name;
22 ngx_file_info_t info;
23
24 off_t offset;
25 off_t sys_offset;
26
27 ngx_log_t *log;
28
29 unsigned info_valid:1;
30 };
31
32 #define NGX_MAX_PATH_LEVEL 3
33
34 struct ngx_path_s {
35 ngx_str_t name;
36 u_int len;
37 u_int level[3];
38 ngx_gc_handler_pt gc_handler;
39 };
40
41
42 typedef struct {
43 ngx_file_t file;
44 off_t offset;
45 ngx_path_t *path;
46 ngx_pool_t *pool;
47 char *warn;
48
49 unsigned persistent:1;
50 } ngx_temp_file_t;
51
52
53 int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain);
54 int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
55 ngx_pool_t *pool, int persistent);
56 void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path);
57 int ngx_create_path(ngx_file_t *file, ngx_path_t *path);
58
59 void ngx_init_temp_number();
60 ngx_uint_t ngx_next_temp_number(ngx_uint_t collision);
61
62 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
63
64
65 #define ngx_conf_merge_path_value(conf, prev, path, l1, l2, l3, pool) \
66 if (conf == NULL) { \
67 if (prev == NULL) { \
68 ngx_test_null(conf, ngx_palloc(pool, sizeof(ngx_path_t)), NULL); \
69 conf->name.len = sizeof(path) - 1; \
70 conf->name.data = (u_char *) path; \
71 conf->level[0] = l1; \
72 conf->level[1] = l2; \
73 conf->level[2] = l3; \
74 conf->len = l1 + l2 + l3 + (l1 ? 1:0) + (l2 ? 1:0) + (l3 ? 1:0); \
75 } else { \
76 conf = prev; \
77 } \
78 }
79
80
81
82 #endif /* _NGX_FILE_H_INCLUDED_ */