1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Add new OS file method to return the sector-size of the underlying storage: sqlite3OsSectorSize() (CVS 3700)

FossilOrigin-Name: 5752d84d374205e011d49b0221d6237967fe0743
This commit is contained in:
danielk1977
2007-03-19 05:54:48 +00:00
parent 8d3921772f
commit b472117c11
12 changed files with 64 additions and 29 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.288 2007/03/15 12:51:16 drh Exp $
** @(#) $Id: pager.c,v 1.289 2007/03/19 05:54:49 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -349,13 +349,6 @@ static const unsigned char aJournalMagic[] = {
# define MEMDB pPager->memDb
#endif
/*
** The default size of a disk sector
*/
#ifndef PAGER_SECTOR_SIZE
# define PAGER_SECTOR_SIZE 512
#endif
/*
** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
** reserved for working around a windows/posix incompatibility). It is
@@ -1394,7 +1387,7 @@ end_playback:
** back a journal created by a process with a different PAGER_SECTOR_SIZE
** value. Reset it to the correct value for this process.
*/
pPager->sectorSize = PAGER_SECTOR_SIZE;
pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);
return rc;
}
@@ -1738,7 +1731,10 @@ int sqlite3pager_open(
/* pPager->pFirstSynced = 0; */
/* pPager->pLast = 0; */
pPager->nExtra = FORCE_ALIGNMENT(nExtra);
pPager->sectorSize = PAGER_SECTOR_SIZE;
assert(fd||memDb);
if( !memDb ){
pPager->sectorSize = sqlite3OsSectorSize(fd);
}
/* pPager->pBusyHandler = 0; */
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
*ppPager = pPager;