-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisk.h
47 lines (40 loc) · 1.29 KB
/
Disk.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
38
39
40
41
42
43
44
45
46
47
#ifndef DISK_H
#define DISK_H
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <fstream>
#include <iostream>
//#include "Inode.h"
/*using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::ifstream;
using std::ofstream;*/
using namespace std;
const string errMsg0("Error, fail to find the disk file.");
const string errMsg1("Error, fail to create a disk file.");
const string errMsg2("Error, fail to create a new file.");
const string errMsg3("Error, you can't create a file with a name longer than 8 letters.");
const string errMsg4("Error, fail to recognize the command.");
const string errMsg5("Error, fail to find the file.");
const string errMsg6("Error, you can't create a file larger than 8096 Bytes.\nIt will ignore all contents subsequent.");
const string sgsMsg0("You can have at most 80 files(including directories).");
const string sgsMsg1("You may delete some file first.");
const string sgsMsg2("You may try a shorter name.");
const string sgsMsg3("You may type in \"help\" to learn how to use the SFMS.");
class Disk
{
public:
Disk();
~Disk();
bool initDisk();
int blkSize;
int inodeCnt;
string diskFile;
int getBlk(char* buf, int blkNum); //blkNum means the physical block address
void putBlk(char* buf, int blkNum);
};
#endif