This project is a basic file system with disk storage and multi-user support implemented in C. It was developed as part of the CS2303: Project Workshop of Operating Systems course at Shanghai Jiao Tong University. The system includes a server-side disk management module and a client-side interface, enabling users to perform common file operations over a network using socket communication.
![image](https://private-user-images.githubusercontent.com/102449991/371614462-ebe715dc-f6d3-4233-83b1-495c1be20504.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODY3NDUsIm5iZiI6MTczOTU4NjQ0NSwicGF0aCI6Ii8xMDI0NDk5OTEvMzcxNjE0NDYyLWViZTcxNWRjLWY2ZDMtNDIzMy04M2IxLTQ5NWMxYmUyMDUwNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwMjI3MjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03YTk3NmRiMjc5NGIwNDI0NDU0MjhmNzk3ZDEyNDIxN2Q2Y2M1MTZiNGNlZWU5Yjc2MWYwYWZhMzIyYmNmMGQ2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Lv1fVel8qEO7LXiKm-1K7_7mdslz0XE21ih1zIlEO4M)
- Disk Storage System: Supports disk initialization, reading, and writing using sector-based access.
- File System: Basic file operations including file creation, deletion, reading, and writing.
- Multi-user Support: Allows multiple users with individual home directories and file permissions.
- Socket Communication: Communication between the client and server is handled via TCP sockets.
- Directory Management: Provides functions for managing directories, including creation, listing, and deletion.
- BDS.c: The server that handles disk operations such as reading and writing data to disk blocks.
- BDC.c: The client that interacts with the disk server and sends commands for disk I/O operations.
- File System Server: Manages the file system, including the root directory, INode structure, and file data storage.
- File System Client: Allows users to interact with the file system, perform operations, and communicate with the server.
- Supports user creation, deletion, and login.
- Users have their own file permissions and home directories.
- Each file is associated with an owner and permission settings (read-only or writable).
The following commands are implemented in the file system:
- Initialize: Prepares the disk and root directory for file operations.
- Create: Creates a file or directory.
- Read: Reads the content of a file.
- Write: Writes data to a file.
- Delete: Deletes a file or directory.
- List: Lists all files in the current directory.
- Change Directory: Navigates between directories.
- Login: Users can log in and access their own files and directories.
- Permissions: Each file has specific read/write permissions associated with its owner.
- File Ownership: Files created by users are tagged with the user as the owner, and permissions control who can modify the file.
- Compile the code:
gcc -o server BDS.c
gcc -o client BDC.c
gcc -o file_system_server FileSystemServer.c
gcc -o file_system_client FileSystemClient.c
- Start the disk server:
./server disk_file cylinders sectors_per_cylinder track_to_track_delay port_number
- Start the file system server:
./file_system_server port_number
- Run the client:
./client port_number