* adfWriteBlock * */
| 411 | * |
| 412 | */ |
| 413 | RETCODE 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 |
no test coverage detected