Lines Matching refs:cq
116 static int network_remove_finished_chunks(chunkqueue * const cq, const off_t len) { in network_remove_finished_chunks() argument
118 chunkqueue_remove_finished_chunks(cq); in network_remove_finished_chunks()
131 static int network_write_accounting(const int fd, chunkqueue * const cq, off_t * const p_max_bytes,… in network_write_accounting() argument
135 chunkqueue_mark_written(cq, wr); in network_write_accounting()
149 static int network_write_mem_chunk(const int fd, chunkqueue * const cq, off_t * const p_max_bytes, … in network_write_mem_chunk() argument
150 chunk* const c = cq->first; in network_write_mem_chunk()
153 if (c_len <= 0) return network_remove_finished_chunks(cq, c_len); in network_write_mem_chunk()
156 return network_write_accounting(fd, cq, p_max_bytes, errh, wr, c_len); in network_write_mem_chunk()
164 static int network_write_file_chunk_no_mmap(const int fd, chunkqueue * const cq, off_t * const p_ma… in network_write_file_chunk_no_mmap() argument
165 chunk* const c = cq->first; in network_write_file_chunk_no_mmap()
170 if (toSend <= 0) return network_remove_finished_chunks(cq, toSend); in network_write_file_chunk_no_mmap()
173 if (c->file.fd < 0 && 0 != chunkqueue_open_file_chunk(cq, errh)) return -1; in network_write_file_chunk_no_mmap()
182 return network_write_accounting(fd, cq, p_max_bytes, errh, wr, toSend); in network_write_file_chunk_no_mmap()
199 static int network_write_file_chunk_mmap(const int fd, chunkqueue * const cq, off_t * const p_max_b… in network_write_file_chunk_mmap() argument
200 chunk * const restrict c = cq->first; in network_write_file_chunk_mmap()
202 ? chunkqueue_chunk_file_view(cq->first, 0, errh)/*use default 512k block*/ in network_write_file_chunk_mmap()
205 return network_write_file_chunk_no_mmap(fd, cq, p_max_bytes, errh); in network_write_file_chunk_mmap()
209 if (toSend <= 0) return network_remove_finished_chunks(cq, toSend); in network_write_file_chunk_mmap()
216 return network_write_accounting(fd,cq,p_max_bytes,errh,(ssize_t)wr,toSend); in network_write_file_chunk_mmap()
254 static int network_writev_mem_chunks(const int fd, chunkqueue * const cq, off_t * const p_max_bytes… in network_writev_mem_chunks() argument
259 for (const chunk *c = cq->first; c && MEM_CHUNK == c->type; c = c->next) { in network_writev_mem_chunks()
270 return network_remove_finished_chunks(cq, c_len); in network_writev_mem_chunks()
272 if (0 == num_chunks) return network_remove_finished_chunks(cq, 0); in network_writev_mem_chunks()
275 return network_write_accounting(fd, cq, p_max_bytes, errh, wr, toSend); in network_writev_mem_chunks()
295 static int network_write_file_chunk_sendfile(const int fd, chunkqueue * const cq, off_t * const p_m… in network_write_file_chunk_sendfile() argument
296 chunk * const c = cq->first; in network_write_file_chunk_sendfile()
305 if (toSend <= 0) return network_remove_finished_chunks(cq, toSend); in network_write_file_chunk_sendfile()
307 if (c->file.fd < 0 && 0 != chunkqueue_open_file_chunk(cq, errh)) return -1; in network_write_file_chunk_sendfile()
371 return network_write_file_chunk_mmap(fd, cq, p_max_bytes, errh); in network_write_file_chunk_sendfile()
373 return network_write_file_chunk_no_mmap(fd, cq, p_max_bytes, errh); in network_write_file_chunk_sendfile()
382 chunkqueue_mark_written(cq, written); in network_write_file_chunk_sendfile()
406 static int network_write_chunkqueue_writev(const int fd, chunkqueue * const cq, off_t max_bytes, lo… in network_write_chunkqueue_writev() argument
407 while (NULL != cq->first) { in network_write_chunkqueue_writev()
410 switch (cq->first->type) { in network_write_chunkqueue_writev()
413 rc = network_writev_mem_chunks(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
415 rc = network_write_mem_chunk(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
420 rc = network_write_file_chunk_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
422 rc = network_write_file_chunk_no_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
434 static int network_write_chunkqueue_sendfile(const int fd, chunkqueue * const cq, off_t max_bytes, … in network_write_chunkqueue_sendfile() argument
435 while (NULL != cq->first) { in network_write_chunkqueue_sendfile()
438 switch (cq->first->type) { in network_write_chunkqueue_sendfile()
441 rc = network_writev_mem_chunks(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
443 rc = network_write_mem_chunk(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
448 rc = network_write_file_chunk_sendfile(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
450 rc = network_write_file_chunk_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
452 rc = network_write_file_chunk_no_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()