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

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 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