Lines Matching refs:c
31 chunk *c; in network_write_chunkqueue_linuxsendfile() local
33 for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) { in network_write_chunkqueue_linuxsendfile()
36 switch(c->type) { in network_write_chunkqueue_linuxsendfile()
52 for (num_chunks = 0, tc = c; in network_write_chunkqueue_linuxsendfile()
56 for (tc = c, i = 0; i < num_chunks; tc = tc->next, i++) { in network_write_chunkqueue_linuxsendfile()
102 for(i = 0, tc = c; i < num_chunks; i++, tc = tc->next) { in network_write_chunkqueue_linuxsendfile()
110 c = c->next; in network_write_chunkqueue_linuxsendfile()
133 offset = c->file.start + c->offset; in network_write_chunkqueue_linuxsendfile()
134 toSend = c->file.length - c->offset; in network_write_chunkqueue_linuxsendfile()
138 if (-1 == c->file.fd) { in network_write_chunkqueue_linuxsendfile()
139 if (-1 == (c->file.fd = open(c->file.name->ptr, O_RDONLY))) { in network_write_chunkqueue_linuxsendfile()
145 fcntl(c->file.fd, F_SETFD, FD_CLOEXEC); in network_write_chunkqueue_linuxsendfile()
149 if (-1 == posix_fadvise(c->file.fd, 0, 0, POSIX_FADV_SEQUENTIAL)) { in network_write_chunkqueue_linuxsendfile()
152 "posix_fadvise failed:", strerror(errno), c->file.fd); in network_write_chunkqueue_linuxsendfile()
158 if (-1 == (r = sendfile(fd, c->file.fd, &offset, toSend))) { in network_write_chunkqueue_linuxsendfile()
180 if (HANDLER_ERROR == stat_cache_get_entry(srv, con, c->file.name, &sce)) { in network_write_chunkqueue_linuxsendfile()
202 if ((c->offset & ~(READ_AHEAD - 1)) != ((c->offset + r) & ~(READ_AHEAD - 1))) { in network_write_chunkqueue_linuxsendfile()
204 …if (-1 == posix_fadvise(c->file.fd, (c->offset + r) & ~(READ_AHEAD - 1), READ_AHEAD, POSIX_FADV_NO… in network_write_chunkqueue_linuxsendfile()
206 "posix_fadvise failed:", strerror(errno), c->file.fd); in network_write_chunkqueue_linuxsendfile()
212 c->offset += r; in network_write_chunkqueue_linuxsendfile()
216 if (c->offset == c->file.length) { in network_write_chunkqueue_linuxsendfile()
221 if (c->file.fd != -1) { in network_write_chunkqueue_linuxsendfile()
222 close(c->file.fd); in network_write_chunkqueue_linuxsendfile()
223 c->file.fd = -1; in network_write_chunkqueue_linuxsendfile()
231 log_error_write(srv, __FILE__, __LINE__, "ds", c, "type not known"); in network_write_chunkqueue_linuxsendfile()