Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | More updates to the Win32 interface for lsm1. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cae647696769c9fcdc3beafdfdf74d83 |
User & Date: | mistachkin 2017-06-29 16:51:52.526 |
Context
2017-06-29
| ||
17:27 | Edit comments in sqlite.h.in used for generating documentation, to improve the description of the new sqlite3_prepare_v3() interfaces, and other miscellaneous cleanup. No changes to executable code. (check-in: 284707a7b3 user: drh tags: trunk) | |
16:51 | More updates to the Win32 interface for lsm1. (check-in: cae6476967 user: mistachkin tags: trunk) | |
15:57 | Correct typo in the Win32 interface for lsm1. (check-in: 1b4facb1ad user: mistachkin tags: trunk) | |
Changes
Changes to ext/lsm1/lsm_win32.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | struct Win32File { lsm_env *pEnv; /* The run-time environment */ const char *zName; /* Full path to file */ HANDLE hFile; /* Open file handle */ HANDLE hShmFile; /* File handle for *-shm file */ HANDLE hMap; /* File handle for mapping */ LPVOID pMap; /* Pointer to mapping of file fd */ size_t nMap; /* Size of mapping at pMap in bytes */ int nShm; /* Number of entries in ahShm[]/apShm[] */ LPHANDLE ahShm; /* Array of handles for shared mappings */ LPVOID *apShm; /* Array of 32K shared memory segments */ }; | > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | struct Win32File { lsm_env *pEnv; /* The run-time environment */ const char *zName; /* Full path to file */ HANDLE hFile; /* Open file handle */ HANDLE hShmFile; /* File handle for *-shm file */ SYSTEM_INFO sysInfo; /* Operating system information */ HANDLE hMap; /* File handle for mapping */ LPVOID pMap; /* Pointer to mapping of file fd */ size_t nMap; /* Size of mapping at pMap in bytes */ int nShm; /* Number of entries in ahShm[]/apShm[] */ LPHANDLE ahShm; /* Array of handles for shared mappings */ LPVOID *apShm; /* Array of 32K shared memory segments */ }; |
︙ | ︙ | |||
252 253 254 255 256 257 258 259 260 261 262 263 264 265 | if( pWin32File==0 ){ rc = LSM_NOMEM_BKPT; }else{ HANDLE hFile; rc = win32Open(pEnv, zFile, flags, &hFile); if( rc==LSM_OK ){ pWin32File->pEnv = pEnv; pWin32File->zName = zFile; pWin32File->hFile = hFile; }else{ lsmFree(pEnv, pWin32File); pWin32File = 0; } | > > | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | if( pWin32File==0 ){ rc = LSM_NOMEM_BKPT; }else{ HANDLE hFile; rc = win32Open(pEnv, zFile, flags, &hFile); if( rc==LSM_OK ){ memset(&pWin32File->sysInfo, 0, sizeof(SYSTEM_INFO)); GetSystemInfo(&pWin32File->sysInfo); pWin32File->pEnv = pEnv; pWin32File->zName = zFile; pWin32File->hFile = hFile; }else{ lsmFree(pEnv, pWin32File); pWin32File = 0; } |
︙ | ︙ | |||
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | rc = LSM_IOERR_BKPT; } } if( rc==LSM_OK && !FlushFileBuffers(pWin32File->hFile) ){ rc = LSM_IOERR_BKPT; } #else #endif return rc; } static int lsmWin32OsSectorSize(lsm_file *pFile){ return 512; | > | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | rc = LSM_IOERR_BKPT; } } if( rc==LSM_OK && !FlushFileBuffers(pWin32File->hFile) ){ rc = LSM_IOERR_BKPT; } #else unused_parameter(pFile); #endif return rc; } static int lsmWin32OsSectorSize(lsm_file *pFile){ return 512; |
︙ | ︙ | |||
669 670 671 672 673 674 675 | if( fileSize.QuadPart<nReq ){ rc = win32Truncate(pWin32File->hShmFile, nReq); if( rc!=LSM_OK ){ return rc; } } | | | | | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | if( fileSize.QuadPart<nReq ){ rc = win32Truncate(pWin32File->hShmFile, nReq); if( rc!=LSM_OK ){ return rc; } } ahNew = (LPHANDLE)lsmRealloc(pWin32File->pEnv, pWin32File->ahShm, sizeof(LPHANDLE) * nNew); if( !ahNew ) return LSM_NOMEM_BKPT; apNew = (LPVOID *)lsmRealloc(pWin32File->pEnv, pWin32File->apShm, sizeof(LPVOID) * nNew); if( !apNew ){ lsmFree(pWin32File->pEnv, ahNew); return LSM_NOMEM_BKPT; } for(i=pWin32File->nShm; i<nNew; i++){ ahNew[i] = NULL; apNew[i] = NULL; |
︙ | ︙ | |||
697 698 699 700 701 702 703 704 705 | (DWORD)sz, NULL); if( hMap==NULL ){ return LSM_IOERR_BKPT; } pWin32File->ahShm[iChunk] = hMap; } if( pWin32File->apShm[iChunk]==NULL ){ LPVOID pMap; pMap = MapViewOfFile(pWin32File->ahShm[iChunk], | > > | < > | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | (DWORD)sz, NULL); if( hMap==NULL ){ return LSM_IOERR_BKPT; } pWin32File->ahShm[iChunk] = hMap; } if( pWin32File->apShm[iChunk]==NULL ){ int iOffset = iChunk * sz; int iOffsetShift = iOffset % pWin32File->sysInfo.dwAllocationGranularity; LPVOID pMap; pMap = MapViewOfFile(pWin32File->ahShm[iChunk], FILE_MAP_WRITE | FILE_MAP_READ, 0, iOffset - iOffsetShift, sz + iOffsetShift); if( pMap==NULL ){ return LSM_IOERR_BKPT; } pWin32File->apShm[iChunk] = pMap; } *ppShm = pWin32File->apShm[iChunk]; return LSM_OK; |
︙ | ︙ | |||
730 731 732 733 734 735 736 | } if( pWin32File->ahShm[i]!=NULL ){ CloseHandle(pWin32File->ahShm[i]); pWin32File->ahShm[i] = NULL; } } CloseHandle(pWin32File->hShmFile); | | | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | } if( pWin32File->ahShm[i]!=NULL ){ CloseHandle(pWin32File->ahShm[i]); pWin32File->ahShm[i] = NULL; } } CloseHandle(pWin32File->hShmFile); pWin32File->hShmFile = NULL; if( bDelete ){ char *zShm = win32ShmFile(pWin32File); if( zShm ){ win32Delete(pWin32File->pEnv, zShm); } lsmFree(pWin32File->pEnv, zShm); } } return LSM_OK; |
︙ | ︙ |