$24
Assignment
(10 pts) A UNIX le system has 4096-byte blocks (this is typical) and 4-byte disk addresses. What is the maximum le size if i-nodes contain 12 direct block entries, and one single, double, and triple indirect entry each?
(30 pts) Write a C program that starts at a given directory and descends the le tree from that point recording the sizes of all the les it nds. When it is all done, it should print a histogram of the le sizes using a bin width speci ed as a parameter (e.g., with 1024, le sizes of 0 to 1023 go in one bin, 1024 to 2047 go in the next bin, etc.).
(60 points) You’ve been using tar and zip to archive and turn in your assignments. Write an archiving utility in C that allows you to create an archive, and add, list, and extract les. Call it... gunk. It should have the following capabilities:
(20 points)
./gunk -a myarchive somefile
Gunk should add (hence the -a) the le somefile to the archive le myarchive. Subse-quent calls to add to the same archive should result in the additional les being added to the archive.
(20 points)
./gunk -l myarchive
Gunk should list only the names of the les stored in the speci ed archive.
(20 points)
./gunk -e myarchive somefile
Gunk should extract the named le from the archive, creating a new le with the same name and containing the exact same data as the original and stored les. Careful not to overwrite something you can’t live without.