// loop.c // Author: Josh Holtrop // Date: 03/16/04 // Provides a loop-back device for mounting files on existing volumes as new volumes #include "hos_defines.h" #include "loop.h" #include "fs/vfs.h" int loop_readSector(LoopDevice *ld, dword sector, byte *buffer) { return vfs_readFileBlock(ld->vol, ld->filePath, sector * LOOP_SECTOR_SIZE, buffer, LOOP_SECTOR_SIZE); } int loop_writeSector(LoopDevice *ld, dword sector, byte *buffer) { return vfs_writeFileBlock(ld->vol, ld->filePath, sector * LOOP_SECTOR_SIZE, buffer, LOOP_SECTOR_SIZE); }