Kernel: Add basic Credentials for the system

Now filesystem access/open, etc confirm that you have access for rwxs
This commit is contained in:
Bananymous
2023-06-11 19:52:13 +03:00
parent 3181ea7b4d
commit c7ec19c25c
13 changed files with 168 additions and 54 deletions

View File

@@ -6,6 +6,7 @@
#include <BAN/Vector.h>
#include <kernel/API/DirectoryEntry.h>
#include <kernel/Credentials.h>
#include <sys/types.h>
#include <time.h>
@@ -56,6 +57,8 @@ namespace Kernel
public:
virtual ~Inode() {}
bool can_access(const Credentials&, int);
bool operator==(const Inode& other) const { return dev() == other.dev() && rdev() == other.rdev() && ino() == other.ino(); }
virtual ino_t ino() const = 0;

View File

@@ -11,21 +11,21 @@ namespace Kernel
class VirtualFileSystem : public FileSystem
{
public:
static BAN::ErrorOr<void> initialize(BAN::StringView);
static void initialize(BAN::StringView);
static VirtualFileSystem& get();
virtual ~VirtualFileSystem() {};
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_fs->root_inode(); }
BAN::ErrorOr<void> mount(BAN::StringView, BAN::StringView);
BAN::ErrorOr<void> mount(FileSystem*, BAN::StringView);
BAN::ErrorOr<void> mount(const Credentials&, BAN::StringView, BAN::StringView);
BAN::ErrorOr<void> mount(const Credentials&, FileSystem*, BAN::StringView);
struct File
{
BAN::RefPtr<Inode> inode;
BAN::String canonical_path;
};
BAN::ErrorOr<File> file_from_absolute_path(BAN::StringView, bool follow_link);
BAN::ErrorOr<File> file_from_absolute_path(const Credentials&, BAN::StringView, int);
private:
VirtualFileSystem() = default;