-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfloppy.h
37 lines (31 loc) · 1.24 KB
/
floppy.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
36
37
#include "InodeManager.h"
class MyFS {
public:
MyFS(std::shared_ptr<MyDisk> bd);
MyFS(const std::string& filename);
void initialize();
void initializeFloppy();
bool readdir(const std::string& dir, inode* in = nullptr,
uint32_t* iid = nullptr) const;
int rmdir(const std::string& path);
int rename(const std::string& oldpath, const std::string& newpath,
unsigned int flags);
int link(const std::string& oldpath, const std::string& newpath);
int unlink(const std::string& path);
int mkdir(const std::string& path, const inode& in);
int create(const std::string& path, const inode& in);
int truncate(const std::string& path, uint64_t size);
int read(const std::string& path, char* buf, size_t size,
uint64_t offset) const;
int write(const std::string& path, const char* buf, size_t size,
off_t offset);
int symlink(const std::string& target, const std::string& linkpath,
const inode& in);
int readlink(const std::string& path, char* buf, size_t size);
// test
static std::unique_ptr<MyFS> mytest();
static std::unique_ptr<MyFS> skipInit();
std::shared_ptr<SuperBlockManager> sbm_;
std::shared_ptr<BlockManager> bm_;
std::shared_ptr<InodeManager> im_;
};