1 #ifndef OSTREAM_FILE_PRIVATE_H 2 #define OSTREAM_FILE_PRIVATE_H 3 4 #include "ostream-private.h" 5 6 struct file_ostream { 7 struct ostream_private ostream; 8 9 ssize_t (*writev)(struct file_ostream *fstream, 10 const struct const_iovec *iov, 11 unsigned int iov_count); 12 13 int fd; 14 struct io *io; 15 uoff_t buffer_offset; 16 uoff_t real_offset; 17 18 unsigned char *buffer; /* ring-buffer */ 19 size_t buffer_size, optimal_block_size; 20 size_t head, tail; /* first unsent/unused byte */ 21 22 bool full:1; /* if head == tail, is buffer empty or full? */ 23 bool file:1; 24 bool flush_pending:1; 25 bool socket_cork_set:1; 26 bool no_socket_cork:1; 27 bool no_socket_nodelay:1; 28 bool no_socket_quickack:1; 29 bool no_sendfile:1; 30 bool autoclose_fd:1; 31 }; 32 33 struct ostream * 34 o_stream_create_file_common(struct file_ostream *fstream, 35 int fd, size_t max_buffer_size, bool autoclose_fd); 36 ssize_t o_stream_file_writev(struct file_ostream *fstream, 37 const struct const_iovec *iov, 38 unsigned int iov_size); 39 ssize_t o_stream_file_sendv(struct ostream_private *stream, 40 const struct const_iovec *iov, 41 unsigned int iov_count); 42 void o_stream_file_close(struct iostream_private *stream, 43 bool close_parent); 44 45 #endif 46