This project builds code into an executable file named fat
.
-
gcc 11.3.0
-
g++ 11.3.0
-
GNU Make 4.3
-
CMake 3.22.1
-
Valgrind 3.18.1
-
Checked by
valgrind -error-exitcode=100 --leak-check=full
-
No additional library required.
$ mkdir build
$ cd build
$ cmake ..
$ make -j
Once the project has been built successfully, you can execute the FAT tool by providing the disk image file as an argument:
$ ./fat disk.img # replace `disk.img` with the path to your actual disk image file.
This command shows the information about the file system:
- type of this FAT file system
- Size of a sector in bytes.
- Size of a cluster in sectors.
- Size of Reserved region in sectors.
- Size of FAT region in sectors.
- Size of Root Directory region in sectors.
- Size of Data region respectively in sectors.
Usage:
fat disk.img ck
Example Output:
FAT16 filesystem
BytsPerSec = 512
SecPerClus = 4
RsvdSecCnt = 4
FATsSecCnt = 64
RootSecCnt = 32
DataSecCnt = 32668
This command lists the contents of the specified disk image, excluding the "." and ".." entries. Directory names should be followed by a trailing slash. The order of the output does not need to be sorted, as the testing driver will sort the lines before comparing.
Usage:
fat disk.img ls
Example Directory Structure:
.
├── caddy.json
├── client.bundle.crt
├── client.crt
├── client.key
├── client.pfx
├── deploy.sh
├── gencert.sh
├── local_ca
│ ├── intermediate.crt
│ ├── intermediate.key
│ ├── root.crt
│ └── root.key
├── server.crt
└── test.sh
Example Output:
/caddy.json
/client.bundle.crt
/client.crt
/client.key
/client.pfx
/deploy.sh
/gencert.sh
/local_ca/
/local_ca/intermediate.crt
/local_ca/intermediate.key
/local_ca/root.crt
/local_ca/root.key
/server.crt
/test.sh
This command copies a single file from the specified path on the disk image to a local file on the user's system. The command does not support copying directories or multiple files at once. The source file must exist on the disk image, and the destination must be a regular file or non-existent.
fat disk.img cp image:/path/to/source local:/path/to/destination
This command removes the file or directory at the specified path on the disk image. The specified file or directory must exist on the disk image.
fat disk.img cp /path/to/be/remove
This command copies a single local file to the specified path on the disk image. The command does not support copying directories or multiple files at once. The source file must exist on the local system, and the destination must be a regular file or non-existent on the disk image.
fat disk.img cp local:/path/to/source image:/path/to/destination