huge work on FAT32, initial support for writing
This commit is contained in:
@@ -6,7 +6,23 @@
|
||||
|
||||
struct TestDevice {
|
||||
|
||||
uint8_t buf[4096];
|
||||
size_t size;
|
||||
uint8_t* buf;
|
||||
|
||||
TestDevice(size_t size) : size(size) {
|
||||
buf = (uint8_t*) malloc(size);
|
||||
memset(buf, 0, size);
|
||||
}
|
||||
|
||||
~TestDevice() {
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void toFile(const std::string& name) {
|
||||
FILE* f = fopen(name.c_str(), "w+");
|
||||
fwrite(buf, size, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
/** read a 512 byte block into dst */
|
||||
bool readSingleBlock(LBA512 addr, uint8_t* dst) {
|
||||
@@ -14,7 +30,7 @@ struct TestDevice {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool writeSingleBlock(LBA512 addr, uint8_t* src) {
|
||||
bool writeSingleBlock(LBA512 addr, const uint8_t* src) {
|
||||
memcpy(buf+addr*512, src, 512);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user