Fix to allow overwriting existing inodes and add remove to oxfstool

This commit is contained in:
2016-07-06 00:40:59 -05:00
parent 7f583c8709
commit e5e85a147c
4 changed files with 200 additions and 43 deletions
+7
View File
@@ -5,6 +5,7 @@
* 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 <stdio.h>
#include <ox/std/std.hpp>
#include <ox/fs/filestore.hpp>
@@ -23,27 +24,32 @@ int test() {
if (fs->write(1, (void*) "Hello", 6) ||
fs->read(1, (char*) out, &outSize) ||
strcmp("Hello", out)) {
printf("Failure 1\n");
return 1;
}
if (fs->write(2, (void*) "World", 6) ||
fs->read(2, (char*) out, &outSize) ||
strcmp("World", out)) {
printf("Failure 2\n");
return 2;
}
// make sure first value was not overwritten
if (fs->read(1, (char*) out, &outSize) ||
strcmp("Hello", out)) {
printf("Failure 3\n");
return 3;
}
if (fs->remove(1)) {
printf("Failure 4\n");
return 4;
}
// make sure inode is not found
if (fs->read(1, (char*) out, &outSize) == 0) {
printf("Failure 5\n");
return 5;
}
@@ -51,6 +57,7 @@ int test() {
if (fs->write(2, (void*) "World", 6) ||
fs->read(2, (char*) out, &outSize) ||
strcmp("World", out)) {
printf("Failure 6\n");
return 6;
}