-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hostfs.h
35 lines (28 loc) · 1.61 KB
/
hostfs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef __HYCLONE_HOSTFS_H__
#define __HYCLONE_HOSTFS_H__
#include "server_vfs.h"
// Generic base class for filesystems that uses files on the host.
// rootfs, systemfs, devfs and even the current "packagefs" should subclass this.
class HostfsDevice : public VfsDevice, private std::enable_shared_from_this<HostfsDevice>
{
protected:
std::filesystem::path _hostRoot;
virtual bool _IsBlacklisted(const std::filesystem::path& path) const { return false; }
virtual bool _IsBlacklisted(const std::filesystem::directory_entry& entry) const { return false; }
static haiku_ino_t _Hash(uint64_t hostDev, uint64_t hostIno);
public:
HostfsDevice(const std::filesystem::path& root, const std::filesystem::path& hostRoot,
uint32 mountFlags = 0);
virtual ~HostfsDevice() override = default;
virtual status_t GetPath(std::filesystem::path& path, bool& isSymlink) override;
virtual status_t RealPath(std::filesystem::path& path, bool& isSymlink) override;
virtual status_t ReadStat(std::filesystem::path& path, haiku_stat& stat, bool& isSymlink) override;
virtual status_t WriteStat(std::filesystem::path& path, const haiku_stat& stat,
int statMask, bool& isSymlink) override;
virtual status_t TransformDirent(const std::filesystem::path& path, haiku_dirent& dirent) override;
virtual status_t AddMonitor(haiku_ino_t node) override;
virtual status_t RemoveMonitor(haiku_ino_t node) override;
// TODO: Override extended attributes functions to read from the host filesystem.
const std::filesystem::path& GetHostRoot() const { return _hostRoot; }
};
#endif // __HYCLONE_HOSTFS_H__