P1: Links and Medium Size Files
|
|
|
This is Part 1 of the project for this term. Our goals in this part of the project is to (i) add the ability to store
and retrieve medium files, and (ii) to add hard and soft links in a file volume
built on the simulated disk of P0. Large files are not necessary in this part. This part deals with only one file volume at a time. No mounting is
involved.
You are expected to build
on your own work of P0. Do not use source code files of others or even
those of mine but from prior terms. The Project
Expectations are all still applicable.
Be Considerate. Do make sure that you are not using up too much space (say
> 10 MB) in your home directory. The following will show your disk space usage: du -s ~
1. Hard and Soft Links
From the lectures, you should know the definitions of hard and soft links. Resolve any missing detail in the semantics of links
so that it matches with that in Unix. (E.g., if you cd via a soft-link to directory D, where should you be after a cd .. ?)
- The i-nodes now need to have a link count field.
- The i-node types are now: ordinary-file, directory, soft-link.
DO's and DONT's:
- Do not permit hard links to directories.
- Do permit soft links to directories.
2. Medium Size Files
We define medium files as those using an i-node's (i) direct block
number entries, and (ii) requiring single-indirect blocks.
Large files are those using an i-node's (i) direct block
number entries, and (ii) requiring single-indirect blocks, and (iii) requiring double-indirect blocks For
bonus points, implement large files also.
Implement the commands described below. All the commands of the project so far should be working as they did before, but now
also should work for links and medium files; so only the additional elements are described below.
In your testscript, demonstrate each new command and that the old commands work with links and medium files. Note that the
addition of medium files does not bring in any "new" commands.
fs33% mkfs disknm
- creates an initially empty file volume, as before, on the simulated
disk named
disknm.dsk
. Note that the i-node height now includes not only the fileSize
field, but also the link count.
- fs33% ln opnm npnm
- creates
npnm
as a new hard link to opnm
, and prints its i-node number. It creates
nothing new and returns 0 in the following "abnormal" cases: a) opnm
is a directory; b) no ordinary file with
opnm
as its path name exists; c) npnm
already exists; d) npnm
is an invalid pathname.
- fs33% ln opnm .
- creates a hard link named the same as the leaf name of
opnm
in the current directory and prints its i-node
number. Abnormal cases similar to the above apply. For bonus points, add the flexibility that this command may omit the dot.
- fs33% ln -s opnm npnm
- creates
npnm
as a soft link to opnm
, and prints its i-node number. It creates nothing new
and returns 0 in the following "abnormal" cases: a) opnm
does not exist; b) npnm
already exists; c)
npnm
is an invalid pathname.
- fs33% rm pnm
- removes the pathname
pnm
, which may or may be a link, and prints the resulting link count.
4. Turn In
All projects need to be submitted via
Pilot.
|
Bonus points are awarded in recognition of good work and extra work,
in addition to the max possible points. Quality is subjectively
judged. Merely turning in a file will not receive full score.
Some items have a cascading effect. Bonus points are extra credit
points. |
Item description |
Max |
Points |
Your testscript.txt should be
designed so that all the P0-functionality
in the context of the new links and medium sized files
can be demonstrated, including robustness. |
5 |
|
Your P1 successfully navigates your own testscript.txt .
( If yours is too simple, we may run it through our script that you
will get to see only after the due date.) |
5 |
|
ln opnm npnm |
5 |
|
ln -s opnm npnm |
10 |
|
cd link-to-dir |
10 |
|
cd .. after the above |
5 |
|
cp hard-link-pnm pnm |
5 |
|
cp soft-link-pnm pnm |
10 |
|
rm hard-or-soft-link-pnm |
10 |
|
mv soft-link-pnm pnm |
10 |
|
mv hard-link-pnm pnm |
5 |
|
inode updated to show all i-node fields |
10 |
|
Medium files |
10 |
|
ln opnm no-dot (bonus points) |
B10 |
|
Large files (bonus points) |
B50 |
|
Files were not submitted using pilot = minus 10
points |
-10 |
|
Total |
100 |
|