For this C++ project, you will design and implement a user-space, shell-like utility that can interpret a FAT32 file system image. The program must understand the basic commands to manipulate the...

For this C++ project, you will design and implement a user-space, shell-like utility that can interpret a FAT32 file system image. The program must understand the basic commands to manipulate the given file system image, must not corrupt the file system image, and should be robust. You may not reuse kernel file system code and you may not copy code from other file system utilities. You are restricted to only the C++ standard library. All requirements of the project are outlined in the project specification document. Follow the Project Guidelines and Hints document for help. The FAT32 specs from Microsoft has also been provided for reference. A sample Fat32 image file has been provided for testing. Please note that the deadline on this is strictly 2 days and cannot be extended.





Project specifications FAT32 File System Purpose The purpose of this project is to familiarize you with basic file-system design and implementation. You will need to understand various aspects of the FAT32 file system such as cluster-based storage, FAT tables, sectors, directory structure, and endianness. Problem Statement For this C++ project, you will design and implement a simple, user-space, shell-like utility that can interpret a FAT32 file system image. The program must understand the basic commands to manipulate the given file system image, must not corrupt the file system image, and should be robust. You may not reuse kernel file system code and you may not copy code from other file system utilities. Project Tasks You are tasked with writing a program that supports the following file system commands to a FAT32 image file. For good modular coding design, try to implement each command in one or more separate functions. Your program will take the image file path name as an argument and will read to it according to the different commands. You can check the validity of the image file by mounting it with the loop back option and using tools like hexedit. You will also need to handle various errors. When you encounter an error, you should print a descriptive message (e.g., when cd’ing to a nonexistent file you can do something like “Error, no such file or directory: foo”). Further, your program must continue running and the state of the system should remain unchanged as if the command were never called (i.e., don’t corrupt the file system with invalid data). For understanding the layout of FAT32, there will be a provided specification, but the best place to start is the FAT32 Wikipedia page: https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system List of Commands to be Implemented: 1: exit Safely close the program and free up any allocated resources. https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system 2: info Parse the boot sector (the FAT32 Extended BIOS Parameter Block in the wiki link) and print the values of each of the entries in order, one per line (e.g., Bytes per Sector: 512). Use your discretion on how to print the values (e.g., strings of decimal digits, hexadecimal digits, or ASCII characters), and on what to label each of the values. You are free to pick n >=7 (7,8, 9...) entries to print out. 3: ls DIRNAME Print the contents of DIRNAME including the “.” and “..” directories. For simplicity, just print the names. Print an error if DIRNAME does not exist or is not a directory. 4: cd DIRNAME Changes the current working directory to DIRNAME. Your code will need to maintain the current working directory state in order to do pathname resolution for the various files. Print an error if DIRNAME does not exist or is not a directory. 5: size FILENAME Prints the size of the file FILENAME in the current working directory in bytes. Print an error if FILENAME does not exist. 6: creat FILENAME Creates a file in the current working directory with a size of 0 bytes and with a name of FILENAME. Print an error if a file with that name already exists. 7: mkdir DIRNAME Creates a new directory in the current working directory with the name DIRNAME. Print an error if a file called DIRNAME already exists. 8: rm FILENAME Deletes the file named FILENAME from the current working directory. These needs remove the entry in the directory as well as reclaiming the actual file data. Print an error if FILENAME does not exist or if the file is a directory. 9: rmdir DIRNAME Removes a directory named DIRNAME from the current working directory. Make sure to remove the entry from the current working directory and to remove the data DIRNAME points to. 10: open FILENAME (read-only mode) Opens a file named FILENAME in the current working directory. A file can only be read from or written to if it is opened first. You will need to maintain a table of opened files and add FILENAME to it when open is called. Print an error if the file is already opened, if the file does not exist, or an invalid mode is used. 11: close FILENAME Closes a file named FILENAME. Needs to remove the file entry from the open file table. Print an error if the file is not opened, or if the file does not exist. 12: read FILENAME Read the data from a file in the current working directory with the name FILENAME. Start reading from the file’s stored offset and print the whole data inside the file as string. Print an error if FILENAME does not exist, if FILENAME is a directory, if the file is not opened for reading. 13: rmdir -r DIRNAME The -r option adds the ability to rmdir to delete a directory and its contents recursively. 14: rename FILENAME NEWFILENAME Renames a file or directory from FILENAME to NEWFILENAME. No need to worry about special directories like “.” or “..”. Print an error if FILENAME does not exist or NEWNAME already exists. Restrictions Only the C++ Standard Library is allowed to be used. Using other library headers is not acceptable. Your submission must include: ● All the source code file(s) ● Makefile (with description) ● README.txt file ○ A brief description of how your program works ○ How to compile your program using your Makefile ○ Known bugs or unfinished portions of the project ● Do not include binaries or executables ● Variable/functions names should indicate purpose with appropriate comments Allowed Assumptions ● File and directory names will not contain spaces ● File and directory names will be names (not paths) within the current working directory ● “.” (current directory) and “..” (parent directory) are valid names ● STRING will always be contained within “characters Microsoft Word - FAT32 Spec _SDA Contribution_.doc Microsoft FAT Specification Microsoft Confidential. © 2004 Microsoft Corporation. All rights reserved Page 1 Microsoft FAT Specification Microsoft Corporation August 30 2005 Microsoft makes this contribution to the SD Card Association ("SDA") pursuant to the SDA IPR Policy, with acknowledgement by the SDA Board of Directors of the following: © 2004 Microsoft Corporation. All rights reserved. Ownership. Microsoft retains ownership of its copyrights in and to the Microsoft Contribution. Nothing in SDA’s Intellectual Property Policy shall be construed as an assignment of such copyrights to SDA or any other person or entity. Microsoft acknowledges and will not challenge SDA’s assertion of copyright ownership according to SDA’s Intellectual Property Policy of final SDA specifications subject to the underlying copyrights in Microsoft’s Contribution and the terms hereof. Development License. Microsoft hereby grants to SDA and to each other Member a worldwide, irrevocable, non-transferable, non-sublicensable, royalty-free, non-exclusive, perpetual, fully-paid, copyright license under its copyrights in the Microsoft Contribution to use, copy, modify, disclose and create derivative works of such Microsoft Contribution for the sole purpose of incorporation (whether by express incorporation or incorporation by reference) of such Microsoft Contribution, and/or modifications thereof into any SDA Specifications, and for the development of any SDA Specifications. Publication License. Microsoft hereby grants to SDA a worldwide, irrevocable, non-transferable, royalty- free, non-exclusive, perpetual, fully-paid, copyright license (with the right to sublicense) under its copyrights in the Microsoft Contribution to use, copy, disclose, publicly display and perform, publish and distribute such Microsoft Contribution, and/or modifications thereof (which may be made by SDA or any Member), solely as part of and/or incorporated in (whether by express incorporation or incorporation by reference) one or more SDA Final Specification(s). No other rights are granted by implication, estoppel or otherwise. THE SPECIFICATION IS PROVIDED "AS IS," AND MICROSOFT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE SPECIFICATION ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. MICROSOFT WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE SPECIFICATION. DO NOT REDISTRIBUTE EXCEPT AS EXPRESSLY PERMITTED HEREIN Microsoft FAT Specification Microsoft Confidential. © 2004 Microsoft Corporation. All rights reserved Page 2 Table of Contents ......................................................................................................................................................... 1 Microsoft FAT Specification............................................................................................................. 1 Table of Contents ............................................................................................................................ 2 Overview and Purpose .................................................................................................................... 3 Section 1: Definitions and Notations................................................................................................ 4 1.1 Definitions:............................................................................................................................. 4 1.2 Notations ..........................................................................................................................
Nov 30, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here