]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the VFS definition so that all methods take a VFS object pointer as
authordrh <drh@noemail.net>
Mon, 3 May 2010 16:30:27 +0000 (16:30 +0000)
committerdrh <drh@noemail.net>
Mon, 3 May 2010 16:30:27 +0000 (16:30 +0000)
their first parameter.

FossilOrigin-Name: 43b5b07f0d996d7ef7426346b1792e9ca898f487

manifest
manifest.uuid
src/os_unix.c
src/sqlite.h.in
src/test_devsym.c
src/wal.c

index 60ab7c14b6a41931c2c591cc4d6d0dfb8488a7a3..2fadc888b3f09c3820bdb6771d9286ba556c14be 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,8 @@
-C Have\ssqlite3_wal_checkpoint()\shandle\sa\szero-length\sstring\sin\sthe\ssame\sway\sas\sa\sNULL\spointer.\sFix\s"PRAGMA\swal_checkpoint"\sso\sthat\sit\scheckpoints\sall\sattached\sdatabases.
-D 2010-05-03T15:58:51
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Change\sthe\sVFS\sdefinition\sso\sthat\sall\smethods\stake\sa\sVFS\sobject\spointer\sas\ntheir\sfirst\sparameter.
+D 2010-05-03T16:30:27
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -150,7 +153,7 @@ F src/os.c aec6922553585a25d5655666defc125a7e217674
 F src/os.h b389844e5469a2918e8a45fe6ae52b4c28dfb2b2
 F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d
 F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0
-F src/os_unix.c f3c0faad1c6de4f06f5ec30d586a4e62a980dc6f
+F src/os_unix.c 7d706a3a50818271f01020864eb9a777b14d5299
 F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1
 F src/pager.c e9c7fe979b32a3c5bf4216d8fbe1cf8beff8a1b8
 F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c
@@ -166,7 +169,7 @@ F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
 F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b
 F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
-F src/sqlite.h.in 8097161ad63e2a00e26217da43327d396371c2e5
+F src/sqlite.h.in 409c5a6df42a54122d2bf8a0e2cfdad29f60f462
 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
 F src/sqliteInt.h e7f1368eb56d8a410e510bcffb9ca5795060c58c
 F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
@@ -188,7 +191,7 @@ F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
 F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
 F src/test_config.c 6210f501d358bde619ae761f06f123529c6ba24f
 F src/test_demovfs.c da81a5f7785bb352bda7911c332a983ec4f17f27
-F src/test_devsym.c 2160798b2dbd7bfa6225a70c31283ef9a097660a
+F src/test_devsym.c 257adf02150986902f1f15b478f8a319ecfce7f3
 F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20
 F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2
 F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
@@ -221,7 +224,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
 F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
-F src/wal.c dadd533e0103883f72bf541eaf1ef34adb4e3c99
+F src/wal.c 5face3be0769d3a60d77fcde31bffabd27e93d9b
 F src/wal.h d6d4a6809151e30bed5b01dd05cf27858f5a7bc8
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
 F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
@@ -808,7 +811,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ab77b3ae6da3370d8bc3b2c9c0edc723b69f5a95
-R 295bc2b46c703594035744e018f208b3
-U dan
-Z 92ca3ad74429d3d61c41c53f30e242bb
+P 7fecd21f45b9ce773ffbcef6c84066474e8cd01c
+R 8a081f2aa3260ab8e76808d511399703
+U drh
+Z 272c621824fe58d9bb0901b6611e7d18
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFL3vomoxKgR168RlERAtVAAKCH2h/fK4tE1+G5sUz8teeCt8g18QCfUvK9
+AwV097UC6aXg4MmFLWuxDEo=
+=xXDB
+-----END PGP SIGNATURE-----
index 2fb075b68e3e5d3b4703cb1f0dd877218f35f033..7bf37588f149d113bcd4fa313271206f6b866d6a 100644 (file)
@@ -1 +1 @@
-7fecd21f45b9ce773ffbcef6c84066474e8cd01c
\ No newline at end of file
+43b5b07f0d996d7ef7426346b1792e9ca898f487
\ No newline at end of file
index cb3e19009a496ad338b50e4cbeb3d66df9f63d0f..ad95c10164f6b27d81ab1e96bbc510d811ef857c 100644 (file)
@@ -5072,11 +5072,16 @@ shm_open_err:
 ** Close a connection to shared-memory.  Delete the underlying 
 ** storage if deleteFlag is true.
 */
-static int unixShmClose(sqlite3_shm *pSharedMem, int deleteFlag){
+static int unixShmClose(
+  sqlite3_vfs *pVfs,         /* The VFS */
+  sqlite3_shm *pSharedMem,   /* The shared-memory to be closed */
+  int deleteFlag             /* Delete after closing if true */
+){
   unixShm *p;            /* The connection to be closed */
   unixShmFile *pFile;    /* The underlying shared-memory file */
   unixShm **pp;          /* For looping over sibling connections */
 
+  UNUSED_PARAMETER(pVfs);
   if( pSharedMem==0 ) return SQLITE_OK;
   p = (struct unixShm*)pSharedMem;
   pFile = p->pFile;
@@ -5123,6 +5128,7 @@ static int unixShmClose(sqlite3_shm *pSharedMem, int deleteFlag){
 ** is free to expand the storage to some larger amount if it chooses.
 */
 static int unixShmSize(
+  sqlite3_vfs *pVfs,        /* The VFS */
   sqlite3_shm *pSharedMem,  /* Pointer returned by unixShmOpen() */
   int reqSize,              /* Requested size.  -1 for query only */
   int *pNewSize             /* Write new size here */
@@ -5132,6 +5138,8 @@ static int unixShmSize(
   int rc = SQLITE_OK;
   struct stat sStat;
 
+  UNUSED_PARAMETER(pVfs);
+
   if( reqSize>=0 ){
     reqSize = (reqSize + SQLITE_UNIX_SHM_INCR - 1)/SQLITE_UNIX_SHM_INCR;
     reqSize *= SQLITE_UNIX_SHM_INCR;
@@ -5174,6 +5182,7 @@ static int unixShmSize(
 ** yet been allocated to the underlying storage.
 */
 static int unixShmGet(
+  sqlite3_vfs *pVfs,       /* The VFS */
   sqlite3_shm *pSharedMem, /* Pointer returned by unixShmOpen() */
   int reqMapSize,          /* Requested size of mapping. -1 means don't care */
   int *pNewMapSize,        /* Write new size of mapping here */
@@ -5191,7 +5200,7 @@ static int unixShmGet(
   sqlite3_mutex_enter(pFile->mutex);
   if( pFile->szMap==0 || reqMapSize>pFile->szMap ){
     int actualSize;
-    if( unixShmSize(pSharedMem, -1, &actualSize)==SQLITE_OK
+    if( unixShmSize(pVfs, pSharedMem, -1, &actualSize)==SQLITE_OK
      && reqMapSize<actualSize
     ){
       reqMapSize = actualSize;
@@ -5219,8 +5228,9 @@ static int unixShmGet(
 ** really want to release the lock, so in that case too, this routine
 ** is a no-op.
 */
-static int unixShmRelease(sqlite3_shm *pSharedMem){
+static int unixShmRelease(sqlite3_vfs *pVfs, sqlite3_shm *pSharedMem){
   unixShm *p = (unixShm*)pSharedMem;
+  UNUSED_PARAMETER(pVfs);
   if( p->hasMutexBuf && p->lockState!=SQLITE_SHM_RECOVER ){
     unixShmFile *pFile = p->pFile;
     assert( sqlite3_mutex_notheld(pFile->mutex) );
@@ -5250,6 +5260,7 @@ static const char *azLkName[] = {
 ** Change the lock state for a shared-memory segment.
 */
 static int unixShmLock(
+  sqlite3_vfs *pVfs,         /* The VFS */
   sqlite3_shm *pSharedMem,   /* Pointer from unixShmOpen() */
   int desiredLock,           /* One of SQLITE_SHM_xxxxx locking states */
   int *pGotLock              /* The lock you actually got */
@@ -5258,6 +5269,8 @@ static int unixShmLock(
   unixShmFile *pFile = p->pFile;
   int rc = SQLITE_PROTOCOL;
 
+  UNUSED_PARAMETER(pVfs);
+
   /* Note that SQLITE_SHM_READ_FULL and SQLITE_SHM_PENDING are never
   ** directly requested; they are side effects from requesting
   ** SQLITE_SHM_READ and SQLITE_SHM_CHECKPOINT, respectively.
index fab90180dd16ea332cb859ef25f892db682a1ff8..f31c10ec283cf4cd20fa6ad3af284ca270394fe6 100644 (file)
@@ -844,11 +844,11 @@ struct sqlite3_vfs {
   ** definition.  Those that follow are added in version 2 or later
   */
   int (*xShmOpen)(sqlite3_vfs*, const char *zName, sqlite3_shm**);
-  int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize);
-  int (*xShmGet)(sqlite3_shm*, int reqMapSize, int *pMapSize, void**);
-  int (*xShmRelease)(sqlite3_shm*);
-  int (*xShmLock)(sqlite3_shm*, int desiredLock, int *gotLock);
-  int (*xShmClose)(sqlite3_shm*, int deleteFlag);
+  int (*xShmSize)(sqlite3_vfs*, sqlite3_shm*, int reqSize, int *pNewSize);
+  int (*xShmGet)(sqlite3_vfs*, sqlite3_shm*, int reqSize, int *pSize, void**);
+  int (*xShmRelease)(sqlite3_vfs*, sqlite3_shm*);
+  int (*xShmLock)(sqlite3_vfs*, sqlite3_shm*, int desiredLock, int *gotLock);
+  int (*xShmClose)(sqlite3_vfs*, sqlite3_shm*, int deleteFlag);
   int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync);
   int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
   /*
index 118af8b08f07cfc889d5ecbb37e42f7abb89955d..082d101d4e78268c130adcd040e5e055a3ef189d 100644 (file)
@@ -69,11 +69,11 @@ 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 *, int);
+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 */
@@ -357,25 +357,36 @@ static int devsymShmOpen(
 ){
   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 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(p, reqMapSize, pMapSize, pp);
+  return g.pVfs->xShmGet(g.pVfs, p, reqMapSize, pMapSize, pp);
 }
-static int devsymShmRelease(sqlite3_shm *p){
-  return g.pVfs->xShmRelease(p);
+static int devsymShmRelease(sqlite3_vfs *pVfs, sqlite3_shm *p){
+  return g.pVfs->xShmRelease(g.pVfs, p);
 }
-static int devsymShmLock(sqlite3_shm *p, int desiredLock, int *gotLock){
-  return g.pVfs->xShmLock(p, desiredLock, gotLock);
+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_shm *p, int deleteFlag){
-  return g.pVfs->xShmClose(p, deleteFlag);
+static int devsymShmClose(sqlite3_vfs *pVfs, sqlite3_shm *p, int deleteFlag){
+  return g.pVfs->xShmClose(g.pVfs, p, deleteFlag);
 }
 
 /*
index 071521001fa3e7d861ca1f28fc414e3a48f03910..f412a39e48617623ff485f30043b2352654a4792 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -219,7 +219,7 @@ static void walChecksumBytes(u8 *aByte, int nByte, u32 *aCksum){
 static int walSetLock(Wal *pWal, int desiredStatus){
   int rc, got;
   if( pWal->lockState==desiredStatus ) return SQLITE_OK;
-  rc = pWal->pVfs->xShmLock(pWal->pWIndex, desiredStatus, &got);
+  rc = pWal->pVfs->xShmLock(pWal->pVfs, pWal->pWIndex, desiredStatus, &got);
   pWal->lockState = got;
   if( got==SQLITE_SHM_READ_FULL || got==SQLITE_SHM_READ ){
     pWal->readerType = got;
@@ -375,7 +375,7 @@ static int walIndexEntry(u32 iFrame){
 */
 static void walIndexUnmap(Wal *pWal){
   if( pWal->pWiData ){
-    pWal->pVfs->xShmRelease(pWal->pWIndex);
+    pWal->pVfs->xShmRelease(pWal->pVfs, pWal->pWIndex);
     pWal->pWiData = 0;
   }
 }
@@ -390,8 +390,8 @@ static void walIndexUnmap(Wal *pWal){
 static int walIndexMap(Wal *pWal, int reqSize){
   int rc = SQLITE_OK;
   if( pWal->pWiData==0 ){
-    rc = pWal->pVfs->xShmGet(pWal->pWIndex, reqSize, &pWal->szWIndex,
-                             (void**)(char*)&pWal->pWiData);
+    rc = pWal->pVfs->xShmGet(pWal->pVfs, pWal->pWIndex, reqSize,
+                             &pWal->szWIndex, (void**)(char*)&pWal->pWiData);
     if( rc==SQLITE_OK && pWal->pWiData==0 ){
       /* Make sure pWal->pWiData is not NULL while we are holding the
       ** lock on the mapping. */
@@ -412,7 +412,7 @@ static int walIndexMap(Wal *pWal, int reqSize){
 static int walIndexRemap(Wal *pWal, int enlargeTo){
   int rc;
   int sz;
-  rc = pWal->pVfs->xShmSize(pWal->pWIndex, enlargeTo, &sz);
+  rc = pWal->pVfs->xShmSize(pWal->pVfs, pWal->pWIndex, enlargeTo, &sz);
   if( rc==SQLITE_OK && sz>pWal->szWIndex ){
     walIndexUnmap(pWal);
     rc = walIndexMap(pWal, sz);
@@ -607,7 +607,7 @@ int sqlite3WalOpen(
 wal_open_out:
   if( rc!=SQLITE_OK ){
     if( pRet ){
-      pVfs->xShmClose(pRet->pWIndex, 0);
+      pVfs->xShmClose(pVfs, pRet->pWIndex, 0);
       sqlite3OsClose(pRet->pFd);
       sqlite3_free(pRet);
     }
@@ -805,7 +805,7 @@ int sqlite3WalClose(
       walIndexUnmap(pWal);
     }
 
-    pWal->pVfs->xShmClose(pWal->pWIndex, isDelete);
+    pWal->pVfs->xShmClose(pWal->pVfs, pWal->pWIndex, isDelete);
     sqlite3OsClose(pWal->pFd);
     if( isDelete ){
       sqlite3OsDelete(pWal->pVfs, pWal->zName, 0);