mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Add xShmXXX() methods to the test VFS in test_devsym.test.
FossilOrigin-Name: 1d20342424b452ea96aaf161de1f98f26a9155a0
This commit is contained in:
@@ -68,8 +68,16 @@ 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_shm *, int , int *);
|
||||
static int devsymShmGet(sqlite3_shm *, int , int *, void **);
|
||||
static int devsymShmRelease(sqlite3_shm *);
|
||||
static int devsymShmLock(sqlite3_shm *, int , int *);
|
||||
static int devsymShmClose(sqlite3_shm *);
|
||||
static int devsymShmDelete(sqlite3_vfs *, const char *);
|
||||
|
||||
static sqlite3_vfs devsym_vfs = {
|
||||
1, /* iVersion */
|
||||
2, /* iVersion */
|
||||
sizeof(devsym_file), /* szOsFile */
|
||||
DEVSYM_MAX_PATHNAME, /* mxPathname */
|
||||
0, /* pNext */
|
||||
@@ -93,6 +101,18 @@ static sqlite3_vfs devsym_vfs = {
|
||||
devsymRandomness, /* xRandomness */
|
||||
devsymSleep, /* xSleep */
|
||||
devsymCurrentTime, /* xCurrentTime */
|
||||
0, /* xGetLastError */
|
||||
devsymShmOpen,
|
||||
devsymShmSize,
|
||||
devsymShmGet,
|
||||
devsymShmRelease,
|
||||
0,
|
||||
0,
|
||||
devsymShmLock,
|
||||
devsymShmClose,
|
||||
devsymShmDelete,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
static sqlite3_io_methods devsym_io_methods = {
|
||||
@@ -333,6 +353,38 @@ static int devsymCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
|
||||
return sqlite3OsCurrentTime(g.pVfs, 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_shm *p, int reqSize, int *pNewSize){
|
||||
return g.pVfs->xShmSize(p, reqSize, pNewSize);
|
||||
}
|
||||
static int devsymShmGet(
|
||||
sqlite3_shm *p,
|
||||
int reqMapSize,
|
||||
int *pMapSize,
|
||||
void **pp
|
||||
){
|
||||
return g.pVfs->xShmGet(p, reqMapSize, pMapSize, pp);
|
||||
}
|
||||
static int devsymShmRelease(sqlite3_shm *p){
|
||||
return g.pVfs->xShmRelease(p);
|
||||
}
|
||||
static int devsymShmLock(sqlite3_shm *p, int desiredLock, int *gotLock){
|
||||
return g.pVfs->xShmLock(p, desiredLock, gotLock);
|
||||
}
|
||||
static int devsymShmClose(sqlite3_shm *p){
|
||||
return g.pVfs->xShmClose(p);
|
||||
}
|
||||
static int devsymShmDelete(sqlite3_vfs *pVfs, const char *zName){
|
||||
return g.pVfs->xShmDelete(g.pVfs, zName);
|
||||
}
|
||||
|
||||
/*
|
||||
** 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
|
||||
@@ -342,6 +394,13 @@ 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);
|
||||
devsym_vfs.xShmDelete = (g.pVfs->xShmDelete ? devsymShmDelete : 0);
|
||||
sqlite3_vfs_register(&devsym_vfs, 0);
|
||||
}
|
||||
if( iDeviceChar>=0 ){
|
||||
|
||||
Reference in New Issue
Block a user