Implementation
The code structure of the implementation was as follows. Each module was associated with a specific function
- python-file-system
filesystem.py
dirsystem.py
harddisk.py
main.py
inode_space.py
disk
journal.txt
Inode Implementation
We used the UNIX Inode data structure and scheme to implement our file system. This is our basic implementation as we try to optimize directory access by using modern dictionary
implementation. This is discussed in the following sections.
File System Layout
- Block size: 1KB
- Addressing: 2B
- Inode size: 64B
- Single hierarchy object: 512 addresses
Super Block | Single Hierarchy Blocks | Inodes | Root Directory | File Data | Empty Addresses | Directory Structure |
---|---|---|---|---|---|---|
Basic information about the disk | All free single hierarchy blocks are stored here | Inodes stored here | Space for Root Directory | File Storage area | Actual File Data stored | Directory Tree |
Module Implementation
The detailed functioning of each module is discussed below
filesystem.py
This module functions as the interface of module that gets the command line input from the user and the memory.This module performs operations on the memory based on the commands obtained from the user. Based on the response obtained the changes are reflected and a message is send to the command line interface.
dirsystem.py
This file contains all the functions that perform operations on directories.These include changing directory name, removing directory, moving direction from source to destination folder, changing the path etc.
harddisk.py
This file contains the hierarchical directory structure of various users and all their files and sub directories in that directory.This structure has been implemented as an object.
inode_space.py
This is the virtual memory implementation.All the read(), write(), open(), close() memory requests are handled in this region. If the operation is successful, then the appropriate response is returned. This region also handles extended memory requests using the single hierarchy mechanism.
main.py
This acts as our command line interface to obtain user input. The user enters basic commands like mkdir, rmdir, mvdir, ls, pwd and more along with appropriate arguments are given as input by the user. This module then invokes systems calls to the interface filesystem.py for processing these commands. The response is then displayed on the screen.
disk
Saves the entire disk in persistant format.
journal.txt
This file stores all the successful OS calls. In case of a system crash, this file remains persistent and all the commands can be re run to bring back the system to the original state where it was.