Welcome to CEG4350/CEG6350 – Operating Systems P2: Subdirectories, and Moving Files CEG 4350/6350: Operating Systems Download source.tar.bz2 The project for the current term is to implement (on a simulated disk) a file system based on the design explored in the lectures. This project is divided into four pieces. You must read and follow the Project Expectations. Study the grading sheet given below. This is Part 0 of the project for this term. You are expected to study and modify the source code files given in source.tbz and achieve the functionality described below. 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 not using up too much space (say > 10 MB) in your home directory. The following will show your disk space usage: du -s ~ 1. Studying a Program By the time P2 is due, we would have covered the essentials of our File Sys project. The tar ball source.tbz is a collection of files given so that (i) you can get started quickly with our project, and (ii) you can see the style of how larger systems programs are written. Download source.tbz from the link above. In the OSIS Lab, it can be un-tar-ed as follows: tar xvvfj source.tbz The functionality of source.tbz is described in What Is Given. Some details of the code are/were explained in the lectures and in ReadMe.txt. Study the provided source code so thoroughly that you could have written it. Then, answer the itemized questions below in a file named answers.txt. The following are standard library routines:fopen, fclose, fread, fwrite, fstat, fscanf, fprintf, sprintfLook up their functionality in both the Stevens’ book and the on-line man pages. Describe their functionality briefly, one sentence each, in your own words.List the names of 5 standard library routines other than the above, and 5 system calls used by the code of P2.In the file simDisk.C, what is the point in verifying that statBuf.st_size == nSectorsPerDisk * nBytesPerSector?Study the Notes on Programming in C, by Rob Pike. All of it is “very” applicable to C++ also. For five identifiers used in the given source code, (i) either suggest better alternate names and defend why they are better, or (ii) explain why you are comfortable with the names as-they-are.Write the pre- post conditions foruint FileVolume::read33file(byte *fs33leaf, byte *unixFilePath)uint FileVolume::write33file(byte *unixFilePath, byte *fs33leaf) 2. Learn to Use GDB Coming into the course, you are expected to be comfortable with gdb. Debugging large programs requires the construction of (extra) observer methods. Using gdb or some other debugger is not as effective as invoking observers and studying their output in a peaceful place (“under a tree”). Nevertheless, gdb can be useful as a last resort, and you must be able to use it well. Start script. Make P2 as given. Run our program P2 through gdb.Set a breakpoint at immediately after setArgsGiven(buf, arg, types, nMax); Examine the values of buf, arg, types, nMax.Type in a command to our shell to make a file volume. Trace the execution from the above breakpoint onwards by single stepping until after simDisk is initialized in mkSimDisk().Set a breakpoint at the bottom of the SimDisk constructor. Examine the value of diskName.Type in a wrdisk request followed by a rddisk. Verify that the results match.End the script. Turn in this script as a file named gdbSession.txt 3. Additions and Improvements Part of large program development is independently, but wisely, deciding what to do for certain “erroneous” situations. Should we ask the professor for what to do for every possible error you can think of? [Answer: No. You think about it. You take a reasonable action. You document this in your source code, and in ReadMe.txt. And, be ready to defend your choice should it be questioned.] Should SimDisk() constructor printf or cout>> an error message? [No.] When does/should mkSimDisk() return a zero? [Think.] Remember that one of the goals of CEG 433/633 is to make you think about larger programs. Part of this is to supply missing, but needed, details in the problem description. 3.0 What Is Given As given, the files of source.tbz implement the following. fs33% mkfs disknm creates an initially empty file volume on the simulated disk named disknm.dsk. The maxfnm, the number of i-nodes, and the i-node height are all given in the diskparams.dat file corresponding to the line for disknm. The file volume so constructed is the current file volume as used below. The height does include the fileSize field. If disknm.dsk is not already created, do so now.The names of 433-files are at most maxfnm characters long. Valid characters in file names are a-z, A-Z, 0-9, hyphen (minus), and period (‘.’); all other characters (spaces, slashes, control characters, etc.) are illegal. maxfnm is given in diskparams.dat. Here is an example diskparams.dat. Lines starting with # are comments. For clarity, I have lined-up the columns, but the actual diskparams.dat may not do so. # diskName nBlocks nBytesPerSector maxFnm nInodes iNodeHt D1 128 512 8 20 3 D2 1024 256 16 100 8 fs33% cp @P0/test0.cpp myfile.txt copies P0/test0.cpp from your Linux (indicated by the @ sign) current working directory to the current (for now, root) directory of the current file volume, as a file named myfile.txt and prints to stdout the i-node number of myfile.txt. If myfile.txt already exists, the new content silently replaces it. (In the cp commands, we need to simultaneously deal with path names of files in 433-file-volume and Linux. Only in such cases, the latter are prefixed with the @ symbol.) fs33% cp myfile.txt @P0/test1.cpp copies myfile.txt of the current file volume to P0/test1.cpp of your Linux current directory and prints to stdout the i-node number of myfile.txt. If P0/test1.cpp already exists, it is silently replaced. fs33% cp myfile.txt file2.txt copies myfile.txt of the current file volume to file2.txt of the current volume and prints to stdout the i-node number of file2.txt. If file2.txt already exists, the new content replaces it. fs33% ls prints a listing, much like the Unix ls -lisa, of all the files in the root directory of the current file volume. fs33% rm myfile.txt remove the file named myfile.txt from the root directory and prints to stdout the i-node number that myfile.txt had. If the file named myfile.txt does not exist, be quiet and print 0. fs33% inode 4 prints the contents of i-node numbered 4, if it exists, of the current file volume. Here is a stdTestScriptP2.txt. Use it as in ./P2