* NAME: block->writeab() * DESCRIPTION: write a block to an allocation block to a volume */
| 738 | * DESCRIPTION: write a block to an allocation block to a volume |
| 739 | */ |
| 740 | int b_writeab(hfsvol *vol, |
| 741 | unsigned int anum, unsigned int index, const block *bp) |
| 742 | { |
| 743 | /* verify the allocation block exists and is marked as in-use */ |
| 744 | |
| 745 | if (anum >= vol->mdb.drNmAlBlks) |
| 746 | ERROR(EIO, "write nonexistent allocation block"); |
| 747 | else if (vol->vbm && ! BMTST(vol->vbm, anum)) |
| 748 | ERROR(EIO, "write unallocated block"); |
| 749 | |
| 750 | if (v_dirty(vol) == -1) |
| 751 | goto fail; |
| 752 | |
| 753 | return b_writelb(vol, vol->mdb.drAlBlSt + anum * vol->lpa + index, bp); |
| 754 | |
| 755 | fail: |
| 756 | return -1; |
| 757 | } |
| 758 | |
| 759 | /* |
| 760 | * NAME: block->size() |
no test coverage detected