C语言代写 | CSc 360: Operating Systems Assignment 3

本次加拿大代写是关于C语言操作系统相关的一个Assignment

1 Introduction

In this assignment, you will implement utilities that perform operations on a simple file system, FAT12, used by MS-DOS.
1.1 Sample File Systems

ou 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.

Requirements
2.1 Part I

in part I, you will write a program that displays information about the file system. In order to complete part I, you will need to understand the file system structure of MS-DOS, including FAT Partition Boot Sector, FAT File  Allocation Table, FAT Root Folder, FAT Folder Structure, and so on.
For example, your program for part I will be invoked as follows: ./diskinfo disk.IMA 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 disk (including all files in the root directory and files in all subdirectories)
=============
Number of FAT copies:

Sectors per FAT:

Note 1: when you list the total number of files in the disk, a subdirectory name is not considered  as a normal file name and thus should not be counted.

Note 2: For a directory entry, if the field of “First Logical Cluster” is 0 or 1, then this directory  entry should not be counted.

Note 3: Total size of the disk = total sector count * bytes per sector

Note 4: Free size of the disk = total number of sectors that are unused (i.e., 0x000 in an FAT  entry means unused) * bytes per sector. Remember that the first two entries in FAT are reserved.

2.2 Part II

In part II, you will write a program, with the routines already implemented for part I, that displays the contents of the root directory and all sub-directories (possibly multi-layers) in the file system.

Your program for part II will be invoked as follows:
./disklist disk.IMA Starting from the root directory, the directory listing should be formatted as follows:

Directory Name, followed by a line break, followed by “==================”, followed by a line break.

List of files or subdirectories:

– The first column will contain:

* F for regular files, or

* D for directories;

followed by a single space

– then 10 characters to show the file size in bytes, followed by a single space

– then 20 characters for the file name, followed by a single space

– then the file creation date and creation time.

– then a line break.

Note: For a directory entry, if the field of “First Logical Cluster” is 0 or 1, then this directory entry should be skipped and not listed.