~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Nginx/core/ngx_open_file_cache.h

Version: ~ [ nginx-0.8.20 ] ~ [ nginx-0.7.62 ] ~ [ nginx-0.6.39 ] ~

  1 
  2 /*
  3  * Copyright (C) Igor Sysoev
  4  */
  5 
  6 
  7 #include <ngx_config.h>
  8 #include <ngx_core.h>
  9 
 10 
 11 #ifndef _NGX_OPEN_FILE_CACHE_H_INCLUDED_
 12 #define _NGX_OPEN_FILE_CACHE_H_INCLUDED_
 13 
 14 
 15 #define NGX_OPEN_FILE_DIRECTIO_OFF  NGX_MAX_OFF_T_VALUE
 16 
 17 
 18 typedef struct {
 19     ngx_fd_t                 fd;
 20     ngx_file_uniq_t          uniq;
 21     time_t                   mtime;
 22     off_t                    size;
 23     off_t                    directio;
 24     size_t                   read_ahead;
 25 
 26     ngx_err_t                err;
 27     char                    *failed;
 28 
 29     time_t                   valid;
 30 
 31     ngx_uint_t               min_uses;
 32 
 33     unsigned                 test_dir:1;
 34     unsigned                 test_only:1;
 35     unsigned                 log:1;
 36     unsigned                 errors:1;
 37     unsigned                 events:1;
 38 
 39     unsigned                 is_dir:1;
 40     unsigned                 is_file:1;
 41     unsigned                 is_link:1;
 42     unsigned                 is_exec:1;
 43     unsigned                 is_directio:1;
 44 } ngx_open_file_info_t;
 45 
 46 
 47 typedef struct ngx_cached_open_file_s  ngx_cached_open_file_t;
 48 
 49 struct ngx_cached_open_file_s {
 50     ngx_rbtree_node_t        node;
 51     ngx_queue_t              queue;
 52 
 53     u_char                  *name;
 54     time_t                   created;
 55     time_t                   accessed;
 56 
 57     ngx_fd_t                 fd;
 58     ngx_file_uniq_t          uniq;
 59     time_t                   mtime;
 60     off_t                    size;
 61     ngx_err_t                err;
 62 
 63     uint32_t                 uses;
 64 
 65     unsigned                 count:24;
 66     unsigned                 close:1;
 67     unsigned                 use_event:1;
 68 
 69     unsigned                 is_dir:1;
 70     unsigned                 is_file:1;
 71     unsigned                 is_link:1;
 72     unsigned                 is_exec:1;
 73     unsigned                 is_directio:1;
 74 
 75     ngx_event_t             *event;
 76 };
 77 
 78 
 79 typedef struct {
 80     ngx_rbtree_t             rbtree;
 81     ngx_rbtree_node_t        sentinel;
 82     ngx_queue_t              expire_queue;
 83 
 84     ngx_uint_t               current;
 85     ngx_uint_t               max;
 86     time_t                   inactive;
 87 } ngx_open_file_cache_t;
 88 
 89 
 90 typedef struct {
 91     ngx_open_file_cache_t   *cache;
 92     ngx_cached_open_file_t  *file;
 93     ngx_uint_t               min_uses;
 94     ngx_log_t               *log;
 95 } ngx_open_file_cache_cleanup_t;
 96 
 97 
 98 typedef struct {
 99 
100     /* ngx_connection_t stub to allow use c->fd as event ident */
101     void                    *data;
102     ngx_event_t             *read;
103     ngx_event_t             *write;
104     ngx_fd_t                 fd;
105 
106     ngx_cached_open_file_t  *file;
107     ngx_open_file_cache_t   *cache;
108 } ngx_open_file_cache_event_t;
109 
110 
111 ngx_open_file_cache_t *ngx_open_file_cache_init(ngx_pool_t *pool,
112     ngx_uint_t max, time_t inactive);
113 ngx_int_t ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
114     ngx_open_file_info_t *of, ngx_pool_t *pool);
115 
116 
117 #endif /* _NGX_OPEN_FILE_CACHE_H_INCLUDED_ */
118 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.