Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Further work on getting ssdsim to run. This is an incremental checkin to save my place while jumping off to work on other things. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | ssdsim |
Files: | files | file ages | folders |
SHA1: |
ae2f1627b1672e511be1ff132f2a3fb8 |
User & Date: | drh 2012-10-25 23:47:27.493 |
Context
2012-10-25
| ||
23:47 | Further work on getting ssdsim to run. This is an incremental checkin to save my place while jumping off to work on other things. (Leaf check-in: ae2f1627b1 user: drh tags: ssdsim) | |
15:32 | Merge the command-line shell enhancements from trunk. Other edits toward trying to get ssdsim to run. (check-in: 848f87e22f user: drh tags: ssdsim) | |
Changes
Changes to src/test_ssdsim.c.
︙ | ︙ | |||
306 307 308 309 310 311 312 | void *zBuf, int iAmt, sqlite_int64 iOfst ){ ssdsim_file *p = (ssdsim_file *)pFile; ssdsim_inode *pInode = p->pInode; int rc = SQLITE_OK; | | < | < > | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | void *zBuf, int iAmt, sqlite_int64 iOfst ){ ssdsim_file *p = (ssdsim_file *)pFile; ssdsim_inode *pInode = p->pInode; int rc = SQLITE_OK; int lpn, ppn, n, mx; unsigned char *pOut = (unsigned char*)zBuf; unsigned char *pContent; while( iAmt>0 ){ if( iAmt+iOfst>pInode->len ){ rc = SQLITE_IOERR_SHORT_READ; iAmt = pInode->len - iOfst; if( iAmt<=0 ) break; } lpn = pInode->aiPage[iOfst/g.szPage]; ppn = ssdsimCoreLpnToPpn(lpn, 0); n = iAmt; mx = g.szPage - iOfst%g.szPage; if( n>mx ) n = mx; if( ppn>=0 && ppn<g.nPage && (pContent = g.apPage[ppn])!=0 ){ memcpy(pOut, &pContent[iOfst%g.szPage], n); }else{ memset(pOut, 0, n); } iOfst += n; iAmt -= n; |
︙ | ︙ | |||
356 357 358 359 360 361 362 | lenNew = iOfst+iAmt; if( lenNew <= pInode->len ){ lenNew = pInode->len; }else{ int nOld, nNew; int *aiPage; | | | | < < | < > | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | lenNew = iOfst+iAmt; if( lenNew <= pInode->len ){ lenNew = pInode->len; }else{ int nOld, nNew; int *aiPage; nOld = (pInode->len+g.szPage-1)/g.szPage; nNew = (iOfst+iAmt+g.szPage-1)/g.szPage; if( nOld<nNew ){ aiPage = sqlite3_realloc(pInode->aiPage, nNew*sizeof(int)); if( aiPage==0 ) return SQLITE_NOMEM; memset(aiPage+nOld, 0xff, sizeof(int)*(nNew - nOld)); pInode->aiPage = aiPage; } } while( iAmt>0 ){ int n, mx; lpn = pInode->aiPage[iOfst/g.szPage]; if( lpn<0 ){ lpn = ssdsimCoreLpnAlloc(); if( lpn<0 ) return SQLITE_FULL; } ppn = ssdsimCoreLpnToPpn(lpn, 1); if( ppn<0 ) return SQLITE_NOMEM; n = iAmt; mx = g.szPage - iOfst%g.szPage; if( n>mx ) n = mx; pDest = g.apPage[ppn]; memcpy(pDest, pIn, n); iOfst += n; iAmt -= n; pIn += n; } pInode->len = lenNew; |
︙ | ︙ | |||
748 749 750 751 752 753 754 | ** returning. */ static int ssdsimDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ ssdsim_inode *pInode; if( ssdsimInit() ) return SQLITE_CANTOPEN; pInode = ssdsimFindInode(zPath); | < | | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | ** returning. */ static int ssdsimDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ ssdsim_inode *pInode; if( ssdsimInit() ) return SQLITE_CANTOPEN; pInode = ssdsimFindInode(zPath); if( pInode ) ssdsimDeleteInode(pInode); return SQLITE_OK; } /* ** Test for access permissions. Return true if the requested permission ** is available, or false otherwise. */ |
︙ | ︙ |