comparison src/core/ngx_hunk.h @ 0:4eff17414a43

nginx-0.0.1-2002-08-06-20:39:45 import The first code that uses "ngx_" prefix, the previous one used "gx_" prefix. At that point the code is not yet usable. The first draft ideas are dated back to 23.10.2001.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 06 Aug 2002 16:39:45 +0000
parents
children d220029ac7f3
comparison
equal deleted inserted replaced
-1:000000000000 0:4eff17414a43
1 #ifndef _NGX_CHUNK_H_INCLUDED_
2 #define _NGX_CHUNK_H_INCLUDED_
3
4
5 #include <ngx_config.h>
6 #include <ngx_types.h>
7 #include <ngx_alloc.h>
8
9
10 /* type */
11 #define NGX_HUNK_TEMP 0x0001
12 #define NGX_HUNK_MEMORY 0x0002
13 #define NGX_HUNK_MMAP 0x0004
14 #define NGX_HUNK_FILE 0x0008
15 #define NGX_HUNK_FLUSH 0x0010
16 /* in thread state flush means to write the hunk completely before return
17 in event-driven state flush means to start to write the hunk */
18 #define NGX_HUNK_LAST 0x0020
19
20 #define NGX_HUNK_IN_MEMORY (NGX_HUNK_TEMP | NGX_HUNK_MEMORY | NGX_HUNK_MMAP )
21 #define NGX_HUNK_TYPE 0x0ffff
22
23 /* flags */
24 #define NGX_HUNK_SHUTDOWN 0x10000
25 /* can be used with NGX_HUNK_LAST only */
26
27
28 typedef struct ngx_hunk_s ngx_hunk_t;
29 struct ngx_hunk_s {
30 union {
31 char *p; /* start of current data */
32 off_t f;
33 } pos;
34 union {
35 char *p; /* end of current data */
36 off_t f;
37 } last;
38 int type;
39 char *start; /* start of hunk */
40 char *end; /* end of hunk */
41 char *pre_start; /* start of pre-allocated hunk */
42 char *post_end; /* end of post-allocated hunk */
43 int tag;
44 ngx_file_t fd;
45 };
46
47 typedef struct ngx_chain_s ngx_chain_t;
48 struct ngx_chain_s {
49 ngx_hunk_t *hunk;
50 ngx_chain_t *next;
51 };
52
53
54 ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after);
55
56
57 #endif /* _NGX_CHUNK_H_INCLUDED_ */