1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-15 11:41:13 +03:00

Refactoring the VFS-SHM methods used by WAL. This version compiles and

runs non-WAL test cases but crashes and burns on wal.test.

FossilOrigin-Name: 2b00152c1ac0b3735aa6cfab61259ff04d81c701
This commit is contained in:
drh
2010-05-12 18:01:39 +00:00
parent eaf52d883a
commit d9e5c4f6ed
16 changed files with 1061 additions and 1045 deletions

View File

@@ -68,13 +68,6 @@ static int devsymRandomness(sqlite3_vfs*, int nByte, char *zOut);
static int devsymSleep(sqlite3_vfs*, int microseconds);
static int devsymCurrentTime(sqlite3_vfs*, double*);
static int devsymShmOpen(sqlite3_vfs *, const char *, sqlite3_shm **);
static int devsymShmSize(sqlite3_vfs*, sqlite3_shm *, int , int *);
static int devsymShmGet(sqlite3_vfs*, sqlite3_shm *, int , int *, void **);
static int devsymShmRelease(sqlite3_vfs*, sqlite3_shm *);
static int devsymShmLock(sqlite3_vfs*, sqlite3_shm *, int , int *);
static int devsymShmClose(sqlite3_vfs*, sqlite3_shm *, int);
static sqlite3_vfs devsym_vfs = {
2, /* iVersion */
sizeof(devsym_file), /* szOsFile */
@@ -101,18 +94,12 @@ static sqlite3_vfs devsym_vfs = {
devsymSleep, /* xSleep */
devsymCurrentTime, /* xCurrentTime */
0, /* xGetLastError */
devsymShmOpen,
devsymShmSize,
devsymShmGet,
devsymShmRelease,
devsymShmLock,
devsymShmClose,
0,
0,
0, /* xRename */
0 /* xCurrentTimeInt64 */
};
static sqlite3_io_methods devsym_io_methods = {
1, /* iVersion */
2, /* iVersion */
devsymClose, /* xClose */
devsymRead, /* xRead */
devsymWrite, /* xWrite */
@@ -124,7 +111,13 @@ static sqlite3_io_methods devsym_io_methods = {
devsymCheckReservedLock, /* xCheckReservedLock */
devsymFileControl, /* xFileControl */
devsymSectorSize, /* xSectorSize */
devsymDeviceCharacteristics /* xDeviceCharacteristics */
devsymDeviceCharacteristics, /* xDeviceCharacteristics */
0, /* xShmOpen */
0, /* xShmSize */
0, /* xShmGet */
0, /* xShmRelease */
0, /* xShmLock */
0 /* xShmClose */
};
struct DevsymGlobal {
@@ -350,45 +343,6 @@ static int devsymCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
}
static int devsymShmOpen(
sqlite3_vfs *pVfs,
const char *zName,
sqlite3_shm **pp
){
return g.pVfs->xShmOpen(g.pVfs, zName, pp);
}
static int devsymShmSize(
sqlite3_vfs *pVfs,
sqlite3_shm *p,
int reqSize,
int *pNewSize
){
return g.pVfs->xShmSize(g.pVfs, p, reqSize, pNewSize);
}
static int devsymShmGet(
sqlite3_vfs *pVfs,
sqlite3_shm *p,
int reqMapSize,
int *pMapSize,
void **pp
){
return g.pVfs->xShmGet(g.pVfs, p, reqMapSize, pMapSize, pp);
}
static int devsymShmRelease(sqlite3_vfs *pVfs, sqlite3_shm *p){
return g.pVfs->xShmRelease(g.pVfs, p);
}
static int devsymShmLock(
sqlite3_vfs *pVfs,
sqlite3_shm *p,
int desiredLock,
int *gotLock
){
return g.pVfs->xShmLock(g.pVfs, p, desiredLock, gotLock);
}
static int devsymShmClose(sqlite3_vfs *pVfs, sqlite3_shm *p, int deleteFlag){
return g.pVfs->xShmClose(g.pVfs, p, deleteFlag);
}
/*
** This procedure registers the devsym vfs with SQLite. If the argument is
** true, the devsym vfs becomes the new default vfs. It is the only publicly
@@ -398,12 +352,6 @@ void devsym_register(int iDeviceChar, int iSectorSize){
if( g.pVfs==0 ){
g.pVfs = sqlite3_vfs_find(0);
devsym_vfs.szOsFile += g.pVfs->szOsFile;
devsym_vfs.xShmOpen = (g.pVfs->xShmOpen ? devsymShmOpen : 0);
devsym_vfs.xShmSize = (g.pVfs->xShmSize ? devsymShmSize : 0);
devsym_vfs.xShmGet = (g.pVfs->xShmGet ? devsymShmGet : 0);
devsym_vfs.xShmRelease = (g.pVfs->xShmRelease ? devsymShmRelease : 0);
devsym_vfs.xShmLock = (g.pVfs->xShmLock ? devsymShmLock : 0);
devsym_vfs.xShmClose = (g.pVfs->xShmClose ? devsymShmClose : 0);
sqlite3_vfs_register(&devsym_vfs, 0);
}
if( iDeviceChar>=0 ){