]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the vfstrace.c extension so that it supports xFetch and xUnfetch.
authordrh <>
Wed, 1 Jan 2025 12:24:01 +0000 (12:24 +0000)
committerdrh <>
Wed, 1 Jan 2025 12:24:01 +0000 (12:24 +0000)
FossilOrigin-Name: c7132b7e62422378f0560dcf0837888db5aa70cded9d783ab389581aa43dc5c8

ext/misc/vfstrace.c
manifest
manifest.uuid

index e8b51cdd039d4b4f246826ca62c77cd105230ea6..fed87e88f3e8370ade174b570d9fcf66adb4c8cf 100644 (file)
@@ -188,6 +188,7 @@ struct vfstrace_file {
 #define VTR_SLEEP           0x02000000
 #define VTR_CURTIME         0x04000000
 #define VTR_LASTERR         0x08000000
+#define VTR_FETCH           0x10000000   /* Also coverse xUnfetch */
 
 /*
 ** Method declarations for vfstrace_file.
@@ -617,6 +618,7 @@ static int vfstraceFileControl(sqlite3_file *pFile, int op, void *pArg){
             { "currenttime",           VTR_CURTIME  },
             { "currenttimeint64",      VTR_CURTIME  },
             { "getlasterror",          VTR_LASTERR  },
+            { "fetch",                 VTR_FETCH    },
           };
           int onOff = 1;
           while( zArg[0] ){
@@ -844,7 +846,28 @@ static int vfstraceShmUnmap(sqlite3_file *pFile, int delFlag){
   vfstrace_print_errcode(pInfo, " -> %s\n", rc);
   return rc;
 }
-
+static int vfstraceFetch(sqlite3_file *pFile, i64 iOff, int nAmt, void **pptr){
+  vfstrace_file *p = (vfstrace_file *)pFile;
+  vfstrace_info *pInfo = p->pInfo;
+  int rc;
+  vfstraceOnOff(pInfo, VTR_FETCH);
+  vfstrace_printf(pInfo, "%s.xFetch(%s,iOff=%lld,nAmt=%d,p=%p)",
+                  pInfo->zVfsName, p->zFName, iOff, nAmt, *pptr);
+  rc = p->pReal->pMethods->xFetch(p->pReal, iOff, nAmt, pptr);
+  vfstrace_print_errcode(pInfo, " -> %s\n", rc);
+  return rc;
+}
+static int vfstraceUnfetch(sqlite3_file *pFile, i64 iOff, void *ptr){
+  vfstrace_file *p = (vfstrace_file *)pFile;
+  vfstrace_info *pInfo = p->pInfo;
+  int rc;
+  vfstraceOnOff(pInfo, VTR_FETCH);
+  vfstrace_printf(pInfo, "%s.xUnfetch(%s,iOff=%lld,p=%p)",
+                  pInfo->zVfsName, p->zFName, iOff, ptr);
+  rc = p->pReal->pMethods->xUnfetch(p->pReal, iOff, ptr);
+  vfstrace_print_errcode(pInfo, " -> %s\n", rc);
+  return rc;
+}
 
 
 /*
@@ -891,6 +914,10 @@ static int vfstraceOpen(
       pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
       pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
     }
+    if( pNew->iVersion>=3 ){
+      pNew->xFetch = pSub->xFetch ? vfstraceFetch : 0;
+      pNew->xUnfetch = pSub->xUnfetch ? vfstraceUnfetch : 0;
+    }
     pFile->pMethods = pNew;
   }
   vfstrace_print_errcode(pInfo, " -> %s", rc);
index 2f45824ace00dba2bc3c659c9f9e7ae862bfb306..72166caccb0fb3b71fce6f387f2c0ad436dcbeb8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sconvenience\smakefile\starget\s(unix-only)\s"src-archives"\sthat\sbuilds\nthe\svarious\starballs\sand\sZIP\sarchives\sthat\sgo\son\sthe\sdownload\spage.\s\sThis\sis\nintended\sto\smake\sit\seasier\sand\sless\serror\sprone\sto\sput\sup\snew\s"draft"\sdownload\npages\sfor\stesting.
-D 2024-12-30T21:23:53.148
+C Fix\sthe\svfstrace.c\sextension\sso\sthat\sit\ssupports\sxFetch\sand\sxUnfetch.
+D 2025-01-01T12:24:01.620
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -453,7 +453,7 @@ F ext/misc/urifuncs.c f71360d14fa9e7626b563f1f781c6148109462741c5235ac63ae0f8917
 F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf
 F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20
 F ext/misc/vfsstat.c a85df08654743922a19410d7b1e3111de41bb7cd07d20dd16eda4e2b808d269d
-F ext/misc/vfstrace.c 4d8b39570cbede1a05928c77e2142f8a744468443bf649cf86da3924e5e60fca
+F ext/misc/vfstrace.c 9c4abd2f67ae2760e7a241eca2e8517c64480ac2c3e66a499326e688a9bbee22
 F ext/misc/vtablog.c 1100250ce8782db37c833e3a9a5c9a3ecf1af5e15b8325572b82e6e0a138ffb5
 F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
 F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f65b4fc0668
@@ -2204,8 +2204,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 7cd8ccf57d1ae0f597ec5004201395f61ef4750728f3c1b9c4dd52d28916a4f7
-R f56cb98bdebf27e28da45a1d08491799
+P 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552
+R 1a7b3740d0d7b0156ecda7d86d9b3eae
 U drh
-Z 0ad30bdc3b0bb40aad0de043d83aa269
+Z ba39083b8910dae572ba02a04ab64577
 # Remove this line to create a well-formed Fossil manifest.
index 60af8413577f5ca0784efe6fd61d876025c5acf7..1eb7acbbfc78dd23690c62fc934a2fa7843b699c 100644 (file)
@@ -1 +1 @@
-2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552
+c7132b7e62422378f0560dcf0837888db5aa70cded9d783ab389581aa43dc5c8