comparison src/os/unix/ngx_files.c @ 343:6bdf858bff8c

nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
author Igor Sysoev <igor@sysoev.ru>
date Fri, 28 May 2004 15:49:23 +0000
parents 00c5660d2707
children e366ba5db8f8
comparison
equal deleted inserted replaced
342:0ee0642af5f1 343:6bdf858bff8c
126 ngx_array_t io; 126 ngx_array_t io;
127 127
128 /* use pwrite() if there's the only hunk in a chain */ 128 /* use pwrite() if there's the only hunk in a chain */
129 129
130 if (cl->next == NULL) { 130 if (cl->next == NULL) {
131 return ngx_write_file(file, cl->hunk->pos, 131 return ngx_write_file(file, cl->buf->pos,
132 (size_t) (cl->hunk->last - cl->hunk->pos), 132 (size_t) (cl->buf->last - cl->buf->pos),
133 offset); 133 offset);
134 } 134 }
135 135
136 prev = NULL; 136 prev = NULL;
137 iov = NULL; 137 iov = NULL;
138 size = 0; 138 size = 0;
139 139
140 ngx_init_array(io, pool, 10, sizeof(struct iovec), NGX_ERROR); 140 ngx_init_array(io, pool, 10, sizeof(struct iovec), NGX_ERROR);
141 141
142 /* create the iovec and coalesce the neighbouring hunks */ 142 /* create the iovec and coalesce the neighbouring bufs */
143 143
144 while (cl) { 144 while (cl) {
145 if (prev == cl->hunk->pos) { 145 if (prev == cl->buf->pos) {
146 iov->iov_len += cl->hunk->last - cl->hunk->pos; 146 iov->iov_len += cl->buf->last - cl->buf->pos;
147 147
148 } else { 148 } else {
149 ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR); 149 ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
150 iov->iov_base = (void *) cl->hunk->pos; 150 iov->iov_base = (void *) cl->buf->pos;
151 iov->iov_len = cl->hunk->last - cl->hunk->pos; 151 iov->iov_len = cl->buf->last - cl->buf->pos;
152 } 152 }
153 153
154 size += cl->hunk->last - cl->hunk->pos; 154 size += cl->buf->last - cl->buf->pos;
155 prev = cl->hunk->last; 155 prev = cl->buf->last;
156 cl = cl->next; 156 cl = cl->next;
157 } 157 }
158 158
159 /* use pwrite() if there's the only iovec buffer */ 159 /* use pwrite() if there's the only iovec buffer */
160 160