Diff for /embedaddon/lighttpd/src/chunk.h between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2013/10/14 10:32:48 version 1.1.1.2, 2016/11/02 10:35:00
Line 1 Line 1
 #ifndef _CHUNK_H_  #ifndef _CHUNK_H_
 #define _CHUNK_H_  #define _CHUNK_H_
   #include "first.h"
   
 #include "buffer.h"  #include "buffer.h"
 #include "array.h"  #include "array.h"
 #include "sys-mmap.h"  
   
 typedef struct chunk {  typedef struct chunk {
        enum { UNUSED_CHUNK, MEM_CHUNK, FILE_CHUNK } type;        enum { MEM_CHUNK, FILE_CHUNK } type;
   
         buffer *mem; /* either the storage of the mem-chunk or the read-ahead buffer */          buffer *mem; /* either the storage of the mem-chunk or the read-ahead buffer */
   
Line 26  typedef struct chunk { Line 26  typedef struct chunk {
                 int is_temp; /* file is temporary and will be deleted if on cleanup */                  int is_temp; /* file is temporary and will be deleted if on cleanup */
         } file;          } file;
   
        off_t  offset; /* octets sent from this chunk        /* the size of the chunk is either:
                          the size of the chunk is either         * - mem-chunk: buffer_string_length(chunk::mem)
                          - mem-chunk: mem->used - 1         * - file-chunk: chunk::file.length
                          - file-chunk: file.length         */
                        */        off_t  offset; /* octets sent from this chunk */
   
         struct chunk *next;          struct chunk *next;
 } chunk;  } chunk;
Line 42  typedef struct { Line 42  typedef struct {
         chunk *unused;          chunk *unused;
         size_t unused_chunks;          size_t unused_chunks;
   
        array *tempdirs;        off_t bytes_in, bytes_out;
   
        off_t  bytes_in, bytes_out;        array *tempdirs;
         unsigned int upload_temp_file_size;
         unsigned int tempdir_idx;
 } chunkqueue;  } chunkqueue;
   
 chunkqueue *chunkqueue_init(void);  chunkqueue *chunkqueue_init(void);
int chunkqueue_set_tempdirs(chunkqueue *c, array *tempdirs);void chunkqueue_set_tempdirs_default (array *tempdirs, unsigned int upload_temp_file_size);
int chunkqueue_append_file(chunkqueue *c, buffer *fn, off_t offset, off_t len);void chunkqueue_append_file(chunkqueue *cq, buffer *fn, off_t offset, off_t len); /* copies "fn" */
int chunkqueue_append_mem(chunkqueue *c, const char *mem, size_t len);void chunkqueue_append_file_fd(chunkqueue *cq, buffer *fn, int fd, off_t offset, off_t len); /* copies "fn" */
int chunkqueue_append_buffer(chunkqueue *c, buffer *mem);void chunkqueue_append_mem(chunkqueue *cq, const char *mem, size_t len); /* copies memory */
int chunkqueue_append_buffer_weak(chunkqueue *c, buffer *mem);void chunkqueue_append_buffer(chunkqueue *cq, buffer *mem); /* may reset "mem" */
int chunkqueue_prepend_buffer(chunkqueue *c, buffer *mem);void chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem); /* may reset "mem" */
 void chunkqueue_append_chunkqueue(chunkqueue *cq, chunkqueue *src);
   
buffer * chunkqueue_get_append_buffer(chunkqueue *c);struct server; /*(declaration)*/
buffer * chunkqueue_get_prepend_buffer(chunkqueue *c);int chunkqueue_append_mem_to_tempfile(struct server *srv, chunkqueue *cq, const char *mem, size_t len);
chunk * chunkqueue_get_append_tempfile(chunkqueue *cq); 
   
int chunkqueue_remove_finished_chunks(chunkqueue *cq);/* functions to handle buffers to read into: */
 /* return a pointer to a buffer in *mem with size *len;
  *  it should be at least min_size big, and use alloc_size if
  *  new memory is allocated.
  * modifying the chunkqueue invalidates the memory area.
  * should always be followed by chunkqueue_get_memory(),
  *  even if nothing was read.
  * pass 0 for min_size/alloc_size for default values
  */
 void chunkqueue_get_memory(chunkqueue *cq, char **mem, size_t *len, size_t min_size, size_t alloc_size);
 /* append first len bytes of the memory queried with
  * chunkqueue_get_memory to the chunkqueue
  */
 void chunkqueue_use_memory(chunkqueue *cq, size_t len);
   
off_t chunkqueue_length(chunkqueue *c);/* mark first "len" bytes as written (incrementing chunk offsets)
off_t chunkqueue_written(chunkqueue *c); * and remove finished chunks
void chunkqueue_free(chunkqueue *c); */
void chunkqueue_reset(chunkqueue *c);void chunkqueue_mark_written(chunkqueue *cq, off_t len);
   
int chunkqueue_is_empty(chunkqueue *c);void chunkqueue_remove_finished_chunks(chunkqueue *cq);
 
 void chunkqueue_steal(chunkqueue *dest, chunkqueue *src, off_t len);
 struct server;
 int chunkqueue_steal_with_tempfiles(struct server *srv, chunkqueue *dest, chunkqueue *src, off_t len);
 
 off_t chunkqueue_length(chunkqueue *cq);
 void chunkqueue_free(chunkqueue *cq);
 void chunkqueue_reset(chunkqueue *cq);
 
 int chunkqueue_is_empty(chunkqueue *cq);
   
 #endif  #endif

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>