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
|
#ifndef DEF_RAMFS_CLASS_H
#define DEF_RAMFS_CLASS_H
#include <VFS/FileSystem.proto.h>
class RamFS : public FileSystem {
private:
u32int m_maxSize;
u32int m_usedSize;
public:
RamFS(u32int maxSize); //Creates an empty RAM file system
RamFS(u8int* ptr, u32int maxSize, bool writable = true); //Creates a RAM file system from data loaded in memory. format to be defined
bool setName(FSNode* node, String name);
bool setPermissions(FSNode* node, u32int permissions);
bool setUid(FSNode* node, u32int uid);
bool setGid(FSNode* node, u32int gid);
bool setParent(FSNode* node, FSNode* parent);
u32int read(FileNode* file, u64int position, u32int max_length, u8int *data);
bool write(FileNode* file, u64int position, u32int length, u8int *data);
bool truncate(FileNode* file);
bool loadContents(DirectoryNode* dir);
FileNode* createFile(DirectoryNode* parent, String name);
DirectoryNode* createDirectory(DirectoryNode* parent, String name);
};
#endif
|