-
Notifications
You must be signed in to change notification settings - Fork 1
/
examplefs.hh
68 lines (56 loc) · 2.37 KB
/
examplefs.hh
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
#ifndef examples_hh
#define examples_hh
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <fuse.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/xattr.h>
class ExampleFS {
private:
const char *_root;
static ExampleFS *_instance;
void AbsPath(char dest[PATH_MAX], const char *path);
public:
static ExampleFS *Instance();
ExampleFS();
~ExampleFS();
void setRootDir(const char *path);
int Getattr(const char *path, struct stat *statbuf);
int Readlink(const char *path, char *link, size_t size);
int Mknod(const char *path, mode_t mode, dev_t dev);
int Mkdir(const char *path, mode_t mode);
int Unlink(const char *path);
int Rmdir(const char *path);
int Symlink(const char *path, const char *link);
int Rename(const char *path, const char *newpath);
int Link(const char *path, const char *newpath);
int Chmod(const char *path, mode_t mode);
int Chown(const char *path, uid_t uid, gid_t gid);
int Truncate(const char *path, off_t newSize);
int Utime(const char *path, struct utimbuf *ubuf);
int Open(const char *path, struct fuse_file_info *fileInfo);
int Read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fileInfo);
int Write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fileInfo);
int Statfs(const char *path, struct statvfs *statInfo);
int Flush(const char *path, struct fuse_file_info *fileInfo);
int Release(const char *path, struct fuse_file_info *fileInfo);
int Fsync(const char *path, int datasync, struct fuse_file_info *fi);
int Setxattr(const char *path, const char *name, const char *value, size_t size, int flags);
int Getxattr(const char *path, const char *name, char *value, size_t size);
int Listxattr(const char *path, char *list, size_t size);
int Removexattr(const char *path, const char *name);
int Opendir(const char *path, struct fuse_file_info *fileInfo);
int Readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fileInfo);
int Releasedir(const char *path, struct fuse_file_info *fileInfo);
int Fsyncdir(const char *path, int datasync, struct fuse_file_info *fileInfo);
int Init(struct fuse_conn_info *conn);
int Truncate(const char *path, off_t offset, struct fuse_file_info *fileInfo);
};
#endif //examples_hh