#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "rdd.h"
#include "writer.h"
Go to the source code of this file.
Data Structures | |
struct | _RDD_PART_WRITER |
Defines | |
#define | GIGABYTE (1024*1024*1024) |
Typedefs | |
typedef struct _RDD_PART_WRITER | RDD_PART_WRITER |
Functions | |
static unsigned | count_digits (rdd_count_t maxlen, rdd_count_t splitlen) |
static int | open_next_part (RDD_PART_WRITER *state) |
static int | part_close (RDD_WRITER *w) |
static int | part_compare_address (RDD_WRITER *w, struct addrinfo *addr, int *result) |
static int | part_write (RDD_WRITER *w, const unsigned char *buf, unsigned nbyte) |
int | rdd_open_part_writer (RDD_WRITER **self, const char *path, rdd_count_t maxlen, rdd_count_t splitlen, rdd_write_mode_t wrmode) |
Creates a writer that can split its output over multiple files. | |
Variables | |
static char | copyright [] |
static RDD_WRITE_OPS | part_write_ops |
#define GIGABYTE (1024*1024*1024) |
Definition at line 65 of file partwriter.c.
typedef struct _RDD_PART_WRITER RDD_PART_WRITER |
static unsigned count_digits | ( | rdd_count_t | maxlen, | |
rdd_count_t | splitlen | |||
) | [static] |
static int open_next_part | ( | RDD_PART_WRITER * | state | ) | [static] |
Definition at line 122 of file partwriter.c.
References _RDD_PART_WRITER::maxpathlen, _RDD_PART_WRITER::ndigit, _RDD_PART_WRITER::next_partnum, _RDD_PART_WRITER::parent, _RDD_PART_WRITER::path, _RDD_PART_WRITER::pathbuf, RDD_OK, rdd_open_safe_writer(), and _RDD_PART_WRITER::writemode.
static int part_close | ( | RDD_WRITER * | w | ) | [static] |
Definition at line 278 of file partwriter.c.
References _RDD_PART_WRITER::parent, _RDD_PART_WRITER::path, _RDD_PART_WRITER::pathbuf, RDD_OK, and rdd_writer_close().
static int part_compare_address | ( | RDD_WRITER * | w, | |
struct addrinfo * | addr, | |||
int * | result | |||
) | [static] |
static int part_write | ( | RDD_WRITER * | w, | |
const unsigned char * | buf, | |||
unsigned | nbyte | |||
) | [static] |
Definition at line 236 of file partwriter.c.
References open_next_part(), _RDD_PART_WRITER::parent, RDD_OK, rdd_writer_close(), rdd_writer_write(), _RDD_PART_WRITER::splitlen, _RDD_WRITER::state, and _RDD_PART_WRITER::written.
int rdd_open_part_writer | ( | RDD_WRITER ** | w, | |
const char * | basepath, | |||
rdd_count_t | maxlen, | |||
rdd_count_t | splitlen, | |||
rdd_write_mode_t | overwrite | |||
) |
Creates a writer that can split its output over multiple files.
w | output value: the new writer object | |
basepath | template for output file names | |
maxlen | maximum number of bytes that will be written | |
splitlen | maximum size in bytes of each output file | |
overwrite | indicates what to do when an output file already exists |
RDD_OK
on success.rdd_open_part_writer()
splits the data stream it receives over a sequence of output files. The first splitlen
bytes are written to output file number one, the next splitlen
bytes to output file number two, and so on. The name of each output file consists of:basepath
;basepath
. Definition at line 162 of file partwriter.c.
References count_digits(), error(), _RDD_PART_WRITER::maxpathlen, _RDD_PART_WRITER::ndigit, _RDD_PART_WRITER::next_partnum, open_next_part(), _RDD_PART_WRITER::path, _RDD_PART_WRITER::pathbuf, RDD_BADARG, rdd_new_writer(), RDD_NOMEM, RDD_OK, _RDD_PART_WRITER::splitlen, _RDD_WRITER::state, _RDD_PART_WRITER::writemode, and _RDD_PART_WRITER::written.
char copyright[] [static] |
Initial value:
"@(#) Copyright (c) 2002-2004\n\ Netherlands Forensic Institute. All rights reserved.\n"
Definition at line 34 of file partwriter.c.
RDD_WRITE_OPS part_write_ops [static] |
Initial value:
Definition at line 73 of file partwriter.c.