MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / adfReadBlock

Function adfReadBlock

dep/adflib/src/adf_disk.c:368–406  ·  view source on GitHub ↗

* adfReadBlock * * read logical block */

Source from the content-addressed store, hash-verified

366 * read logical block
367 */
368RETCODE
369adfReadBlock(struct Volume* vol, int32_t nSect, uint8_t* buf)
370{
371 /* char strBuf[80];*/
372 int32_t pSect;
373 struct nativeFunctions *nFct;
374 RETCODE rc;
375
376 if (!vol->mounted) {
377 (*adfEnv.eFct)("the volume isn't mounted, adfReadBlock not possible");
378 return RC_ERROR;
379 }
380
381 /* translate logical sect to physical sect */
382 pSect = nSect+vol->firstBlock;
383
384 if (adfEnv.useRWAccess)
385 (*adfEnv.rwhAccess)(pSect,nSect,FALSE);
386
387/*printf("psect=%ld nsect=%ld\n",pSect,nSect);*/
388/* sprintf(strBuf,"ReadBlock : accessing logical block #%ld", nSect);
389 (*adfEnv.vFct)(strBuf);
390*/
391 if (pSect<vol->firstBlock || pSect>vol->lastBlock) {
392 (*adfEnv.wFct)("adfReadBlock : nSect out of range");
393
394 }
395/*printf("pSect R =%ld\n",pSect);*/
396 nFct = adfEnv.nativeFct;
397 if (vol->dev->isNativeDev)
398 rc = (*nFct->adfNativeReadSector)(vol->dev, pSect, 512, buf);
399 else
400 rc = adfReadDumpSector(vol->dev, pSect, 512, buf);
401/*printf("rc=%ld\n",rc);*/
402 if (rc!=RC_OK)
403 return RC_ERROR;
404 else
405 return RC_OK;
406}
407
408
409/*

Callers 9

adfReadDataBlockFunction · 0.85
adfReadFileExtBlockFunction · 0.85
adfReadRootBlockFunction · 0.85
adfReadBootBlockFunction · 0.85
adfReadGenBlockFunction · 0.85
adfReadDirCBlockFunction · 0.85
adfReadEntryBlockFunction · 0.85
adfReadBitmapBlockFunction · 0.85
adfReadBitmapExtBlockFunction · 0.85

Calls 1

adfReadDumpSectorFunction · 0.85

Tested by

no test coverage detected