00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __LIBOPENRAW_IO_H
00022 #define __LIBOPENRAW_IO_H
00023
00024 #include <sys/types.h>
00025 #include <unistd.h>
00026 #include <fcntl.h>
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032
00034 typedef struct _IOFile *IOFileRef;
00035
00036
00038 struct io_methods {
00042 IOFileRef (*open)(const char *path, int mode);
00044 int (*close) (IOFileRef f);
00046 int (*seek) (IOFileRef f, off_t offset, int whence);
00048 int (*read) (IOFileRef f, void *buf, size_t count);
00049
00050 off_t (*filesize) (IOFileRef f);
00051 void* (*mmap) (IOFileRef f, size_t l, off_t offset);
00052 int (*munmap) (IOFileRef f, void *addr, size_t l);
00053 };
00054
00055 extern struct io_methods* get_default_io_methods(void);
00056
00057 extern IOFileRef raw_open(struct io_methods * methods, const char *path,
00058 int mode);
00059 extern int raw_close(IOFileRef f);
00060 extern int raw_seek(IOFileRef f, off_t offset, int whence);
00061 extern int raw_read(IOFileRef f, void *buf, size_t count);
00062 extern off_t raw_filesize(IOFileRef f);
00063 extern void *raw_mmap(IOFileRef f, size_t l, off_t offset);
00064 extern int raw_munmap(IOFileRef f, void *addr, size_t l);
00065
00066 extern int raw_get_error(IOFileRef f);
00067 extern char *raw_get_path(IOFileRef f);
00068
00069
00070 #ifdef __cplusplus
00071 }
00072 #endif
00073
00074
00075
00076 #endif