00001
00002
00003
00004
00005
00006
00007 #ifndef _NCIO_H_
00008 #define _NCIO_H_
00009
00010 #include <stddef.h>
00011 #include <sys/types.h>
00012 #include "netcdf.h"
00013
00014 typedef struct ncio ncio;
00015
00016
00017
00018
00019 #define OFF_NONE ((off_t)(-1))
00020
00021
00022
00023
00024
00025 #define RGN_NOLOCK 0x1
00026
00027
00028
00029 #define RGN_NOWAIT 0x2
00030
00031 #define RGN_WRITE 0x4
00032
00033 #define RGN_MODIFIED 0x8
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 typedef int ncio_relfunc(ncio *const nciop,
00047 off_t offset, int rflags);
00048
00049
00050
00051
00052
00053 typedef int ncio_getfunc(ncio *const nciop,
00054 off_t offset, size_t extent,
00055 int rflags,
00056 void **const vpp);
00057
00058
00059
00060
00061
00062 typedef int ncio_movefunc(ncio *const nciop, off_t to, off_t from,
00063 size_t nbytes, int rflags);
00064
00065
00066
00067
00068
00069 typedef int ncio_syncfunc(ncio *const nciop);
00070
00071
00072
00073
00074
00075
00076 typedef void ncio_freefunc(void *const pvt);
00077
00078
00079 #if defined(__cplusplus)
00080 #define NCIO_CONST
00081 #else
00082 #define NCIO_CONST const
00083 #endif
00084
00085
00086
00087
00088 struct ncio {
00089
00090
00091
00092
00093 int ioflags;
00094
00095
00096
00097
00098
00099 NCIO_CONST int fd;
00100
00101
00102
00103 ncio_relfunc *NCIO_CONST rel;
00104
00105 ncio_getfunc *NCIO_CONST get;
00106
00107 ncio_movefunc *NCIO_CONST move;
00108
00109 ncio_syncfunc *NCIO_CONST sync;
00110
00111 ncio_freefunc *NCIO_CONST free;
00112
00113
00114
00115
00116
00117
00118 const char *path;
00119
00120
00121 void *NCIO_CONST pvt;
00122 };
00123
00124 #undef NCIO_CONST
00125
00126 extern int
00127 ncio_create(const char *path, int ioflags,
00128 size_t initialsz,
00129 off_t igeto, size_t igetsz, size_t *sizehintp,
00130 ncio **nciopp, void **const igetvpp);
00131
00132 extern int
00133 ncio_open(const char *path,
00134 int ioflags,
00135 off_t igeto, size_t igetsz, size_t *sizehintp,
00136 ncio **nciopp, void **const igetvpp);
00137
00138 extern int
00139 ncio_close(ncio *nciop, int doUnlink);
00140
00141 extern int
00142 ncio_filesize(ncio *nciop, off_t *filesizep);
00143
00144 extern int
00145 ncio_pad_length(ncio *nciop, off_t length);
00146
00147 #endif