From eeff1dda8b66fe2316d5f9eae4f9edefae88cfd0 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 26 Jun 2016 17:55:55 -0500 Subject: [PATCH] Replaced root dir inode magic number with a const. --- src/ox/fs/filesystem.cpp | 5 +++++ src/ox/fs/filesystem.hpp | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ox/fs/filesystem.cpp b/src/ox/fs/filesystem.cpp index 2b1aef861..64573b380 100644 --- a/src/ox/fs/filesystem.cpp +++ b/src/ox/fs/filesystem.cpp @@ -6,3 +6,8 @@ * 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 06eb8469c..3196aafff 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -41,6 +41,9 @@ class FileSystem { } }; + // static members + static typename FileStore::InodeId_t INODE_ROOT_DIR; + FileStore *store = nullptr; public: @@ -55,6 +58,9 @@ class FileSystem { static uint8_t *format(uint8_t *buffer, typename FileStore::FsSize_t size); }; +template +typename FileStore::InodeId_t FileSystem::INODE_ROOT_DIR = 2; + template int FileSystem::mkdir(const char *path) { return 0; @@ -81,7 +87,7 @@ uint8_t *FileSystem::format(uint8_t *buffer, typename FileStore::FsSi char dirBuff[sizeof(Directory) + sizeof(Directory)]; Directory &dir = *((Directory*) dirBuff); DirectoryEntry entry; - entry.inode = 2; + entry.inode = INODE_ROOT_DIR; entry.name = '/'; entry.nameLen = 1;