Skip to content

s3714110/OSP-ProgAsg2

Repository files navigation

Assignment 2 OSP: VSFS Program

VSFS (Very Simple File System) is a program that manages a custom filesystem file, and allows users to performs various tasks to manipulate the file and directories within that filesystem.

Installation

At the main folder of this program, run the following command to build and compile all the source files into a single excutable file.

make

Usage

There are multiple options for this program. You can supply a valid .notes file into the parameters, of if you don't have one, the program will automatically create a new, empty .notes file in the path you specify.

  • To list all the files in the filesystem
./VSFS list [filesystem_name]
  • To copy an external file into the filesystem as an internal file and have its content encoded with base64
./VSFS copyin [filesystem_name] [external_file_name] [internal_file_name]
  • To copy an internal file within the filesystem to external file and have its content decoded with base64
./VSFS copyout [filesystem_name] [internal_file_name] [external_file_name]  
  • To creates an empty internal directory in the filesystem
./VSFS mkdir [filesystem_name] [internal_dir_name]
  • To remove an internal file from the filesystem
./VSFS rm [filesystem_name] [internal_file_name]
  • To remove an internal directory from the filesystem
./VSFS rmdir [filesystem_name] [internal_dir_name]
  • To defragment and sort out the filesystem
./VSFS defrag [filesystem_name]
  • To create an index file of the filesystem and list all the indexes out
./VSFS index [filesystem_name]

Clean up

If you wish to remove the program and all of its object files, run this command:

make clean

Testing

If you wish to a series of automated unit tests to check for the program functionality, run this command

./test_script

If you see this line in console: "All tests passed!", it means the program passed all the tests and is working is expected. However, if the script outputs this line in console: "Test Failed. Script exitting...", it means one of the functionality is broken. Suggested solution is to reinstall the program, or use different C flags in Makefile

Additional notes

By default, the copyin and copyout options will encode and decode data of the external file, respectively, in order to make sure the program can store and preserve the content of all types of files, including text files or binary files, etc... The result is when you open the filesystem file with a note editor, the file content will be encoded using base64 algorithm. If you wish to just have the content of the external file in plain and orignal format, you can run these two commands, but be aware that the content of binary files may get corrupted and missing:

  • To copy an external file into the filesystem as an internal file in plain format
./VSFS copyin_plain [filesystem_name] [external_file_name] [internal_file_name]
  • To copy an internal file within the filesystem to external file in plain format
./VSFS copyout_plain [filesystem_name] [internal_file_name] [external_file_name]  

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published