src/atomicreader.c File Reference

#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "rdd.h"
#include "reader.h"

Include dependency graph for atomicreader.c:

Go to the source code of this file.

Data Structures

struct  _RDD_ATOMIC_READER
 Atomic reader state. More...

Typedefs

typedef struct _RDD_ATOMIC_READER RDD_ATOMIC_READER
 Atomic reader state.

Functions

static int rdd_atomic_close (RDD_READER *r, int recurse)
static int rdd_atomic_read (RDD_READER *r, unsigned char *buf, unsigned nbyte, unsigned *nread)
static int rdd_atomic_seek (RDD_READER *r, rdd_count_t pos)
static int rdd_atomic_tell (RDD_READER *r, rdd_count_t *pos)
int rdd_open_atomic_reader (RDD_READER **self, RDD_READER *p)
 Instantiates a reader that does not move the file pointer when a read error occurs.

Variables

static RDD_READ_OPS atomic_read_ops


Typedef Documentation

Atomic reader state.

An atomic reader forwards all operations to its parent in the reader stack, so it only needs to keep track of that parent.


Function Documentation

static int rdd_atomic_close ( RDD_READER r,
int  recurse 
) [static]

Definition at line 140 of file atomicreader.c.

References _RDD_ATOMIC_READER::parent, RDD_OK, and rdd_reader_close().

Here is the call graph for this function:

static int rdd_atomic_read ( RDD_READER r,
unsigned char *  buf,
unsigned  nbyte,
unsigned *  nread 
) [static]

Definition at line 95 of file atomicreader.c.

References _RDD_ATOMIC_READER::parent, RDD_OK, rdd_reader_read(), rdd_reader_seek(), and rdd_reader_tell().

Here is the call graph for this function:

static int rdd_atomic_seek ( RDD_READER r,
rdd_count_t  pos 
) [static]

Definition at line 132 of file atomicreader.c.

References _RDD_ATOMIC_READER::parent, and rdd_reader_seek().

Here is the call graph for this function:

static int rdd_atomic_tell ( RDD_READER r,
rdd_count_t pos 
) [static]

Definition at line 124 of file atomicreader.c.

References _RDD_ATOMIC_READER::parent, and rdd_reader_tell().

Here is the call graph for this function:

int rdd_open_atomic_reader ( RDD_READER **  r,
RDD_READER p 
)

Instantiates a reader that does not move the file pointer when a read error occurs.

Parameters:
r output value: a new reader object.
p an existing parent reader.
An atomic reader adds predictability to an existing reader p. All read requests received by r are forwarded to p. If a read on p fails with error code RDD_EREAD, then r will restore the file position to the same value it had before the read was issued.

Note: the parent reader p MUST implement the seek() and tell() operations.

Definition at line 73 of file atomicreader.c.

References _RDD_ATOMIC_READER::parent, RDD_BADARG, rdd_new_reader(), RDD_OK, and _RDD_READER::state.

Here is the call graph for this function:


Variable Documentation

Initial value:

Definition at line 65 of file atomicreader.c.


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