/ Check-in [0fd9983a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a comment to the OsSectorSize() function. (CVS 3710)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0fd9983a98d8d61654f252f1708a4d7232a96b53
User & Date: danielk1977 2007-03-23 10:08:39
Context
2007-03-23
18:12
Discard the contents of the pager-cache only when the change-counter indicates that it is stale. (CVS 3711) check-in: 07b56965 user: danielk1977 tags: trunk
10:08
Add a comment to the OsSectorSize() function. (CVS 3710) check-in: 0fd9983a user: danielk1977 tags: trunk
2007-03-22
15:22
In os_unix.c, make a distinction between pread() and pread64(). Add a new compile-time macro USE_PREAD64 to select the latter. (CVS 3709) check-in: 177cd929 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_common.h.

   193    193   
   194    194   /*
   195    195   ** The default size of a disk sector
   196    196   */
   197    197   #ifndef PAGER_SECTOR_SIZE
   198    198   # define PAGER_SECTOR_SIZE 512
   199    199   #endif
   200         -static int osGenericSectorSize(OsFile *id){
   201         -  return PAGER_SECTOR_SIZE;
   202         -}
   203    200   

Changes to src/os_os2.c.

   727    727   /*
   728    728   ** Return an integer that indices the type of lock currently held
   729    729   ** by this handle.  (Used for testing and analysis only.)
   730    730   */
   731    731   static int os2LockState( OsFile *id ){
   732    732     return ((os2File*)id)->locktype;
   733    733   }
          734  +
          735  +/*
          736  +** Return the sector size in bytes of the underlying block device for
          737  +** the specified file. This is almost always 512 bytes, but may be
          738  +** larger for some devices.
          739  +**
          740  +** SQLite code assumes this function cannot fail. It also assumes that
          741  +** if two files are created in the same file-system directory (i.e.
          742  +** a database and it's journal file) that the sector size will be the
          743  +** same for both.
          744  +*/
          745  +static int os2SectorSize(OsFile *id){
          746  +  return PAGER_SECTOR_SIZE;
          747  +}
   734    748   
   735    749   /*
   736    750   ** This vector defines all the methods that can operate on an OsFile
   737    751   ** for os2.
   738    752   */
   739    753   static const IoMethod sqlite3Os2IoMethod = {
   740    754     os2Close,
................................................................................
   747    761     os2SetFullSync,
   748    762     os2FileHandle,
   749    763     os2FileSize,
   750    764     os2Lock,
   751    765     os2Unlock,
   752    766     os2LockState,
   753    767     os2CheckReservedLock,
   754         -  osGenericSectorSize,
          768  +  os2SectorSize,
   755    769   };
   756    770   
   757    771   /*
   758    772   ** Allocate memory for an OsFile.  Initialize the new OsFile
   759    773   ** to the value given in pInit and return a pointer to the new
   760    774   ** OsFile.  If we run out of memory, close the file and return NULL.
   761    775   */

Changes to src/os_unix.c.

  2335   2335   /*
  2336   2336   ** Return an integer that indices the type of lock currently held
  2337   2337   ** by this handle.  (Used for testing and analysis only.)
  2338   2338   */
  2339   2339   static int unixLockState(OsFile *id){
  2340   2340     return ((unixFile*)id)->locktype;
  2341   2341   }
         2342  +
         2343  +/*
         2344  +** Return the sector size in bytes of the underlying block device for
         2345  +** the specified file. This is almost always 512 bytes, but may be
         2346  +** larger for some devices.
         2347  +**
         2348  +** SQLite code assumes this function cannot fail. It also assumes that
         2349  +** if two files are created in the same file-system directory (i.e.
         2350  +** a database and it's journal file) that the sector size will be the
         2351  +** same for both.
         2352  +*/
         2353  +static int unixSectorSize(OsFile *id){
         2354  +  return PAGER_SECTOR_SIZE;
         2355  +}
  2342   2356   
  2343   2357   /*
  2344   2358   ** This vector defines all the methods that can operate on an OsFile
  2345   2359   ** for unix.
  2346   2360   */
  2347   2361   static const IoMethod sqlite3UnixIoMethod = {
  2348   2362     unixClose,
................................................................................
  2355   2369     unixSetFullSync,
  2356   2370     unixFileHandle,
  2357   2371     unixFileSize,
  2358   2372     unixLock,
  2359   2373     unixUnlock,
  2360   2374     unixLockState,
  2361   2375     unixCheckReservedLock,
  2362         -  osGenericSectorSize,
         2376  +  unixSectorSize,
  2363   2377   };
  2364   2378   
  2365   2379   #ifdef SQLITE_ENABLE_LOCKING_STYLE
  2366   2380   /*
  2367   2381    ** This vector defines all the methods that can operate on an OsFile
  2368   2382    ** for unix with AFP style file locking.
  2369   2383    */
................................................................................
  2378   2392       unixSetFullSync,
  2379   2393       unixFileHandle,
  2380   2394       unixFileSize,
  2381   2395       afpUnixLock,
  2382   2396       afpUnixUnlock,
  2383   2397       unixLockState,
  2384   2398       afpUnixCheckReservedLock,
  2385         -    osGenericSectorSize,
         2399  +    unixSectorSize,
  2386   2400   };
  2387   2401   
  2388   2402   /*
  2389   2403    ** This vector defines all the methods that can operate on an OsFile
  2390   2404    ** for unix with flock() style file locking.
  2391   2405    */
  2392   2406   static const IoMethod sqlite3FlockLockingUnixIoMethod = {
................................................................................
  2400   2414       unixSetFullSync,
  2401   2415       unixFileHandle,
  2402   2416       unixFileSize,
  2403   2417       flockUnixLock,
  2404   2418       flockUnixUnlock,
  2405   2419       unixLockState,
  2406   2420       flockUnixCheckReservedLock,
  2407         -    osGenericSectorSize,
         2421  +    unixSectorSize,
  2408   2422   };
  2409   2423   
  2410   2424   /*
  2411   2425    ** This vector defines all the methods that can operate on an OsFile
  2412   2426    ** for unix with dotlock style file locking.
  2413   2427    */
  2414   2428   static const IoMethod sqlite3DotlockLockingUnixIoMethod = {
................................................................................
  2422   2436       unixSetFullSync,
  2423   2437       unixFileHandle,
  2424   2438       unixFileSize,
  2425   2439       dotlockUnixLock,
  2426   2440       dotlockUnixUnlock,
  2427   2441       unixLockState,
  2428   2442       dotlockUnixCheckReservedLock,
  2429         -    osGenericSectorSize,
         2443  +    unixSectorSize,
  2430   2444   };
  2431   2445   
  2432   2446   /*
  2433   2447    ** This vector defines all the methods that can operate on an OsFile
  2434   2448    ** for unix with dotlock style file locking.
  2435   2449    */
  2436   2450   static const IoMethod sqlite3NolockLockingUnixIoMethod = {
................................................................................
  2444   2458     unixSetFullSync,
  2445   2459     unixFileHandle,
  2446   2460     unixFileSize,
  2447   2461     nolockUnixLock,
  2448   2462     nolockUnixUnlock,
  2449   2463     unixLockState,
  2450   2464     nolockUnixCheckReservedLock,
  2451         -  osGenericSectorSize,
         2465  +  unixSectorSize,
  2452   2466   };
  2453   2467   
  2454   2468   #endif /* SQLITE_ENABLE_LOCKING_STYLE */
  2455   2469   
  2456   2470   /*
  2457   2471   ** Allocate memory for a new unixFile and initialize that unixFile.
  2458   2472   ** Write a pointer to the new unixFile into *pId.

Changes to src/os_win.c.

  1449   1449   /*
  1450   1450   ** Return an integer that indices the type of lock currently held
  1451   1451   ** by this handle.  (Used for testing and analysis only.)
  1452   1452   */
  1453   1453   static int winLockState(OsFile *id){
  1454   1454     return ((winFile*)id)->locktype;
  1455   1455   }
         1456  +
         1457  +/*
         1458  +** Return the sector size in bytes of the underlying block device for
         1459  +** the specified file. This is almost always 512 bytes, but may be
         1460  +** larger for some devices.
         1461  +**
         1462  +** SQLite code assumes this function cannot fail. It also assumes that
         1463  +** if two files are created in the same file-system directory (i.e.
         1464  +** a database and it's journal file) that the sector size will be the
         1465  +** same for both.
         1466  +*/
         1467  +static int winSectorSize(OsFile *id){
         1468  +  return PAGER_SECTOR_SIZE;
         1469  +}
  1456   1470   
  1457   1471   /*
  1458   1472   ** This vector defines all the methods that can operate on an OsFile
  1459   1473   ** for win32.
  1460   1474   */
  1461   1475   static const IoMethod sqlite3WinIoMethod = {
  1462   1476     winClose,
................................................................................
  1469   1483     winSetFullSync,
  1470   1484     winFileHandle,
  1471   1485     winFileSize,
  1472   1486     winLock,
  1473   1487     winUnlock,
  1474   1488     winLockState,
  1475   1489     winCheckReservedLock,
  1476         -  osGenericSectorSize,
         1490  +  winSectorSize,
  1477   1491   };
  1478   1492   
  1479   1493   /*
  1480   1494   ** Allocate memory for an OsFile.  Initialize the new OsFile
  1481   1495   ** to the value given in pInit and return a pointer to the new
  1482   1496   ** OsFile.  If we run out of memory, close the file and return NULL.
  1483   1497   */