From 442d6ad1ce84e5266036b9aed5200ced35374049 Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Sat, 1 Mar 2014 11:28:54 +0100 Subject: [PATCH] Prepare file system abstraction --- kernel/include/file_system.hpp | 25 +++++++++++++++++++++++++ kernel/src/vfs.cpp | 9 +++++---- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 kernel/include/file_system.hpp diff --git a/kernel/include/file_system.hpp b/kernel/include/file_system.hpp new file mode 100644 index 00000000..6236ae04 --- /dev/null +++ b/kernel/include/file_system.hpp @@ -0,0 +1,25 @@ +//======================================================================= +// Copyright Baptiste Wicht 2013-2014. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#ifndef FILE_SYSTEM_H +#define FILE_SYSTEM_H + +#include "disks.hpp" + +namespace vfs { + +struct file_system { + virtual size_t read(const std::vector& file_path, std::string& content) = 0; + virtual size_t ls(const std::vector& file_path, std::vector& contents) = 0; + virtual size_t touch(const std::vector& file_path) = 0; + virtual size_t mkdir(const std::vector& file_path) = 0; + virtual size_t rm(const std::vector& file_path) = 0; +}; + +} + +#endif diff --git a/kernel/src/vfs.cpp b/kernel/src/vfs.cpp index 96e983e0..f058c8e9 100644 --- a/kernel/src/vfs.cpp +++ b/kernel/src/vfs.cpp @@ -9,13 +9,14 @@ #include #include -#include "vfs.hpp" -#include "scheduler.hpp" -#include "flags.hpp" - #include #include +#include "vfs.hpp" +#include "scheduler.hpp" +#include "file_system.hpp" +#include "flags.hpp" + #include "fat32.hpp" #include "disks.hpp"