P4: Multiple Volumes and Mounting

CEG 433/633: Operating Systems
Prabhaker Mateti

Weight 10%
   

This is Part 4 of the project for this term.  You are expected to build on your own previous work. The Project Expectations are all still applicable. Do not use source code files of others or even those of mine but from prior terms.

Be Considerate. Do make sure that you are using no more than 10 MB in your home directory.  The following will show your disk space usage:  du -s ~

Our goals in this part of the project are to be able to handle multiple disks and hence multiple file volumes.  Subdirectories are required so that mounting is possible.

1. Multiple Disks and Volumes

  1. We are still assuming that there is just one partition per disk.  Recall that P0 onwards, we already have:  mkfs disknm.dsk creates an initially empty file volume on the simulated disk named disknm.dsk.  This returns an unsigned integer known as the file-system-handle.  This can be the line number in diskParams.dat of disknm.dsk.
  2. Mounting of file volumes requires multiple directories.  If you consider the root directory to be at level 0, we must also have other directories at level 1 or higher as mount points.  Directories at level 1 are required, at levels > 1 can also be useful as mount points, but not necessary.
  3. Add the following method. The method uint FileVolume::mount33fs(char *mountPoint, uint fsHandle)mounts the file system given by the fsHandle on the directory mountPoint.  The method should verify that a file system with the given handle exists, and that mountPoint is a reachable subdirectory.  Return the volume number (in the high 16-bits) and i-node number (in the low 16-bits) of the mountPoint on success.  On failure, return 0. 
  4. As you know from the lectures, there is now a mount table maintained by the file system.
  5. A specific file in the tree is now identified by a pair of numbers: the volume handle, and the file's i-node in that volume.

2. SimDisk Process

Process SD remains as in Part P3 of the project.  P4 is the name of the enhanced shell process of this part of the project. In the P4-to-SD pipe, P4 now writes two numbers:  file-system-handle number, and the sector number.  The NX of the shared memory segments RDSHM and WRSHM now becomes, similarly, two numbers.

3. Enhancements

P3 functionality is expected, so only the additional elements are described below. Specifically mkdir and chdir should now work in the context of mounted volumes, within any current directory, not just the root.  Below we assume that volumes were made on disks named D1 and D2 based on data stored in diskParams.dat and their volume handles are 1 and 2 respectively.  Assume that current volume is 1.  The /d1/d2 used below is just an example; in general, it is a path name to a directory in the tree.

fs33% mount 2 /d1/d2
Mount the file volume numbered 2 at /d1/d2.  The contents of file volume 2 are now accessible.  Print the composite  number returned.  The old directory contents of /d1/d2 are now invisible; the new contents of /d1/d2 are the root directory contents of volume 2.
fs33% mount
with no arguments displays the mount table.  Look up the standard Unix commands named mount and df for guidance on what should be shown.
fs33% umount /d1/d2
Unmount the file volume at /d1/d2.  Note the missing `n' in the spelling.  The file volume 2  is now inaccessible.  The old directory contents of /d1/d2 are now visible.
fs33% quit
exits from this shell.  The disks and file volumes made so far remain persistent, and should be retrievable in the next session with our shell.  But, the mount table information is not required to be saved. .

4.Turn In

All submissions must be done in the OSIS Lab using the turnin program. We will be running your programs on the machines in OSIS Lab only.  For part 4, the command to use looks like this:

/home/ceg433/ceg43300/bin/turnin P4 *.cpp *.hpp Makefile *.txt



CEG 433/633: Operating Systems
Grading Sheet for

P4: Multiple Volumes and Mounting

Weight 10%
Instructor = Prabhaker Mateti
Grader = Greg Aselage
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.
Student OSIS Login ID Extra credit Points
Item description Max Points
Makefile successfully builds P4 and SD 10  
Shared mem segments corresponding to RDSHM and WRSHM coexist with P4 and SD 10  
Your testscript.txt should be designed so that all the P3  P1 functionality in the context of the new multiple volumes, nested directories, and files can be demonstrated. 10  
mount v1 dir-path-name (v1 is a volume handle) 10  
mount v2 dnm2 (v2 is a volume handle, and dnm2 is a dir in the volume mounted above) 10  
mount  (shows mounted volumes) 10  
umount 10  
write33file into a (non-root) subdirectory of a mounted volume 10
15
 
read33file from a (non-root) subdirectory of a mounted volume 10
15
 
mkdir and chdir work in the context of mounted volumes 10  
Extra credit points 50, if you implement transparent mount E50  
Extra credit points 50, if you implement the above and mount at least 4 layers E50  
Late submission: minus 2% per day late; Not accepted at all after 4 days -2%  
Files were not submitted using turnin program = minus 10 points -10  
Total 100  
 
Copyright © 2009 pmateti@wright.edu