diff 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
line wrap: on
line diff
--- 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;
+
+typedef time_t (*ngx_path_cleaner_pt) (void *data);
+
 
-    u_char             *conf_file;
-    ngx_uint_t          line;
-};
+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;
+typedef struct {
+    ngx_file_t                 file;
+    off_t                      offset;
+    ngx_path_t                *path;
+    ngx_pool_t                *pool;
+    char                      *warn;
 
-    unsigned            log_level:8;
-    unsigned            persistent:1;
-    unsigned            clean:1;
+    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_ */