Skip to content

Commit 750236b

Browse files
committed
done
1 parent 05816bb commit 750236b

13 files changed

+1062
-202
lines changed

Context.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Context cxt;
1414
Context::Context() {
1515

1616
this->c_spb = new SuperBlock();
17+
1718
this->MyDisk = fopen("MyDisk.img", "rb+");
1819

1920
}
@@ -29,7 +30,9 @@ Context::~Context() {
2930
FileManager* Context::GetFileManager() {
3031
return &(this->c_FileManager);
3132
}
32-
33+
Inode* Context::GetrootDirInode() {
34+
return &(this->c_rootDirInode);
35+
}
3336
/**
3437
* @return inode*
3538
*/
@@ -40,8 +43,8 @@ Inode* Context::GetPwd() {
4043
/**
4144
* @return char*
4245
*/
43-
char* Context::GetPwdPath() {
44-
return this->c_pwd_path;
46+
string* Context::GetPwdPath() {
47+
return &(this->c_pwd_path);
4548
}
4649

4750
/**
@@ -64,7 +67,9 @@ FileSystem* Context::GetFileSystem() {
6467
FILE* Context::GetMyDisk() {
6568
return this->MyDisk;
6669
}
67-
70+
OpenFiles* Context::GetOpenFiles() {
71+
return &(this->c_OpenFiles);
72+
}
6873
/**
6974
* @return SuperBlock*
7075
*/

Context.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,26 @@
1515
class Context {
1616
public:
1717
FileManager c_FileManager;
18+
Inode c_rootDirInode;
1819
Inode* c_pwd;
19-
char* c_pwd_path;
20+
string c_pwd_path;
2021
IOParameter c_IOParameter;
2122
char* c_Buffer;
2223
FileSystem c_FileSystem;
2324
SuperBlock* c_spb;
2425
FILE* MyDisk;
2526
char* c_ReadBuffer;
27+
OpenFiles c_OpenFiles;
2628

2729

2830

2931
FileManager* GetFileManager();
32+
33+
Inode* GetrootDirInode();
3034

3135
Inode* GetPwd();
3236

33-
char* GetPwdPath();
37+
string* GetPwdPath();
3438

3539
IOParameter* GetIOParameter();
3640

@@ -40,7 +44,8 @@ class Context {
4044

4145
FILE* GetMyDisk();
4246

43-
void DwordCopy(int *src, int *dst, int count);
47+
OpenFiles* GetOpenFiles();
48+
4449

4550
public:
4651
Context();

DirectoryEntry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
DirectoryEntry::DirectoryEntry() {
14-
this->m_ino = 0;
14+
this->m_ino = -1;
1515
this->m_name[0] = '\0';
1616
}
1717

DirectoryEntry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
class DirectoryEntry {
1010
public:
11-
int m_ino;
12-
static const int DIRSIZ = 28;
13-
char m_name[DIRSIZ];
11+
int m_ino; //每一个目录表项的Inode编号部分
12+
static const int DIRSIZ = 28; //目录表项名字的最大长度
13+
char m_name[DIRSIZ]; //每一个目录表项的名字部分
1414

1515

1616
public:

0 commit comments

Comments
 (0)