diff --git a/src/ox/fs/filesystem.cpp b/src/ox/fs/filesystem.cpp index 64573b380..2b1aef861 100644 --- a/src/ox/fs/filesystem.cpp +++ b/src/ox/fs/filesystem.cpp @@ -6,8 +6,3 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "filesystem.hpp" - -namespace ox { -namespace fs { -} -} diff --git a/src/ox/fs/filesystem.hpp b/src/ox/fs/filesystem.hpp index 3196aafff..254cb0811 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -26,8 +26,17 @@ class FileSystem { private: struct DirectoryEntry { typename FileStore::InodeId_t inode; - uint8_t nameLen; - char name; + + char *getName() { + return (char*) (this + 1); + } + + void setName(const char *name) { + auto data = getName(); + auto nameLen = strlen(name); + memcpy(data, &name, nameLen); + data[nameLen] = 0; + } }; struct Directory { @@ -88,8 +97,7 @@ uint8_t *FileSystem::format(uint8_t *buffer, typename FileStore::FsSi Directory &dir = *((Directory*) dirBuff); DirectoryEntry entry; entry.inode = INODE_ROOT_DIR; - entry.name = '/'; - entry.nameLen = 1; + entry.setName("/"); if (buffer) { uint32_t err; diff --git a/src/ox/std/strops.cpp b/src/ox/std/strops.cpp index dab00329c..a3bcbd476 100644 --- a/src/ox/std/strops.cpp +++ b/src/ox/std/strops.cpp @@ -24,6 +24,12 @@ int strcmp(const char *str1, const char *str2) { return retval; } +int strlen(const char *str1) { + int len; + for (len = 0; str1[len]; len++); + return len; +} + } } diff --git a/src/ox/std/strops.hpp b/src/ox/std/strops.hpp index 9e564e070..e72e22237 100644 --- a/src/ox/std/strops.hpp +++ b/src/ox/std/strops.hpp @@ -12,5 +12,7 @@ namespace std { int strcmp(const char *str1, const char *str2); +int strlen(const char *str1); + } }