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

Function adfWriteBlock

dep/adflib/src/adf_disk.c:413–450  ·  view source on GitHub ↗

* adfWriteBlock * */

Source from the content-addressed store, hash-verified

411 *
412 */
413RETCODE adfWriteBlock(struct Volume* vol, int32_t nSect, uint8_t *buf)
414{
415 int32_t pSect;
416 struct nativeFunctions *nFct;
417 RETCODE rc;
418
419 if (!vol->mounted) {
420 (*adfEnv.eFct)("the volume isn't mounted, adfWriteBlock not possible");
421 return RC_ERROR;
422 }
423
424 if (vol->readOnly) {
425 (*adfEnv.wFct)("adfWriteBlock : can't write block, read only volume");
426 return RC_ERROR;
427 }
428
429 pSect = nSect+vol->firstBlock;
430/*printf("write nsect=%ld psect=%ld\n",nSect,pSect);*/
431
432 if (adfEnv.useRWAccess)
433 (*adfEnv.rwhAccess)(pSect,nSect,TRUE);
434
435 if (pSect<vol->firstBlock || pSect>vol->lastBlock) {
436 (*adfEnv.wFct)("adfWriteBlock : nSect out of range");
437 }
438
439 nFct = adfEnv.nativeFct;
440/*printf("nativ=%d\n",vol->dev->isNativeDev);*/
441 if (vol->dev->isNativeDev)
442 rc = (*nFct->adfNativeWriteSector)(vol->dev, pSect, 512, buf);
443 else
444 rc = adfWriteDumpSector(vol->dev, pSect, 512, buf);
445
446 if (rc!=RC_OK)
447 return RC_ERROR;
448 else
449 return RC_OK;
450}
451
452
453

Callers 10

adfWriteFileHdrBlockFunction · 0.85
adfWriteDataBlockFunction · 0.85
adfWriteFileExtBlockFunction · 0.85
adfWriteRootBlockFunction · 0.85
adfWriteBootBlockFunction · 0.85
adfWriteDirCBlockFunction · 0.85
adfWriteEntryBlockFunction · 0.85
adfWriteDirBlockFunction · 0.85
adfWriteBitmapBlockFunction · 0.85
adfWriteBitmapExtBlockFunction · 0.85

Calls 1

adfWriteDumpSectorFunction · 0.85

Tested by

no test coverage detected