Starting from:

$29.99

A Simple File System (SFS): Assignment 3

Assignment 3: A Simple File System (SFS)
1 Introduction
In this assignment, you will implement utilities that perform operations on a simple file system, FAT12, used by2 MS-DOS.
1.1 Sample File Systems
You will be given a file system image: disk.IMA for self-testing, but your submission may be tested against other disk images following the same specification. You should get comfortable examining the raw, binary data in the file system images using the program xxd.7
2 Requirements8
2.1 Part I9
In part I, you will write a program that displays information about the file system. In order to complete part I,10 you will need to understand the file system structure of MS-DOS, including FAT Partition Boot Sector, FAT File11 Allocation Table, FAT Root Folder, FAT Folder Structure, and so on.12 Your program for part I will be invoked as follows:13
./diskinfo disk.IMA
Your output should include the following information:14
OS Name: Label of the disk: Total size of the disk: Free size of the disk:
============== The number of files in the root directory (not including subdirectories):
============= Number of FAT copies: Sectors per FAT:
2.2 Part II15
In part II, you will write a program, with the routines already implemented for part I, that displays the contents of16 the root directory in the file system.17 Your program for part II will be invoked as follows:18
./disklist disk.IMA
The directory listing should be formatted as follows:19
1
1. The first column will contain:20
(a) F for regular files, or21 (b) D for directories;22
followed by a single space23
2. then 10 characters to show the file size in bytes, followed by a single space24
3. then 20 characters for the file name, followed by a single space25
4. then the file creation date and creation time.26
2.3 Part III27
In part III, you will write a program that copies a file from the file system to the current directory in Linux. If the28 specified file is not found in the root directory of the file system, you should output the message File not found.29 and exit.30 Your program for part III will be invoked as follows:31
./diskget disk.IMA ANS1.PDF
If your code runs correctly, ANS1.PDF should be copied to your current Linux directory, and you should be able32 to read the content of ANS1.PDF.33
2.4 Part IV34
You will write a program that copies a file from the current Linux directory into the root directory of the file system.35 If the specified file is not found, you should output the message File not found. on a single line and exit. If the36 file system does not have enough free space to store the file, you should output the message No enough free space37 in the disk image. and exit.38 Your program will be invoked as follows:39
./diskput disk.IMA foo.txt
Note that a correct execution should update FAT and related allocation information in disk.IMA accordingly.40 To validate, you can use diskget implemented in Part III to check if you can correctly read foo.txt from the file41 system.42
3 File System Specification43
The specification of FAT12 and related information could be found in Connex.44
4 Byte Ordering45
Different hardware architectures store multi-byte data (like integers) in different orders. Consider the large integer:46 0xDEADBEEF47 On the Intel architecture (Little Endian), it would be stored in memory as:48
EF BE AD DE49
On the PowerPC (Big Endian), it would be stored in memory as:50
DE AD BE EF51
Since the FAT was developed for IBM PC machines, the data storage is in Little Endian format, i.e. the least52 significant byte is placed in the lowest address. This will mean that you have to convert all your integer values to53 Little Endian format before writing them to disk.54
2
5 Submission Requirements55
What to hand in: You need to hand in a .tar.gz file containing all your source code, readme.txt,0 and a Makefile56 that produces the executables (i.e., diskinfo, disklist, diskget, and diskput).57 The file is submitted through connex.csc.uvic.ca site.58
6 Marking Scheme59
We will mark your code submission based on correct functionality and code quality.60
6.1 Functionality61
1. Your programs must correctly output the required information in Part I, II, and III. One sample disk image is62 provided to you for self-learning and self-testing. Nevertheless, your code may be tested with other disk images63 of the same file system. We will not test your code with a damaged disk image. We will not disclose all test64 files before the final submission. This is very common in software engineering.65
2. You are required to catch return errors of important function calls, especially when a return error may result66 in the logic error or malfunctioning of your program.67
6.2 Code Quality68
We cannot specify completely the coding style that we would like to see but it includes the following:69
1. Proper decomposition of a program into subroutines (and multiple source code files when necessary)—A 100070 line C program as a single routine would fail this criterion.71
2. Comment—judiciously, but not profusely. Comments also serve to help a marker, in addition to yourself. To72 further elaborate:73
(a) Your favorite quote from Star Wars or Douglas Adams’ Hitch-hiker’s Guide to the Galaxy does not count74 as comments. In fact, they simply count as anti-comments, and will result in a loss of marks.75 (b) Comment your code in English. It is the official language of this university.76
3. Proper variable names—leia is not a good variable name, it never was and never will be.77
4. Small number of global variables, if any. Most programs need a very small number of global variables, if any.78 (If you have a global variable named temp, think again.)79
5. The return values from all system calls and function calls listed in the assignment specification80 should be checked and all values should be dealt with appropriately.81
6.3 Detailed Test Plan82
The detailed test plan for the code submission is as follows.83
Components Weight Make file 5 diskinfo 15 disklist 20 diskget 25 diskput 30 Readme 5 Total Weight 100
84
3
7 Warning85
1. You are required to use C. Any other language is not acceptable.86
2. Your code should output the required information specified in Parts I, II, III, and IV. Failing to do so will87 result in the deduction of scores.88
3. You should use the Linux machines in ECS242 or the server linux.csc.uvic.ca to test your work.89
4. The due date of this assignment is set to be very late.90 THERE WILL BE NO FURTHER EXTENSION

More products