-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileManager.h
More file actions
95 lines (79 loc) · 1.71 KB
/
FileManager.h
File metadata and controls
95 lines (79 loc) · 1.71 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
/**
* Project Untitled
*/
#ifndef _FILEMANAGER_H
#define _FILEMANAGER_H
#include"Inode.h"
#include"OpenFiles.h"
#include"FileSystem.h"
#include"File.h"
#include "DirectoryEntry.h"
class FileManager {
public:
Inode* rootDirInode;
OpenFiles* OpenFiles;
FileSystem* m_FileSystem;
void Initialize();
/**
* @comment 在pwd当中找出fName对应的目录项
*/
DirectoryEntry* FindDir(char* fName,Inode* pwd);
/**
* @comment 格式化硬盘
*/
void fformat();
/**
* @param fName
* @param mode
* @comment 创建文件
*/
int Fcreat(char* fName, int mode);
/**
* @param fName
* @param mode
* @comment 打开文件
*/
int Fopen(char* fName, int mode);
/**
* @param fd
* @comment 关闭文件
*/
void Fclose(int fd);
/**
* @param fd
* @param buffer
* @param length
* @comment 读取length长度的数据到buffer当中
*/
int Fread(int fd, char* buffer, int length);
/**
* @param fd
* @param buffer
* @param length
* @将length大小的数据写入到fd当中
*/
int Fwrite(int fd, char* buffer, int length);
/**
* @param fd
* @param buffer
* @param length
* @param mode
* @comment 该函数有fread和fwrite调用
*/
int Rdwr(int fd, char* buffer, int length, enum File::FileFlags mode);
/**
* @param fd
* @param position
* @comment 将文件指针指向position
*/
int Flseek(int fd, int position);
/**
* @param fName
* @comment 删除文件
*/
int Fdelete(char* fName);
public:
FileManager();
~FileManager();
};
#endif //_FILEMANAGER_H