diff options
author | danielk1977 <danielk1977@noemail.net> | 2007-08-20 14:23:44 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2007-08-20 14:23:44 +0000 |
commit | 967a4a1c965df8f55576617d8f4a42e9e2783a08 (patch) | |
tree | 12171c307ebc4b65dfbeccf2f52f1c54102b15d7 /src/os_unix.c | |
parent | abddb0c8c4121e6ad338fa27128b4b32a4072bb9 (diff) | |
download | sqlite-967a4a1c965df8f55576617d8f4a42e9e2783a08.tar.gz sqlite-967a4a1c965df8f55576617d8f4a42e9e2783a08.zip |
Changes to crash-test io backend (test6.c) so that it works with the sqlite3_vfs interface. (CVS 4247)
FossilOrigin-Name: 40f66ada815fa1043d24c9cd6d898e1797e7044a
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index f1575562e..828bbfd62 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -87,6 +87,12 @@ typedef struct unixFile unixFile; struct unixFile { sqlite3_io_methods const *pMethod; /* Always the first entry */ +#ifdef SQLITE_TEST + /* In test mode, increase the size of this structure a bit so that + ** it is larger than the struct CrashFile defined in test6.c. + */ + char aPadding[32]; +#endif struct openCnt *pOpen; /* Info about all open fd's on this inode */ struct lockInfo *pLock; /* Info about locks on this inode */ #ifdef SQLITE_ENABLE_LOCKING_STYLE @@ -96,32 +102,11 @@ struct unixFile { unsigned char locktype; /* The type of lock held on this fd */ unsigned char isOpen; /* True if needs to be closed */ int dirfd; /* File descriptor for the directory */ - i64 offset; /* Seek offset */ #ifdef SQLITE_UNIX_THREADS pthread_t tid; /* The thread that "owns" this unixFile */ #endif }; - -/* -** Provide the ability to override some OS-layer functions during -** testing. This is used to simulate OS crashes to verify that -** commits are atomic even in the event of an OS crash. -*/ -#ifdef SQLITE_CRASH_TEST - extern int sqlite3CrashTestEnable; - int sqlite3CrashFileWrap(sqlite3_file *, const char *, sqlite3_file **); - static int CRASH_TEST_OVERRIDE(const char *zFile, sqlite3_file **pId, int rc){ - if( rc==SQLITE_OK && sqlite3CrashTestEnable ){ - rc = sqlite3CrashFileWrap(*pId, zFile, pId); - } - return rc; - } -#else -# define CRASH_TEST_OVERRIDE(A,B,C) C -#endif - - /* ** Include code that is common to all os_*.c files */ @@ -819,7 +804,7 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ got = read(id->h, pBuf, cnt); #endif TIMER_END; - OSTRACE5("READ %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED); + OSTRACE5("READ %-3d %5d %7lld %d\n", id->h, got, offset, TIMER_ELAPSED); return got; } |