Question: You are asked to develop a Minix Disk program that allows users to access a Minix disk locally mounted on a computer. You are expected

You are asked to develop a Minix Disk program that allows users to access a Minix disk locally mounted on a computer. You are expected to use C programming language. In your program, all Minix file I/O related operations must use the system calls discussed in our lectures, including open(), close(), read(), lseek(), and you should not use those library functions, like fopen(), fclose(), fread(), and etc, for doing file I/O.
In this project, you may assume the block size is 1024 bytes.
Required modules:
Minix client environment (a minix console): the console (interface) that allows users to operate on a minix disk by using the following commands:
help (5 points): prints the commands supported in this minix console.
minimount [image file](5 points): mount a local minix disk, name as a iminix image file, e.g., imagefile.img .
note: mounting a minix disk is equivalent to open the image.
miniumount (5 points): umount the mounted minix disk.
showsuper (20 points): to list the information of the super block. For example,
minix: showsuper
number of inodes: 3424
number of zones: 10240
number of imap_blocks: 1
number of zmap_blocks: 2
first data zone: 112
log zone size: 0
max size: 268966912
magic: 5007
state: 0
zones: 0
Note: the above numbers should be extracted from the minix disk rather than being hard coded (you won't received any credit for the hard coding).
traverse [-l](40 points): list the content in the root directory. Note that you don't have to show the "." and "..". For example,
minix: traverse (20 points)
A.cla
Aloop1.cla
Aloop1.jav
Aloop2.cla
Aloop2.jav
Aloop3.cla
Aloop3.jav
B.cla
Condit.cla
Condit.jav
D.cla
Demo.cla
Demo.jav
dir1
PolyTest.cla
PolyTest.jav
some.cla
some.java
When switch -l is turned on (long list), all detailed information is shown, including the file type, 9 permission bits, user ID, file size (in bytes), last modified date (with year), and the file/path name. For example:
minix: traverse -l (20 points)
-rw-rw-r--1000670 Sep 202012 A.cla
-rw-r--r--1000763 Dec 142010 Aloop1.cla
-rw-r--r--1000333 Dec 142010 Aloop1.jav
-rw-r--r--1000786 Dec 142010 Aloop2.cla
-rw-r--r--1000404 Dec 142010 Aloop2.jav
-rw-r--r--1000786 Dec 142010 Aloop3.cla
-rw-r--r--1000408 Dec 142010 Aloop3.jav
-rw-rw-r--1000358 Sep 202012 B.cla
-rw-r--r--10001067 Dec 142010 Condit.cla
-rw-r--r--1000444 Dec 142010 Condit.jav
-rw-rw-r--1000508 Sep 202012 D.cla
-rw-r--r--1000967 Dec 142010 Demo.cla
-rw-r--r--1000648 Dec 142010 Demo.jav
drwx------1000128 Oct 272014 dir1
-rw-rw-r--1000630 Sep 202012 PolyTest.cla
-rw-rw-r--10001063 Sep 202012 PolyTest.jav
-rw-r--r--1000226 Dec 142010 some.cla
-rw-r--r--1000278 Dec 142010 some.java
Hint: the mode field (a 2-byte unsigned integer) in inode struct uses the following flags:
S_IFMT 0170000 bit mask for the file type bit fields
S_IFSOCK 0140000 socket
S_IFLNK 0120000 symbolic link
S_IFREG 0100000 regular file
S_IFBLK 0060000 block device
S_IFDIR 0040000 directory
S_IFCHR 0020000 character device
S_IFIFO 0010000 FIFO
S_ISUID 0004000 set-user-ID bit
S_ISGID 0002000 set-group-ID bit (see below)
S_ISVTX 0001000 sticky bit (see below)
S_IRWXU 00700 mask for file owner permissions
S_IRUSR 00400 owner has read permission
S_IWUSR 00200 owner has write permission
S_IXUSR 00100 owner has execute permission
S_IRWXG 00070 mask for group permissions
S_IRGRP 00040 group has read permission
S_IWGRP 00020 group has write permission
S_IXGRP 00010 group has execute permission
S_IRWXO 00007 mask for permissions for others (not in group)
S_IROTH 00004 others have read permission
S_IWOTH 00002 others have write permission
S_IXOTH 00001 others have execute permission
showzone [zone number](10 points): show the ASCII content of the specified zone number (1024 bytes for each zone). If the value is not ASCII, just print the spaces instead. Tip: the library function isprint() can be used to determine whether the given byte is an ASCII. Obviously, this command is actually a very useful debugging tool. For example,
minix: showzone 112
0123456789 a b c d e f
0.
10
20..
30
40 A . c l a
50
60 A l o o p 1. c l a
70
8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!