Lines Matching refs:file
117 c->file.length = 0; in chunk_init()
118 c->file.is_temp = 0; in chunk_init()
119 c->file.view = NULL; in chunk_init()
121 c->file.fd = -1; in chunk_init()
194 if (c->file.is_temp) { in chunk_reset_file_chunk()
195 c->file.is_temp = 0; in chunk_reset_file_chunk()
199 if (c->file.refchg) { in chunk_reset_file_chunk()
200 c->file.refchg(c->file.ref, -1); in chunk_reset_file_chunk()
201 c->file.refchg = 0; /* NULL fn ptr */ in chunk_reset_file_chunk()
202 c->file.ref = NULL; in chunk_reset_file_chunk()
204 else if (c->file.fd != -1) { in chunk_reset_file_chunk()
205 close(c->file.fd); in chunk_reset_file_chunk()
208 if (c->file.view) in chunk_reset_file_chunk()
209 c->file.view = chunk_file_view_release(c->file.view); in chunk_reset_file_chunk()
211 c->file.fd = -1; in chunk_reset_file_chunk()
212 c->file.length = 0; in chunk_reset_file_chunk()
434 : c->file.length) in chunk_remaining_length()
484 c->file.length = offset + len; in __attribute_nonnull__()
499 (chunkqueue_append_file_chunk(cq, fn, offset, len))->file.fd = fd; in chunkqueue_append_file_fd()
655 c->file.length += len; in chunkqueue_update_file()
681 if (c->file.fd >= 0) { in chunkqueue_dup_file_chunk_fd()
682 if (c->file.refchg) { in chunkqueue_dup_file_chunk_fd()
683 d->file.fd = c->file.fd; in chunkqueue_dup_file_chunk_fd()
684 d->file.ref = c->file.ref; in chunkqueue_dup_file_chunk_fd()
685 d->file.refchg = c->file.refchg; in chunkqueue_dup_file_chunk_fd()
686 d->file.refchg(d->file.ref, 1); in chunkqueue_dup_file_chunk_fd()
689 d->file.fd = fdevent_dup_cloexec(c->file.fd); in chunkqueue_dup_file_chunk_fd()
691 if ((d->file.view = c->file.view)) in chunkqueue_dup_file_chunk_fd()
692 ++d->file.view->refcnt; in chunkqueue_dup_file_chunk_fd()
760 c->file.is_temp = 1; in chunkqueue_get_append_newtempfile()
766 c->file.fd = in chunkqueue_get_append_newtempfile()
768 if (-1 != c->file.fd) return c; in chunkqueue_get_append_newtempfile()
772 c->file.fd = in chunkqueue_get_append_newtempfile()
774 if (-1 != c->file.fd) return c; in chunkqueue_get_append_newtempfile()
781 c->file.is_temp = 0; in chunkqueue_get_append_newtempfile()
800 if (NULL != c && c->file.is_temp && c->file.fd >= 0) { in chunkqueue_get_append_tempfile()
802 if (c->file.length < (off_t)cq->upload_temp_file_size) in chunkqueue_get_append_tempfile()
806 force_assert(0 == c->file.refchg); /*(else should not happen)*/ in chunkqueue_get_append_tempfile()
807 int rc = close(c->file.fd); in chunkqueue_get_append_tempfile()
808 c->file.fd = -1; in chunkqueue_get_append_tempfile()
834 force_assert(0 == c->file.refchg); /*(else should not happen)*/ in chunkqueue_append_tempfile_err()
835 int rc = close(c->file.fd); in chunkqueue_append_tempfile_err()
836 c->file.fd = -1; in chunkqueue_append_tempfile_err()
888 if (dst_c->file.fd < 0) return -1; in chunkqueue_append_mem_to_tempfile()
892 const ssize_t written =pwrite(dst_c->file.fd, mem, len, dst_c->file.length); in chunkqueue_append_mem_to_tempfile()
895 const ssize_t written = write(dst_c->file.fd, mem, len); in chunkqueue_append_mem_to_tempfile()
899 dst_c->file.length += len; in chunkqueue_append_mem_to_tempfile()
908 dst_c->file.length += (size_t)written; in chunkqueue_append_mem_to_tempfile()
989 if (c->file.fd < 0) return -1; in chunkqueue_append_cqmem_to_tempfile()
992 ssize_t wr = pwritev(c->file.fd, iov, (int)iovcnt, c->file.length); in chunkqueue_append_cqmem_to_tempfile()
1000 c->file.length += wr; in chunkqueue_append_cqmem_to_tempfile()
1068 loff_t off = c->file.length; in chunkqueue_append_splice_pipe_tempfile()
1069 ssize_t wr = splice(fd, NULL, c->file.fd, &off, len, in chunkqueue_append_splice_pipe_tempfile()
1073 c->file.length += len; in chunkqueue_append_splice_pipe_tempfile()
1083 c->file.length += (size_t)wr; in chunkqueue_append_splice_pipe_tempfile()
1335 if (-1 == c->file.fd) { in chunk_open_file_chunk()
1337 if (-1 == (c->file.fd = fdevent_open_cloexec(c->mem->ptr, 1, O_RDONLY, 0))) { in chunk_open_file_chunk()
1344 if (c->file.is_temp) return 0; in chunk_open_file_chunk()
1347 if (-1 == fstat(c->file.fd, &st)) { in chunk_open_file_chunk()
1353 if (c->file.length > st.st_size) { in chunk_open_file_chunk()
1385 const off_t len = c->file.length - c->offset; in chunkqueue_write_chunk_file_intermed()
1409 const off_t len = c->file.length - c->offset; in chunkqueue_write_chunk_file()
1418 sendfile(fd, c->file.fd, &offset, len < INT32_MAX ? len : INT32_MAX); in chunkqueue_write_chunk_file()
1469 const size_t len = (size_t)(c->file.length - c->offset); in chunkqueue_write_chunk_to_pipe()
1473 ? splice(c->file.fd, &abs_offset, fd, NULL, len, SPLICE_F_NONBLOCK) in chunkqueue_write_chunk_to_pipe()
1498 if (filec != cq->last || filec->type != FILE_CHUNK || filec->file.fd < 0) in chunkqueue_small_resp_optim()
1504 off_t len = filec->file.length - filec->offset; in chunkqueue_small_resp_optim()
1518 rd = chunk_file_pread(filec->file.fd, ptr+offset, (size_t)len, in chunkqueue_small_resp_optim()
1579 if (c->file.fd >= 0 || 0 == chunk_open_file_chunk(c, errh)) { in chunkqueue_peek_data()
1580 off_t len = c->file.length - c->offset; in chunkqueue_peek_data()
1601 const chunk_file_view * const restrict cfv = (!c->file.is_temp) in chunkqueue_peek_data()
1607 if (!c->file.is_temp) {/*(might be changed to policy flag)*/ in chunkqueue_peek_data()
1611 "SIGBUS in mmap: %s %d", c->mem->ptr, c->file.fd); in chunkqueue_peek_data()
1625 ssize_t rd = chunk_file_pread(c->file.fd, data_in+*dlen, in chunkqueue_peek_data()
1708 chunk_file_view * restrict cfv = c->file.view; in chunkqueue_chunk_file_viewadj()
1712 cfv = c->file.view = chunk_file_view_init(); in chunkqueue_chunk_file_viewadj()
1718 if (c->file.fd < 0 && 0 != chunk_open_file_chunk(c, errh)) { in chunkqueue_chunk_file_viewadj()
1719 c->file.view = chunk_file_view_failed(cfv); in chunkqueue_chunk_file_viewadj()
1739 if (cfv->mlen > c->file.length - cfv->foff) in chunkqueue_chunk_file_viewadj()
1740 cfv->mlen = c->file.length - cfv->foff; in chunkqueue_chunk_file_viewadj()
1743 c->file.is_temp ? MAP_PRIVATE : chunk_mmap_flags, in chunkqueue_chunk_file_viewadj()
1744 c->file.fd, cfv->foff); in chunkqueue_chunk_file_viewadj()
1751 MAP_PRIVATE, c->file.fd, cfv->foff); in chunkqueue_chunk_file_viewadj()
1754 c->file.view = chunk_file_view_failed(cfv); in chunkqueue_chunk_file_viewadj()
1763 if (c->file.is_temp && !c->file.refchg) { in chunkqueue_chunk_file_viewadj()
1764 close(c->file.fd); in chunkqueue_chunk_file_viewadj()
1765 c->file.fd = -1; in chunkqueue_chunk_file_viewadj()