std1.0.0-beta-7 SafeC docs

std :: fs::block

Trait std::BlockDriver

#include <std/fs/block.h> source

trait BlockDriver {
    int read(unsigned long lba, []unsigned char buf);
    int write(unsigned long lba, []const unsigned char buf);
}

What a block driver provides: whole-sector reads and writes at a sector address, 0 on success. A buffer covers buf.len / sector_size sectors (the device's sector_size), and its length is a multiple of it. BlockDevice::new takes any such type, and a BlockDevice has the same methods, so it is one too.

Required methods

§int read(unsigned long lba, []unsigned char buf)source
§int write(unsigned long lba, []const unsigned char buf)source