24#include <libopenraw/io.h>
25#include "io_private.h"
33#define CHECK_PTR(p,r) \
34 if(p == NULL) { return r; }
43 return &posix_io_methods;
51IOFileRef raw_open(
struct io_methods * methods,
const char *path,
int mode)
53 CHECK_PTR(methods, NULL);
54 return methods->
open(path, mode);
66int raw_close(IOFileRef f)
83int raw_seek(IOFileRef f, off_t offset,
int whence)
97int raw_read(IOFileRef f,
void *buf,
size_t count)
103off_t raw_filesize(IOFileRef f)
106 return f->
methods->filesize(f);
109void *raw_mmap(IOFileRef f,
size_t l, off_t offset)
112 return f->
methods->mmap(f, l, offset);
116int raw_munmap(IOFileRef f,
void *addr,
size_t l)
119 return f->
methods->munmap(f, addr, l);
128int raw_get_error(IOFileRef f)
143char *raw_get_path(IOFileRef f)
struct io_methods * methods
int(* seek)(IOFileRef f, off_t offset, int whence)
IOFileRef(* open)(const char *path, int mode)
int(* close)(IOFileRef f)
int(* read)(IOFileRef f, void *buf, size_t count)