00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdlib.h>
00022
00023 #include "libopenraw/io.h"
00024 #include "io_private.h"
00025 #include "posix_io.h"
00026 #include "or_debug.h"
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00037 struct io_methods* get_default_io_methods(void)
00038 {
00039 return &posix_io_methods;
00040 }
00041
00047 IOFileRef raw_open(struct io_methods * methods, const char *path, int mode)
00048 {
00049 return methods->open(path, mode);
00050 }
00051
00061 int raw_close(IOFileRef f)
00062 {
00063 int retval = f->methods->close(f);
00064 free(f);
00065 return retval;
00066 }
00067
00068
00076 int raw_seek(IOFileRef f, off_t offset, int whence)
00077 {
00078 return f->methods->seek(f, offset, whence);
00079 }
00080
00081
00089 int raw_read(IOFileRef f, void *buf, size_t count)
00090 {
00091 return f->methods->read(f, buf, count);
00092 }
00093
00094 off_t raw_filesize(IOFileRef f)
00095 {
00096 return f->methods->filesize(f);
00097 }
00098
00099 void *raw_mmap(IOFileRef f, size_t l, off_t offset)
00100 {
00101 return f->methods->mmap(f, l, offset);
00102 }
00103
00104
00105 int raw_munmap(IOFileRef f, void *addr, size_t l)
00106 {
00107 return f->methods->munmap(f, addr, l);
00108 }
00109
00110
00116 int raw_get_error(IOFileRef f)
00117 {
00118 return f->error;
00119 }
00120
00121
00130 char *raw_get_path(IOFileRef f)
00131 {
00132 return f->path;
00133 }
00134
00135
00136 #ifdef __cplusplus
00137 };
00138 #endif
00139