-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFileSystem.hh
More file actions
108 lines (77 loc) · 2.38 KB
/
FileSystem.hh
File metadata and controls
108 lines (77 loc) · 2.38 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef _FILESYSTEM_HH_
#define _FILESYSTEM_HH_
#include "AccessManager.hh"
#include "Clock.hh"
#include "file.hh"
#include "fsmarshaller.hh"
#include "IoError.hh"
#include "log4cpp/Category.hh"
#include "NodeAttrHelper.hh"
#include "Node.hh"
#include "PathUtils.hh"
#include <fuse.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
class FileSystem {
private:
static log4cpp::Category& cat;
FsMarshaller& marshaller;
AccessManager& accessManager;
RootDir& rootDir;
Clock& clock;
PathUtils pathUtils;
NodeAttrHelper nodeAttrHelper;
string fullPath(const Node& node) const
throw();
Child *findChild(Parent& parent, const string name) const
throw();
Node *findNode(const string path) const
throw(IoError);
Node& getNode(const string path) const
throw(IoError);
Parent& getParent(const string path) const
throw(IoError);
File& getFile(const string path) const
throw(IoError);
public:
FileSystem(FsMarshaller& marshaller, AccessManager& accessManager,
RootDir& rootDir, Clock& clock)
throw();
~FileSystem()
throw();
int readDir(const string path, void *buf, fuse_fill_dir_t filler,
off_t offset, fuse_file_info *fi) const
throw(IoError);
int access(const string path, int mode) const
throw(IoError);
int getAttr(const string path, struct stat *stbuf) const
throw(IoError);
// TODO Remove?
// int setAttr(const string path, const struct stat *stbuf) const
// throw(IoError);
int create(const string path, mode_t mode, fuse_file_info *fi) const
throw(IoError);
int open(const string path, fuse_file_info *fi) const
throw(IoError);
int unlink(const string path) const
throw(IoError);
int read(const string path, void *buf, size_t size, off_t offset,
fuse_file_info *fi) const
throw(IoError);
int write(const string path, const void *buf, size_t size, off_t offset,
fuse_file_info *fi) const
throw(IoError);
int release(const string path, fuse_file_info *fi) const
throw(IoError);
int chmod(const string path, mode_t mode) const
throw(IoError);
int chown(const string path, uid_t uid, gid_t gid) const
throw(IoError);
int utimens(const string path, const struct timespec tv[2]) const
throw(IoError);
int mkdir(const string path, mode_t mode) const
throw(IoError);
friend class FileSystemTest;
};
#endif /* _FILESYSTEM_HH_ */