COMP3430Operating SystemsHomeROASSLecturesAssignmentsLabsResourcesAssignment 4: File SystemsDue: April 4, 11:59pmWrite a program that reads a FAT 16-formatted drive. For this assignment we will use disk image -though you are encouraged to read a USB ashdrive as a raw device (ie. /dev/disk3).Your program requires 2 functions:1. Print information about the drive. The command, assuming your program is named fat16,would be ./fat16 imagename info. Print out the following:Drive nameFree space on the drive in kBThe amount of usable storage on the drive (not free, but usable space)The cluster size in number of sectors, and in KB.2. Output all lesand directories on the drive. The output should look roughly like the outputfrom tree, where there is the same number of - characters as the depth of the le/folder.The command, assuming your program is named fat16, would be ./fat16 imagenamelistOutput should look something like:file.txtDirectory: FOLDER-Directory: FOLDER2--Directory: FOLDER3---File: THEFILE.TXTfile2.txt3. Be able to fetch, and return a lefrom the drive3/18/2019 Assignments - COMP3430http://www.cs.umanitoba.ca/~comp3430/assignments/assignment4/ 2/4The command, assuming your compiled program name is fat16, would be ./fat16imagename get path/to/file.txtTo work with the disk / disk image, use the low-level, unbueredopen, close, read, write, andlseek system calls. This will save you headaches, buering,conversions, etc., and let you workon the byte level.You have been provided with a Microsoft white paper on their FAT lesystems (Fat12/16/32). Youwill only worry about the FAT32 short name implementation so you should use yourdiscretion on reading.Also, the minimal header lefat.h provides a struct data structure for the boot sector. Inaddition to any other data structures you may need for your implementation, you will need tocreate a similar struct for the FSInfo type. Note the datatypes used instead of the standard int,etc. Note carefully the #pragma commands used and use them for any structures that you tiedirectly to reading from disk (what do these do and why are they important?http://en.wikipedia.org/wiki/Data_structure_alignment)Finally, youve been provided with a disk image for testing.DirectoriesDirectories (aka folders) are simply leson disk with a special format. There are some goodthings to note before reading a directory:The rstbyte of an entry tells you things such as whether the entry is empty or if it’s the lastentry.You will ndempty entries interspersed through the directory. Do not stop searching on anempty entry! Only the last one!A directory lecan be quite large and span multiple clusters (Check in the FAT!), so don’t juststop at one cluster.The most confusing part here is that you will ndwhat appear to be garbage entries.Fat12/16 only supported 8-character lenames with a 3-character extension. Fat32 addedlong lenamesupport but did it in a way that is backward compatible - old Fat12/16systems would only see an 8-char version. E.g., lesomelongfilename would show up asSOMELO~1 - you may have seen such lesup until the mid 2000s. The full lenameishidden across several extra added directory entries. For this assignment we will use theshort names only (much simpler) and can skip the llerentries. Note that you can lteroutthese unwanted long-name additional entries by lteringagainst the ATTR_LONG_NAMEattribute.An additional side eectis that everything in FAT12/16 was uppercase, so you should stickto uppercaseDirectory entries inside a directory point to the cluster where another directory leis stored- look in that leto see what is in the directoryMemory and Data Types3/18/2019 Assignments - COMP3430http://www.cs.umanitoba.ca/~comp3430/assignments/assignment4/ 3/4Integer overowsand memory layout and alignment are serious issues in this assignment. Note#pragma comment above. When dealing with addressing specicbytes of a le(or disk.) and youseek using the lseek command, you can easily get bytes addressed well out of range of astandard 32 bit integer, particularly if it is signed. When dealing with addresses use the explicituint32_t family of types to be sure you have enough memory, and use the off_t type (leoset,as in man lseek) to be safe. In addition, you will want to add the following line to the TOPof your main source lebefore you load the system libraries:#define _FILE_OFFSET_BITS 64This tells the compiler to make the off_t 64 bits wide instead of 32 bits. This is more important ifyou are implementing FAT32 (the bonus). Further, it is recommended that you think of readingand writing to disk in units of sectors and clusters. Not only for eciencyreasons, but it will helpyou conceptualize the assignment a lot easier. Try to work in sectors and clusters as much aspossible and only convert to bytes when necessary (e.g., when doing a seek and read)Disk layout1. Reserved Area - boot sector and bios parameter block (BPB) at sector 0 (1 sector only).Read sector 0 directly into the fatBS struct provided.2. FAT Area - File allocation table (list of 16-bit entries). Immediately follows the reserved area.3. Data Area - Most of the disk. All the ledata is stored in here, directory entries are storedin here. NOTE: The rstcluster of this area is ociallycalled Cluster 2 regardless of where itstarts on the disk. The space used by the proceeding two areas is quite denitelymore than2 clusters large (which would only be ~8k on many disks) luckily, from here the followingclusters are of the appropriate size.NotesThe top 2 addresses of the FAT are are signatures. You must validate these signaturesbefore using the lesystemThe FAT can be quite large so do not load the entire FAT into memory at once.Be very careful with unit types! You will need to work in sectors, clusters, and bytes, atdierenttimes. Maybe create functions to convert the types.How to get started (just suggestions)1. You will most likely get overows,null pointers, etc. Some bad math and who knows whereyoull end up on disk (or in memory!). Be extremely defensive in your programming.2. Check parameters, ranges, and printf meaningful error messages. This will save youdebug time3. First, load and parse the boot sector / BPB into the struct and write your info function asmuch as possible. CHECK THE SIGNATURE BYTES. This tells you if you loaded it correctly.4. Calculate the location of the FAT and check the FAT Signature3/18/2019 Assignments - COMP3430http://www.cs.umanitoba.ca/~comp3430/assignments/assignment4/ 4/45. Implement methods to read specicfat items for disk clustersHandinInclude a makeleto build your assignment, with proper build and clean rules. Make sure torun make clean before handing in your assignment. A penalty of 25% of your nalmarkwill apply, if your submission contains temporary les(including the sample disk image! DoNOT submit it...)Include a readme, that explains how to build and run your assignment.Your assignment must run on the CS Aviary lab computers.A completed copy of your the honesty declaration for this assignment.BonusImplement FAT32, in addition to FAT16. Choose the driver appropriately based on the signature.本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp