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

Linux Cross Reference
Nginx/core/ngx_open_file_cache.h

Version: ~ [ nginx-0.6.26 ] ~ [ nginx-0.5.35 ] ~ [ nginx-0.5.20 ] ~ [ nginx-0.5.19 ] ~

  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 typedef struct {
 16     ngx_fd_t                 fd;
 17     ngx_file_uniq_t          uniq;
 18     time_t                   mtime;
 19     off_t                    size;
 20     ngx_err_t                err;
 21 
 22     time_t                   valid;
 23 
 24     ngx_uint_t               min_uses;
 25 
 26     unsigned                 test_dir:1;
 27     unsigned                 errors:1;
 28     unsigned                 events:1;
 29 
 30     unsigned                 is_dir:1;
 31     unsigned                 is_file:1;
 32     unsigned                 is_link:1;
 33     unsigned                 is_exec:1;
 34 } ngx_open_file_info_t;
 35 
 36 
 37 typedef struct ngx_cached_open_file_s  ngx_cached_open_file_t;
 38 
 39 struct ngx_cached_open_file_s {
 40     ngx_rbtree_node_t        node;
 41     ngx_queue_t              queue;
 42 
 43     u_char                  *name;
 44     time_t                   created;
 45     time_t                   accessed;
 46 
 47     ngx_fd_t                 fd;
 48     ngx_file_uniq_t          uniq;
 49     time_t                   mtime;
 50     off_t                    size;
 51     ngx_err_t                err;
 52 
 53     uint32_t                 uses;
 54 
 55     unsigned                 count:24;
 56     unsigned                 close:1;
 57     unsigned                 use_event:1;
 58 
 59     unsigned                 is_dir:1;
 60     unsigned                 is_file:1;
 61     unsigned                 is_link:1;
 62     unsigned                 is_exec:1;
 63 
 64     ngx_event_t             *event;
 65 };
 66 
 67 
 68 typedef struct {
 69     ngx_rbtree_t             rbtree;
 70     ngx_rbtree_node_t        sentinel;
 71     ngx_queue_t              expire_queue;
 72 
 73     ngx_uint_t               current;
 74     ngx_uint_t               max;
 75     time_t                   inactive;
 76 } ngx_open_file_cache_t;
 77 
 78 
 79 typedef struct {
 80     ngx_open_file_cache_t   *cache;
 81     ngx_cached_open_file_t  *file;
 82     ngx_uint_t               min_uses;
 83     ngx_log_t               *log;
 84 } ngx_open_file_cache_cleanup_t;
 85 
 86 
 87 typedef struct {
 88 
 89     /* ngx_connection_t stub to allow use c->fd as event ident */
 90     void                    *data;
 91     ngx_event_t             *read;
 92     ngx_event_t             *write;
 93     ngx_fd_t                 fd;
 94 
 95     ngx_cached_open_file_t  *file;
 96     ngx_open_file_cache_t   *cache;
 97 } ngx_open_file_cache_event_t;
 98 
 99 
100 ngx_open_file_cache_t *ngx_open_file_cache_init(ngx_pool_t *pool,
101     ngx_uint_t max, time_t inactive);
102 ngx_int_t ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
103     ngx_open_file_info_t *of, ngx_pool_t *pool);
104 
105 
106 #endif /* _NGX_OPEN_FILE_CACHE_H_INCLUDED_ */
107 

~ [ 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.