some persistency imple

This commit is contained in:
FactorialN 2023-12-03 11:19:44 -08:00
parent 76815b36b7
commit a612d030f6
2 changed files with 29 additions and 3 deletions

View File

@ -19,6 +19,23 @@ cmake ..
make # cmake --build . is same make # cmake --build . is same
``` ```
## mount and test
normal usage:
```bash
./fischl diskpath mountpoint
```
diskpath must be the provided following ./fischl
if the diskpath need to be accessed by root:
```bash
sudo ./fischl diskpath -o allow_other mountpoint
```
for debugging:
```bash
sudo ./fischl diskpath -o allow_other -d mountpoint
```
## run test ## run test
### add your own test file on test/CMakeList.txt ### add your own test file on test/CMakeList.txt
``` ```

View File

@ -191,13 +191,22 @@ static void show_help(const char *progname)
int fischl(int argc, char *argv[]) int fischl(int argc, char *argv[])
{ {
int ret; int ret;
struct fuse_args args = FUSE_ARGS_INIT(argc, argv); if(argc < 2){
printf("WRONG ARGUMENTS");
return 0;
}
std::swap(argv[0], argv[1]);
struct fuse_args args = FUSE_ARGS_INIT(argc-1, argv+1);
srand(time(NULL)); // Seed the random number generator srand(time(NULL)); // Seed the random number generator
//const char* d = (argc < 2) ? "/dev/vdc" : argv[1]; //const char* d = (argc < 2) ? "/dev/vdc" : argv[1];
//setupTestDirectory(&options.root); //setupTestDirectory(&options.root);
options.H = new FakeRawDisk(23552); if(strcmp(argv[0], "fake")==0){
//options.H = new RealRawDisk("/dev/vdb"); options.H = new FakeRawDisk(27648);
}
else{
options.H = new RealRawDisk(argv[0]);
}
options.fs = new Fs(options.H); options.fs = new Fs(options.H);
options.fs->format(); options.fs->format();
options.fsop = new FilesOperation(*options.H, options.fs); options.fsop = new FilesOperation(*options.H, options.fs);