Made FileStore a template to support arbitrary address space sizes.

This commit is contained in:
2016-06-06 19:53:57 -05:00
parent 02e25000e1
commit c822a7564a
7 changed files with 250 additions and 201 deletions
+9 -3
View File
@@ -1,8 +1,14 @@
cmake_minimum_required(VERSION 2.8.8)
add_executable(
MemFsTest
test.cpp
Format
format.cpp
)
target_link_libraries(MemFsTest Memphis)
add_executable(
FsStore
fsstore.cpp
)
target_link_libraries(Format WFS)
target_link_libraries(FsStore WFS)
+2 -2
View File
@@ -13,7 +13,7 @@ int main() {
const auto size = 1 << 16;
uint8_t volume[size];
uint32_t err;
initFs(volume, size, false);
FileStore(volume, volume + size, &err);
FileStore32::format(volume, size, false);
FileStore32(volume, volume + size, &err);
return err;
}
+21
View File
@@ -0,0 +1,21 @@
/*
* Copyright 2015 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <filestore.hpp>
using namespace wombat::fs;
int main() {
const auto size = 1 << 16;
uint8_t volume[size];
char out[6];
uint32_t err;
FileStore32 fs(volume, volume + size, &err);
fs.write(42, (uint8_t*) "Hello", 6);
err = fs.read(42, (uint8_t*) out, nullptr);
return err;
}