#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "rdd.h"
#include "reader.h"
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 struct _RDD_ATOMIC_READER RDD_ATOMIC_READER |
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.
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().
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().
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().
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().
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.
r | output value: a new reader object. | |
p | an existing parent 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.
RDD_READ_OPS atomic_read_ops [static] |
Initial value:
Definition at line 65 of file atomicreader.c.