Mercurial > hg > nginx-quic
annotate src/core/ngx_hunk.c @ 159:981e4af2a425
nginx-0.0.1-2003-10-24-20:10:38 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 24 Oct 2003 16:10:38 +0000 |
parents | 46eb23d9471d |
children | e7e094d34162 |
rev | line source |
---|---|
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1 |
42
cd035a94e0b6
nginx-0.0.1-2002-12-27-10:27:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
2 #include <ngx_config.h> |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
3 #include <ngx_core.h> |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
4 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
6 ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size, |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
7 int before, int after) |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 { |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
9 ngx_hunk_t *h; |
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
10 |
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
11 ngx_test_null(h, ngx_palloc(pool, sizeof(ngx_hunk_t)), NULL); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
13 ngx_test_null(h->pre_start, ngx_palloc(pool, size + before + after), NULL); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
15 h->start = h->pos = h->last = h->pre_start + before; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
16 h->file_pos = h->file_last = 0; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
17 h->end = h->last + size; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
18 h->post_end = h->end + after; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
20 h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY; |
76
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
21 h->file = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
22 h->shadow = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
23 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
24 h->tag = 0; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 return h; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
27 } |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
76
diff
changeset
|
28 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
29 ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
76
diff
changeset
|
30 { |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
31 ngx_hunk_t *h; |
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
32 |
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
33 ngx_test_null(h, ngx_palloc(pool, sizeof(ngx_hunk_t)), NULL); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
35 if (hunk->type & NGX_HUNK_TEMP && hunk->pos - hunk->pre_start >= size) { |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 /* keep hunk->start unchanged - used in restore */ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 h->pre_start = hunk->pre_start; |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
38 h->end = h->post_end = hunk->pre_start = hunk->pos; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
39 h->start = h->pos = h->last = h->end - size; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
40 h->file_pos = h->file_last = 0; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
42 h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY; |
76
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
43 h->file = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
44 h->shadow = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
45 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 h->tag = 0; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 } else { |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
49 ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL); |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
76
diff
changeset
|
50 h->start = h->pos = h->last = h->pre_start; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
51 h->end = h->post_end = h->start + size; |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
52 h->file_pos = h->file_last = 0; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
54 h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY; |
76
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
55 h->file = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
56 h->shadow = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
57 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
58 h->tag = 0; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
59 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
61 return h; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
63 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
64 ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
65 { |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
66 ngx_hunk_t *h; |
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
67 |
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
68 ngx_test_null(h, ngx_palloc(pool, sizeof(ngx_hunk_t)), NULL); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
69 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
70 if (hunk->type & NGX_HUNK_TEMP |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
71 && hunk->last == hunk->end |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
72 && hunk->post_end - hunk->end >= size) |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
73 { |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
74 h->post_end = hunk->post_end; |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
75 h->pre_start = h->start = h->pos = h->last = hunk->post_end = |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
76 hunk->last; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
77 h->file_pos = h->file_last = 0; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
78 |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
79 h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY; |
76
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
80 h->file = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
81 h->shadow = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
82 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
83 h->tag = 0; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
84 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 } else { |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
86 ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL); |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
76
diff
changeset
|
87 h->start = h->pos = h->last = h->pre_start; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
88 h->end = h->post_end = h->start + size; |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
89 h->file_pos = h->file_last = 0; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
90 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
91 h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY; |
76
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
92 h->file = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
93 h->shadow = NULL; |
6127d7075471
nginx-0.0.1-2003-04-15-19:06:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
94 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
95 h->tag = 0; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
96 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
97 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
98 return h; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
99 } |
132
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
100 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
101 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
102 int ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in) |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
103 { |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
104 ngx_chain_t *cl, **ll; |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
105 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
106 ll = chain; |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
107 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
108 for (cl = *chain; cl; cl = cl->next) { |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
109 ll = &cl->next; |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
110 } |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
111 |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
112 while (in) { |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
113 ngx_test_null(cl, ngx_alloc_chain_link(pool), NGX_ERROR); |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
114 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
115 cl->hunk = in->hunk; |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
116 *ll = cl; |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
117 ll = &cl->next; |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
118 in = in->next; |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
119 } |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
120 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
121 *ll = NULL; |
136
da00cde00e8a
nginx-0.0.1-2003-10-02-09:39:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
135
diff
changeset
|
122 |
134
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
123 return NGX_OK; |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
124 } |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
125 |
d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
132
diff
changeset
|
126 |
132
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
127 void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
128 ngx_chain_t **out, ngx_hunk_tag_t tag) |
132
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
129 { |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
130 ngx_chain_t *te; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
131 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
132 if (*busy == NULL) { |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
133 *busy = *out; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
134 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
135 } else { |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
136 for (te = *busy; /* void */ ; te = te->next) { |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
137 if (te->next == NULL) { |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
138 te->next = *out; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
139 break; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
140 } |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
141 } |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
142 } |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
143 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
144 *out = NULL; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
145 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
146 while (*busy) { |
151
2d9e4a8b6d11
nginx-0.0.1-2003-10-20-21:14:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
147 if (ngx_hunk_size((*busy)->hunk) > 0) { |
132
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
148 break; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
149 } |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
150 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
151 #if (HAVE_WRITE_ZEROCOPY) |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
152 if ((*busy)->hunk->type & NGX_HUNK_ZEROCOPY_BUSY) { |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
153 break; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
154 } |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
155 #endif |
151
2d9e4a8b6d11
nginx-0.0.1-2003-10-20-21:14:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
156 |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
157 if ((*busy)->hunk->tag != tag) { |
135
e29909bd9b8a
nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
134
diff
changeset
|
158 *busy = (*busy)->next; |
e29909bd9b8a
nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
134
diff
changeset
|
159 continue; |
e29909bd9b8a
nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
134
diff
changeset
|
160 } |
132
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
161 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
162 (*busy)->hunk->pos = (*busy)->hunk->last = (*busy)->hunk->start; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
163 |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
164 te = *busy; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
165 *busy = (*busy)->next; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
166 te->next = *free; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
167 *free = te; |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
168 } |
949f45d1589a
nginx-0.0.1-2003-09-24-20:44:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
169 } |