src/partwriter.c File Reference

#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"

Include dependency graph for partwriter.c:

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 Documentation

#define GIGABYTE   (1024*1024*1024)

Definition at line 65 of file partwriter.c.


Typedef Documentation


Function Documentation

static unsigned count_digits ( rdd_count_t  maxlen,
rdd_count_t  splitlen 
) [static]

Definition at line 99 of file partwriter.c.

References GIGABYTE, and RDD_WHOLE_FILE.

static int open_next_part ( RDD_PART_WRITER state  )  [static]

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().

Here is the call graph for this function:

static int part_compare_address ( RDD_WRITER w,
struct addrinfo *  addr,
int *  result 
) [static]

Definition at line 298 of file partwriter.c.

References RDD_BADARG, and RDD_OK.

static int part_write ( RDD_WRITER w,
const unsigned char *  buf,
unsigned  nbyte 
) [static]

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.

Parameters:
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
Returns:
Returns RDD_OK on success.
Routine 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:
  • the directory part of basepath;
  • the output file's sequence number;
  • a dash;
  • the base name of 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.

Here is the call graph for this function:


Variable Documentation

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.

Initial value:

Definition at line 73 of file partwriter.c.


Generated on Sun Feb 6 12:36:21 2011 for rdd by  doxygen 1.5.6