aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-05-28 15:49:23 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-05-28 15:49:23 +0000
commit369145cef1971e4273dc59340689c2d96f84d18a (patch)
tree55f59267d9ada5160ad74168bf5721ce5b3653ff /src/os/unix
parent87a7d1c44917e352e336c859c2a797e5d60b19da (diff)
downloadnginx-369145cef1971e4273dc59340689c2d96f84d18a.tar.gz
nginx-369145cef1971e4273dc59340689c2d96f84d18a.zip
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_aio_read_chain.c12
-rw-r--r--src/os/unix/ngx_aio_write_chain.c20
-rw-r--r--src/os/unix/ngx_files.c18
-rw-r--r--src/os/unix/ngx_freebsd_sendfile_chain.c76
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c6
-rw-r--r--src/os/unix/ngx_readv_chain.c32
-rw-r--r--src/os/unix/ngx_solaris_sendfilev_chain.c6
-rw-r--r--src/os/unix/ngx_writev_chain.c24
8 files changed, 97 insertions, 97 deletions
diff --git a/src/os/unix/ngx_aio_read_chain.c b/src/os/unix/ngx_aio_read_chain.c
index 2858afa5b..e850d3462 100644
--- a/src/os/unix/ngx_aio_read_chain.c
+++ b/src/os/unix/ngx_aio_read_chain.c
@@ -28,15 +28,15 @@ ssize_t ngx_aio_read_chain(ngx_connection_t *c, ngx_chain_t *cl)
return total ? total : NGX_AGAIN;
}
- buf = cl->hunk->last;
- prev = cl->hunk->last;
+ buf = cl->buf->last;
+ prev = cl->buf->last;
size = 0;
- /* coalesce the neighbouring hunks */
+ /* coalesce the neighbouring bufs */
- while (cl && prev == cl->hunk->last) {
- size += cl->hunk->end - cl->hunk->last;
- prev = cl->hunk->end;
+ while (cl && prev == cl->buf->last) {
+ size += cl->buf->end - cl->buf->last;
+ prev = cl->buf->end;
cl = cl->next;
}
diff --git a/src/os/unix/ngx_aio_write_chain.c b/src/os/unix/ngx_aio_write_chain.c
index f5e125e4f..a872fe2e0 100644
--- a/src/os/unix/ngx_aio_write_chain.c
+++ b/src/os/unix/ngx_aio_write_chain.c
@@ -19,7 +19,7 @@ ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in)
while (cl) {
- if (cl->hunk->last - cl->hunk->pos == 0) {
+ if (cl->buf->last - cl->buf->pos == 0) {
cl = cl->next;
continue;
}
@@ -30,15 +30,15 @@ ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in)
return cl;
}
- buf = cl->hunk->pos;
+ buf = cl->buf->pos;
prev = buf;
size = 0;
- /* coalesce the neighbouring hunks */
+ /* coalesce the neighbouring bufs */
- while (cl && prev == cl->hunk->pos) {
- size += cl->hunk->last - cl->hunk->pos;
- prev = cl->hunk->last;
+ while (cl && prev == cl->buf->pos) {
+ size += cl->buf->last - cl->buf->pos;
+ prev = cl->buf->last;
cl = cl->next;
}
@@ -60,14 +60,14 @@ ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in)
for (cl = in; cl; cl = cl->next) {
- if (sent >= cl->hunk->last - cl->hunk->pos) {
- sent -= cl->hunk->last - cl->hunk->pos;
- cl->hunk->pos = cl->hunk->last;
+ if (sent >= cl->buf->last - cl->buf->pos) {
+ sent -= cl->buf->last - cl->buf->pos;
+ cl->buf->pos = cl->buf->last;
continue;
}
- cl->hunk->pos += sent;
+ cl->buf->pos += sent;
break;
}
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index da452e3fe..5d551ebe7 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -128,8 +128,8 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
/* use pwrite() if there's the only hunk in a chain */
if (cl->next == NULL) {
- return ngx_write_file(file, cl->hunk->pos,
- (size_t) (cl->hunk->last - cl->hunk->pos),
+ return ngx_write_file(file, cl->buf->pos,
+ (size_t) (cl->buf->last - cl->buf->pos),
offset);
}
@@ -139,20 +139,20 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
ngx_init_array(io, pool, 10, sizeof(struct iovec), NGX_ERROR);
- /* create the iovec and coalesce the neighbouring hunks */
+ /* create the iovec and coalesce the neighbouring bufs */
while (cl) {
- if (prev == cl->hunk->pos) {
- iov->iov_len += cl->hunk->last - cl->hunk->pos;
+ if (prev == cl->buf->pos) {
+ iov->iov_len += cl->buf->last - cl->buf->pos;
} else {
ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
- iov->iov_base = (void *) cl->hunk->pos;
- iov->iov_len = cl->hunk->last - cl->hunk->pos;
+ iov->iov_base = (void *) cl->buf->pos;
+ iov->iov_len = cl->buf->last - cl->buf->pos;
}
- size += cl->hunk->last - cl->hunk->pos;
- prev = cl->hunk->last;
+ size += cl->buf->last - cl->buf->pos;
+ prev = cl->buf->last;
cl = cl->next;
}
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
index b8872dfc3..694ea2226 100644
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -39,7 +39,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
struct iovec *iov;
struct sf_hdtr hdtr;
ngx_err_t err;
- ngx_hunk_t *file;
+ ngx_buf_t *file;
ngx_array_t header, trailer;
ngx_event_t *wev;
ngx_chain_t *cl, *tail;
@@ -74,87 +74,87 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_init_array(trailer, c->pool, 10, sizeof(struct iovec),
NGX_CHAIN_ERROR);
- /* create the header iovec and coalesce the neighbouring hunks */
+ /* create the header iovec and coalesce the neighbouring bufs */
prev = NULL;
iov = NULL;
for (cl = in; cl && header.nelts < IOV_MAX; cl = cl->next) {
- if (ngx_hunk_special(cl->hunk)) {
+ if (ngx_buf_special(cl->buf)) {
continue;
}
- if (!ngx_hunk_in_memory_only(cl->hunk)) {
+ if (!ngx_buf_in_memory_only(cl->buf)) {
break;
}
- if (prev == cl->hunk->pos) {
- iov->iov_len += cl->hunk->last - cl->hunk->pos;
+ if (prev == cl->buf->pos) {
+ iov->iov_len += cl->buf->last - cl->buf->pos;
} else {
ngx_test_null(iov, ngx_push_array(&header), NGX_CHAIN_ERROR);
- iov->iov_base = (void *) cl->hunk->pos;
- iov->iov_len = cl->hunk->last - cl->hunk->pos;
+ iov->iov_base = (void *) cl->buf->pos;
+ iov->iov_len = cl->buf->last - cl->buf->pos;
}
- prev = cl->hunk->last;
- hsize += cl->hunk->last - cl->hunk->pos;
+ prev = cl->buf->last;
+ hsize += cl->buf->last - cl->buf->pos;
}
- /* get the file hunk */
+ /* get the file buf */
- if (cl && (cl->hunk->type & NGX_HUNK_FILE)) {
- file = cl->hunk;
+ if (cl && cl->buf->in_file) {
+ file = cl->buf;
fsize = (size_t) (file->file_last - file->file_pos);
fprev = file->file_last;
cl = cl->next;
- /* coalesce the neighbouring file hunks */
+ /* coalesce the neighbouring file bufs */
- while (cl && (cl->hunk->type & NGX_HUNK_FILE)) {
- if (file->file->fd != cl->hunk->file->fd
- || fprev != cl->hunk->file_pos)
+ while (cl && cl->buf->in_file) {
+ if (file->file->fd != cl->buf->file->fd
+ || fprev != cl->buf->file_pos)
{
break;
}
- fsize += (size_t) (cl->hunk->file_last - cl->hunk->file_pos);
- fprev = cl->hunk->file_last;
+ fsize += (size_t) (cl->buf->file_last - cl->buf->file_pos);
+ fprev = cl->buf->file_last;
cl = cl->next;
}
}
if (file) {
- /* create the tailer iovec and coalesce the neighbouring hunks */
+ /* create the tailer iovec and coalesce the neighbouring bufs */
prev = NULL;
iov = NULL;
for ( /* void */; cl && trailer.nelts < IOV_MAX; cl = cl->next) {
- if (ngx_hunk_special(cl->hunk)) {
+ if (ngx_buf_special(cl->buf)) {
continue;
}
- if (!ngx_hunk_in_memory_only(cl->hunk)) {
+ if (!ngx_buf_in_memory_only(cl->buf)) {
break;
}
- if (prev == cl->hunk->pos) {
- iov->iov_len += cl->hunk->last - cl->hunk->pos;
+ if (prev == cl->buf->pos) {
+ iov->iov_len += cl->buf->last - cl->buf->pos;
} else {
ngx_test_null(iov, ngx_push_array(&trailer),
NGX_CHAIN_ERROR);
- iov->iov_base = (void *) cl->hunk->pos;
- iov->iov_len = cl->hunk->last - cl->hunk->pos;
+ iov->iov_base = (void *) cl->buf->pos;
+ iov->iov_len = cl->buf->last - cl->buf->pos;
}
- prev = cl->hunk->last;
+ prev = cl->buf->last;
}
}
/*
- * the tail is the rest of the chain that exceeded
+ * the tail is the rest of the chain that exceedes
* a single sendfile() capability
*/
@@ -262,7 +262,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
for (cl = in; cl; cl = cl->next) {
- if (ngx_hunk_special(cl->hunk)) {
+ if (ngx_buf_special(cl->buf)) {
continue;
}
@@ -270,28 +270,28 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
break;
}
- size = ngx_hunk_size(cl->hunk);
+ size = ngx_buf_size(cl->buf);
if (sent >= size) {
sent -= size;
- if (cl->hunk->type & NGX_HUNK_IN_MEMORY) {
- cl->hunk->pos = cl->hunk->last;
+ if (ngx_buf_in_memory(cl->buf)) {
+ cl->buf->pos = cl->buf->last;
}
- if (cl->hunk->type & NGX_HUNK_FILE) {
- cl->hunk->file_pos = cl->hunk->file_last;
+ if (cl->buf->in_file) {
+ cl->buf->file_pos = cl->buf->file_last;
}
continue;
}
- if (cl->hunk->type & NGX_HUNK_IN_MEMORY) {
- cl->hunk->pos += sent;
+ if (ngx_buf_in_memory(cl->buf)) {
+ cl->buf->pos += sent;
}
- if (cl->hunk->type & NGX_HUNK_FILE) {
- cl->hunk->file_pos += sent;
+ if (cl->buf->in_file) {
+ cl->buf->file_pos += sent;
}
break;
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index 25932b598..0c6b9d0e8 100644
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -28,7 +28,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_int_t eintr;
struct iovec *iov;
ngx_err_t err;
- ngx_hunk_t *file;
+ ngx_buf_t *file;
ngx_array_t header;
ngx_event_t *wev;
ngx_chain_t *cl, *tail;
@@ -55,7 +55,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
prev = NULL;
iov = NULL;
- /* create the iovec and coalesce the neighbouring hunks */
+ /* create the iovec and coalesce the neighbouring bufs */
for (cl = in; cl && header.nelts < IOV_MAX; cl = cl->next) {
if (ngx_hunk_special(cl->hunk)) {
@@ -131,7 +131,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
}
/*
- * the tail is the rest of the chain that exceeded
+ * the tail is the rest of the chain that exceedes
* a single sendfile() capability
*/
diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c
index 86f774a0d..ed66ca027 100644
--- a/src/os/unix/ngx_readv_chain.c
+++ b/src/os/unix/ngx_readv_chain.c
@@ -10,10 +10,10 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
{
u_char *prev;
ssize_t n, size;
- struct iovec *iov;
ngx_err_t err;
ngx_array_t io;
ngx_event_t *rev;
+ struct iovec *iov;
rev = c->read;
@@ -50,20 +50,20 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
ngx_init_array(io, c->pool, 10, sizeof(struct iovec), NGX_ERROR);
- /* coalesce the neighbouring hunks */
+ /* coalesce the neighbouring bufs */
while (chain) {
- if (prev == chain->hunk->last) {
- iov->iov_len += chain->hunk->end - chain->hunk->last;
+ if (prev == chain->buf->last) {
+ iov->iov_len += chain->buf->end - chain->buf->last;
} else {
ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
- iov->iov_base = (void *) chain->hunk->last;
- iov->iov_len = chain->hunk->end - chain->hunk->last;
+ iov->iov_base = (void *) chain->buf->last;
+ iov->iov_len = chain->buf->end - chain->buf->last;
}
- size += chain->hunk->end - chain->hunk->last;
- prev = chain->hunk->end;
+ size += chain->buf->end - chain->buf->last;
+ prev = chain->buf->end;
chain = chain->next;
}
@@ -137,10 +137,10 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
{
u_char *prev;
ssize_t n, size;
- struct iovec *iov;
ngx_err_t err;
ngx_array_t io;
ngx_event_t *rev;
+ struct iovec *iov;
prev = NULL;
iov = NULL;
@@ -148,20 +148,20 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
ngx_init_array(io, c->pool, 10, sizeof(struct iovec), NGX_ERROR);
- /* coalesce the neighbouring hunks */
+ /* coalesce the neighbouring bufs */
while (chain) {
- if (prev == chain->hunk->last) {
- iov->iov_len += chain->hunk->end - chain->hunk->last;
+ if (prev == chain->buf->last) {
+ iov->iov_len += chain->buf->end - chain->buf->last;
} else {
ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
- iov->iov_base = chain->hunk->last;
- iov->iov_len = chain->hunk->end - chain->hunk->last;
+ iov->iov_base = chain->buf->last;
+ iov->iov_len = chain->buf->end - chain->buf->last;
}
- size += chain->hunk->end - chain->hunk->last;
- prev = chain->hunk->end;
+ size += chain->buf->end - chain->buf->last;
+ prev = chain->buf->end;
chain = chain->next;
}
diff --git a/src/os/unix/ngx_solaris_sendfilev_chain.c b/src/os/unix/ngx_solaris_sendfilev_chain.c
index 1c755e8dc..964027f65 100644
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c
+++ b/src/os/unix/ngx_solaris_sendfilev_chain.c
@@ -40,7 +40,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_init_array(vec, c->pool, 10, sizeof(sendfilevec_t),
NGX_CHAIN_ERROR);
- /* create the sendfilevec and coalesce the neighbouring hunks */
+ /* create the sendfilevec and coalesce the neighbouring bufs */
for (cl = in; cl && vec.nelts < IOV_MAX; cl = cl->next) {
if (ngx_hunk_special(cl->hunk)) {
@@ -83,8 +83,8 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
}
/*
- * the tail is the rest of the chain that exceeded a single
- * sendfilev() capability, IOV_MAX in Solaris is only 16
+ * the tail is the rest of the chain that exceedes a single
+ * sendfilev() capability, IOV_MAX in Solaris is limited by 16
*/
tail = cl;
diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c
index d68037519..31adc7555 100644
--- a/src/os/unix/ngx_writev_chain.c
+++ b/src/os/unix/ngx_writev_chain.c
@@ -41,19 +41,19 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in)
iov = NULL;
eintr = 0;
- /* create the iovec and coalesce the neighbouring hunks */
+ /* create the iovec and coalesce the neighbouring bufs */
for (cl = in; cl; cl = cl->next) {
- if (prev == cl->hunk->pos) {
- iov->iov_len += cl->hunk->last - cl->hunk->pos;
- prev = cl->hunk->last;
+ if (prev == cl->buf->pos) {
+ iov->iov_len += cl->buf->last - cl->buf->pos;
+ prev = cl->buf->last;
} else {
ngx_test_null(iov, ngx_push_array(&io), NGX_CHAIN_ERROR);
- iov->iov_base = (void *) cl->hunk->pos;
- iov->iov_len = cl->hunk->last - cl->hunk->pos;
- prev = cl->hunk->last;
+ iov->iov_base = (void *) cl->buf->pos;
+ iov->iov_len = cl->buf->last - cl->buf->pos;
+ prev = cl->buf->last;
}
}
@@ -86,20 +86,20 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in)
for (cl = in; cl && sent > 0; cl = cl->next) {
- size = cl->hunk->last - cl->hunk->pos;
+ size = cl->buf->last - cl->buf->pos;
if (sent >= size) {
sent -= size;
- if (cl->hunk->type & NGX_HUNK_IN_MEMORY) {
- cl->hunk->pos = cl->hunk->last;
+ if (ngx_buf_in_memory(cl->buf)) {
+ cl->buf->pos = cl->buf->last;
}
continue;
}
- if (cl->hunk->type & NGX_HUNK_IN_MEMORY) {
- cl->hunk->pos += sent;
+ if (ngx_buf_in_memory(cl->buf)) {
+ cl->buf->pos += sent;
}
break;