Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Provide the code for a very basic file system which can be mounted using fuse in linux. Use REPY to simplify the problem. The file system does not need to be large, but should simulate the problems related to working with block devices. We must support directories and files of various sizes up to a reasonable size.
Limitations: Which the file system will not be used extensively, it should be able to support, at least, a few different files with varying sizes. Assume the following limits on the file system:

Maximum number of blocks 10,000
Maximum file size 1,638,400 bytes
Block size 4096 bytes

Prior assumptions: You must have access to a Linux machine. You do not need root access to the system and I would recommend that you have this in a VM so that it is easier to access and restart. Use virtualbox and install Ubuntu 12.04LTS for this.
Step 1)
The Seattle project website has loaded all of the material you need to begin creating your own file system in Linux. Follow the directions on that page and make sure that you can mount Prof. Cappos' file system successfully.

Step 2)
The logical layout of our file system will differ from Prof. Cappos' considerably. His file system stores the entire contents of a file in a single file on the "host" file system. Since we are trying to simulate a block device, that will not work as the maximum file size could be larger than a single block.
Our layout will consist of a given number of blocks, each existing as a single file on the "host" file system with the name "linddata.X" where X is a numeric value from zero to one less than the maximum number of blocks. Each block is preallocated (upon filesystem creation) with all zeros and stored on the host file system.
Since we will need to store more than just the files, we will use block (file) zero as the "super" block. The super block will contain any information we wish to make persistent about the file system including its creation time, number of times it was mounted, the device_id (always 20), the location of the start and end of the free block list, the location of the root directory block and the maximum blocks in the system. The super block will look like the following:
superBlock = {'creationTime': 1376483073, 'mounted': 50, 'devId':20, 'freeStart':1, 'freeEnd':25, 'root':26, 'maxBlocks':10000}
Start by either modifying Prof Cappos' lind_fs_calls.py or the blank template provided so that on initial mounting, the blank file system is created. The function that Prof. Cappos uses to create his file system is "_blank_fs_init()." In each free block, you should store the blocks which are available for data/inode storage. You may assume that this is an array of numbers indicating the available blocks. Since we have a limited storage in each block, you should evenly distribute the list of free block among all of the available blocks in the free block list. For ex, block 1 (the first in the free block list) would, initially, contain an array of 374 blocks starting from 27 and continuing. Block 2 would contain an array of 400 blocks starting from 401 and continuing to 800. Yes, this means that we must aggregate the 25 blocks to find all the free blocks, but that's not unusual for a block device.
Step 3)
Since we are simulating a real block device here, we need to store directory information for each directory. The directory will fit into one block (in a real block device we would consider the possibility that the directory exceeded the block size, but let's not add too much complexity). We can trust that each directory will have the following format:
{'size':1033, 'uid':1000, 'gid':1000, 'mode':16877, 'atime':1323630836, 'ctime':1323630836, 'mtime':1323630836, 'linkcount':4, 'filename_to_inode_dict': {'ffoo':1234, 'd.':102, 'd..':10, 'fbar':2245}}
The first letter of the name in the filename_to_inode_dict will indicate that it is a file "f' directory "d" or special "s". This letter is NOT part of the filename, just a descriptor to tell you what type of inode to expect.

Now it's time to create the root directory
{'size':0, 'uid':DEFAULT_UID, 'gid':DEFAULT_GID, 'mode':S_IFDIR | S_IRWXA, 'atime':1323630836, 'ctime':1323630836, 'mtime':1323630836, 'linkcount':2, 'filename_to_inode_dict': 
{'d.':rootDirectoryInode,'d..':rootDirectoryInode}
Set rootDirectoryInode to the value in the superblock and prepare it out using the persist function.
Each time a new directory is created, you must allocate a new block (take the first available block from the free block list), store the directory information in the format, and add the new block to the parent's filename_to_inode_dict.

Step 4)
Files need to be handled carefully in the file system. The format for a file's inode information will be: 
{'size':1033, 'uid':1000, 'gid':1000, 'mode':33261, 'linkcount':2, 'atime':1323630836, 'ctime':1323630836, 'mtime':1323630836, 'indirect':0 'location':2444}
This data will be stored in the inode location referenced in the filename_to_inode_dict entry in the parent directory. When a file is created, we must consider how large it is. Since our file system can only handle blocks of 4096 bytes or less, we have to use a level of indirection if we want to store a file larger than that size. Should we need to store a file of between 4097 and 1,638,400 bytes, we need to use an index block. The index block is simply an array of pointers to other blocks. Since we will not be handling anything larger than 1,638,400 bytes, and 400 pointers will easily fit into an index block, we need only a single level of indirection.
We will use the "indirect" field in the inode table to indicate if the "location" field is referencing file data or an index block.

Step 5)
Now adjust/prepare the necessary functions inside the lind_fs_calls.py file to perform all the necessary tasks for this file system. Most of the functions under "The actual system calls..." are what need to be modified.  

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M980333
  • Price:- $85

Guranteed 48 Hours Delivery, In Price:- $85

Have any Question?


Related Questions in Computer Engineering

Be sure to show the equation and proportion from table you

Be sure to show the equation and proportion from table you used to calculate your answer 1) What is the upper arm weight for a 70 kg male? 2) What is the torso mass for a 65 kg female? 3) What is the weight of the right ...

In powerpoint what is beneficial about the usage or video

In Powerpoint, what is beneficial about the usage or Video, Audio, Animation, and Photos with Effects during presentation and work. What are some useful tools you found that would improve performance?

1 explain the different elements of property rights provide

1. Explain the different elements of property rights. Provide an example of how the US economy infringes on each. 2. Explain why inequality is considered to be a social "bad" by many people. In what way could inequality ...

What does it mean when a bank has lower derivative assets

What does it mean when a bank has lower derivative assets than derivative liabilities on foreign exchange related contracts and vice-versa? What implications does this have with foreign exchange risk for the bank?

The rooted fibonacci trees tn are defined recursively in

The rooted Fibonacci trees T n are defined recursively in the following way. T 1 and T 2 are both the rooted tree consisting of a single vertex, and for n = 3, 4, ...., the rooted tree T n is constructed from a root with ...

Question rivests distinguished point dp method is a

Question : Rivest's "distinguished point" (DP) method is a variable length hash chain where all chain end points have the same d-bit suffix. In the precomputation phase, a chain is computed until a value is output with t ...

Question what is static and dynamic binding explain with

Question : What is static and dynamic binding? Explain with example how you can implement dynamic binding. The response must be typed, single spaced, must be in times new roman font (size 12) and must follow the APA form ...

Suppose i am designing a personnel database for a

Suppose I am designing a personnel database for a university. The university has three types of personnel: students, staff, and faculty. Here are the characteristics of the three groups: -All three groups have a name and ...

Answer the following question what is the relationship

Answer the following Question : What is the relationship between eminent domain and condemnation? What is the essential difference between prescription and dedication? Describe the major differences between a right-of-wa ...

Question suppose that in game of chance you bet an initial

Question : Suppose that in game of chance, you bet an initial amount of money, and every time you play, the money is doubled with probability p and halved with probability 1 - p. (a) What value of p gives you an expected ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As