Assignment 3: A Simple File System (SFS) Solution

$30.00 $26.40

Description

1 Introduction

  • In this assignment, you will implement utilities that perform operations on a simple le system, FAT12, used by

3MS-DOS.

  • 1.1 Sample File Systems

  • You will be given a le system image: disk.IMA for self-testing, but your submission may be tested against other

6disk images following the same speci cation.

7You should get comfortable examining the raw, binary data in the le system images using the program xxd.

8 2 Requirements

9 2.1 Part I

  1. In part I, you will write a program that displays information about the le system. In order to complete part I,

  1. you will need to understand the le system structure of MS-DOS, including FAT Partition Boot Sector, FAT File

  1. Allocation Table, FAT Root Folder, FAT Folder Structure, and so on.

  1. Your program for part I will be invoked as follows:

./diskinfo disk.IMA

  1. Your output should include the following information:

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:

15 2.2 Part II

  1. In part II, you will write a program, with the routines already implemented for part I, that displays the contents of

  1. the root directory in the le system.

  1. Your program for part II will be invoked as follows:

./disklist disk.IMA

  1. The directory listing should be formatted as follows:

1

20

21

22

23

24

25

26

  1. The rst column will contain:

    1. F for regular les, or

    1. D for directories;

followed by a single space

  1. then 10 characters to show the le size in bytes, followed by a single space

  1. then 20 characters for the le name, followed by a single space

  1. then the le creation date and creation time.

27 2.3 Part III

  1. In part III, you will write a program that copies a le from the le system to the current directory in Linux. If the

  1. speci ed le is not found in the root directory of the le system, you should output the message File not found.

  1. and exit.

  1. Your program for part III will be invoked as follows:

./diskget disk.IMA ANS1.PDF

  1. If your code runs correctly, ANS1.PDF should be copied to your current Linux directory, and you should be able

  1. to read the content of ANS1.PDF.

  1. 2.4 Part IV

  1. You will write a program that copies a le from the current Linux directory into the root directory of the le system.

  1. If the speci ed le is not found, you should output the message File not found. on a single line and exit. If the

  1. le system does not have enough free space to store the le, you should output the message No enough free space

  1. in the disk image. and exit.

  1. Your program will be invoked as follows:

./diskput disk.IMA foo.txt

  1. Note that a correct execution should update FAT and related allocation information in disk.IMA accordingly.

  1. To validate, you can use diskget implemented in Part III to check if you can correctly read foo.txt from the le

  1. system.

  1. 3 File System Speci cation

  1. The speci cation of FAT12 and related information could be found in Connex.

  1. 4 Byte Ordering

  1. Di erent hardware architectures store multi-byte data (like integers) in di erent orders. Consider the large integer:

  1. 0xDEADBEEF

  1. On the Intel architecture (Little Endian), it would be stored in memory as:

49

50

51

EF BE AD DE

On the PowerPC (Big Endian), it would be stored in memory as:

DE AD BE EF

  1. Since the FAT was developed for IBM PC machines, the data storage is in Little Endian format, i.e. the least

  1. signi cant byte is placed in the lowest address. This will mean that you have to convert all your integer values to

  1. Little Endian format before writing them to disk.

2

55 5 Submission Requirements

  1. What to hand in: You need to hand in a .tar.gz le containing all your source code, readme.txt,0 and a Make le

  1. that produces the executables (i.e., diskinfo, disklist, diskget, and diskput).

  1. The le is submitted through connex.csc.uvic.ca site.

  1. 6 Marking Scheme

  1. We will mark your code submission based on correct functionality and code quality.

  1. 6.1 Functionality

62

63

64

65

66

67

  1. Your programs must correctly output the required information in Part I, II, and III. One sample disk image is provided to you for self-learning and self-testing. Nevertheless, your code may be tested with other disk images of the same le system. We will not test your code with a damaged disk image. We will not disclose all test les before the nal submission. This is very common in software engineering.

  1. You are required to catch return errors of important function calls, especially when a return error may result in the logic error or malfunctioning of your program.

68 6.2 Code Quality

  1. We cannot specify completely the coding style that we would like to see but it includes the following:

70

71

72

73

74

75

76

77

78

79

80

81

  1. Proper decomposition of a program into subroutines (and multiple source code les when necessary)|A 1000 line C program as a single routine would fail this criterion.

  1. Comment|judiciously, but not profusely. Comments also serve to help a marker, in addition to yourself. To further elaborate:

    1. Your favorite quote from Star Wars or Douglas Adams’ Hitch-hiker’s Guide to the Galaxy does not count as comments. In fact, they simply count as anti-comments, and will result in a loss of marks.

    1. Comment your code in English. It is the o cial language of this university.

  1. Proper variable names|leia is not a good variable name, it never was and never will be.

  1. Small number of global variables, if any. Most programs need a very small number of global variables, if any. (If you have a global variable named temp, think again.)

  1. The return values from all system calls and function calls listed in the assignment speci cation should be checked and all values should be dealt with appropriately.

  1. 6.3 Detailed Test Plan

  1. The detailed test plan for the code submission is as follows.

Components

Weight

Make le

5

diskinfo

15

disklist

20

84

diskget

25

diskput

30

Readme

5

Total Weight

100

3

85 7 Warning

86

87

88

89

90

91

  1. You are required to use C. Any other language is not acceptable.

  1. Your code should output the required information speci ed in Parts I, II, III, and IV. Failing to do so will result in the deduction of scores.

  1. You should use the Linux machines in ECS242 or the server linux.csc.uvic.ca to test your work.

  1. The due date of this assignment is set to be very late.

THERE WILL BE NO FURTHER EXTENSION!

92 8 Plagiarism

  1. This assignment is to be done individually. You are encouraged to discuss the design of the solution and the FAT 12

  1. speci cation with your classmates, but each student must implement their own assignment.

4