@@ -130,3 +130,81 @@ int sqlite3_auto_extension(void *xEntryPoint);
130130
131131// Database configuration
132132int sqlite3_db_config (sqlite3 * db , int op , ...);
133+
134+ // VFS
135+ typedef struct sqlite3_file sqlite3_file ;
136+
137+ struct sqlite3_io_methods {
138+ int iVersion ;
139+ int (* xClose )(sqlite3_file * );
140+ int (* xRead )(sqlite3_file * , void * , int iAmt , int64_t iOfst );
141+ int (* xWrite )(sqlite3_file * , const void * , int iAmt , int64_t iOfst );
142+ int (* xTruncate )(sqlite3_file * , int64_t size );
143+ int (* xSync )(sqlite3_file * , int flags );
144+ int (* xFileSize )(sqlite3_file * , int64_t * pSize );
145+ int (* xLock )(sqlite3_file * , int );
146+ int (* xUnlock )(sqlite3_file * , int );
147+ int (* xCheckReservedLock )(sqlite3_file * , int * pResOut );
148+ int (* xFileControl )(sqlite3_file * , int op , void * pArg );
149+ int (* xSectorSize )(sqlite3_file * );
150+ int (* xDeviceCharacteristics )(sqlite3_file * );
151+ /* Methods above are valid for version 1 */
152+ int (* xShmMap )(sqlite3_file * , int iPg , int pgsz , int , void * * );
153+ int (* xShmLock )(sqlite3_file * , int offset , int n , int flags );
154+ void (* xShmBarrier )(sqlite3_file * );
155+ int (* xShmUnmap )(sqlite3_file * , int deleteFlag );
156+ /* Methods above are valid for version 2 */
157+ int (* xFetch )(sqlite3_file * , int64_t iOfst , int iAmt , void * * pp );
158+ int (* xUnfetch )(sqlite3_file * , int64_t iOfst , void * p );
159+ /* Methods above are valid for version 3 */
160+ /* Additional methods may be added in future releases */
161+ };
162+
163+ struct sqlite3_file {
164+ const struct sqlite3_io_methods * pMethods ; /* Methods for an open file */
165+ };
166+
167+ typedef struct sqlite3_vfs sqlite3_vfs ;
168+ typedef void (* sqlite3_syscall_ptr )(void );
169+ typedef const char * sqlite3_filename ;
170+
171+ struct sqlite3_vfs {
172+ int iVersion ; /* Structure version number (currently 3) */
173+ int szOsFile ; /* Size of subclassed sqlite3_file */
174+ int mxPathname ; /* Maximum file pathname length */
175+ sqlite3_vfs * pNext ; /* Next registered VFS */
176+ const char * zName ; /* Name of this virtual file system */
177+ void * pAppData ; /* Pointer to application-specific data */
178+ int (* xOpen )(sqlite3_vfs * , sqlite3_filename zName , sqlite3_file * ,
179+ int flags , int * pOutFlags );
180+ int (* xDelete )(sqlite3_vfs * , const char * zName , int syncDir );
181+ int (* xAccess )(sqlite3_vfs * , const char * zName , int flags , int * pResOut );
182+ int (* xFullPathname )(sqlite3_vfs * , const char * zName , int nOut , char * zOut );
183+ void * (* xDlOpen )(sqlite3_vfs * , const char * zFilename );
184+ void (* xDlError )(sqlite3_vfs * , int nByte , char * zErrMsg );
185+ void (* (* xDlSym )(sqlite3_vfs * ,void * , const char * zSymbol ))(void );
186+ void (* xDlClose )(sqlite3_vfs * , void * );
187+ int (* xRandomness )(sqlite3_vfs * , int nByte , char * zOut );
188+ int (* xSleep )(sqlite3_vfs * , int microseconds );
189+ int (* xCurrentTime )(sqlite3_vfs * , double * );
190+ int (* xGetLastError )(sqlite3_vfs * , int , char * );
191+ /*
192+ ** The methods above are in version 1 of the sqlite_vfs object
193+ ** definition. Those that follow are added in version 2 or later
194+ */
195+ int (* xCurrentTimeInt64 )(sqlite3_vfs * , int64_t * );
196+ /*
197+ ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
198+ ** Those below are for version 3 and greater.
199+ */
200+ int (* xSetSystemCall )(sqlite3_vfs * , const char * zName , sqlite3_syscall_ptr );
201+ sqlite3_syscall_ptr (* xGetSystemCall )(sqlite3_vfs * , const char * zName );
202+ const char * (* xNextSystemCall )(sqlite3_vfs * , const char * zName );
203+ /*
204+ ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
205+ ** New fields may be appended in future versions. The iVersion
206+ ** value will increment whenever this happens.
207+ */
208+ };
209+ int sqlite3_vfs_register (sqlite3_vfs * , int makeDflt );
210+ int sqlite3_vfs_unregister (sqlite3_vfs * );
0 commit comments