Question: I need help implementing a SFS, any help is greatly appreciated! Part 2: Simple File Svstem (SFS SFS consists of two parts: management functions and

 I need help implementing a SFS, any help is greatly appreciated!Part 2: Simple File Svstem (SFS SFS consists of two parts: management

I need help implementing a SFS, any help is greatly appreciated!

Part 2: Simple File Svstem (SFS SFS consists of two parts: management functions and access functions. The interfaces to management functions are defined next This function creates the new file system on the virtual disk specified by disk name. As part of this function, you should first invoke open disk ) to create a new disk. Then, create (and initialize) the necessary on disk structures for your file system. The function returns 0 on success, and -1 on failure (when the disk could not be created, opened, or properly initialized.) int mount sfs (char *disk name) This function mounts the disk (disk_name). The on disk structures are read into memory to handle the file system operations. The function returns 0 on success, and -1 on failure This function unmounts the disk (disk name) from your file system. All the meta data and file system related data that are on memory should be wrote into appropriate on disk structures. Finally, it should call close disk() . The function returns 0 on success, and-1 on failure Next, you need to implement the following access routines int sfs open (char file name) The file (file_name) is opened for reading and writing. This function returns the file descriptor of the file on success and -1 on failure. Note that the same file may opened many times, and for each open call a different file descriptor should be returned. The maximum number of files that can remain opened at a time is specified by constant MAX OPEN FILES in the sfs.h header file int sfs close (int fd) The file descriptor fd is closed. The closed file descriptor can no longer be used to access the corresponding file. However, the closed file descriptor should be reused during another sfs_open () call. This function returns 0 on success and-1 on failure int sfs create (char *file name) The file specified by file_name is created. The file is created only if it is not already present The length of the file name is specified by the constant FNAME_LENGTH. The function returns 0 on success and -1 on failure. The number of files that are in a directory is restricted to MAX FILES int sfs delete (char *file name) The file specified by file_name is deleted. The file is deleted only if it has been already created. On deletion all the data blocks, on disk and on memory data structures related to the file data and meta data are released. Also, the file can be deleted only if it is not open. This function returns 0 on success and -1 on failure Part 2: Simple File Svstem (SFS SFS consists of two parts: management functions and access functions. The interfaces to management functions are defined next This function creates the new file system on the virtual disk specified by disk name. As part of this function, you should first invoke open disk ) to create a new disk. Then, create (and initialize) the necessary on disk structures for your file system. The function returns 0 on success, and -1 on failure (when the disk could not be created, opened, or properly initialized.) int mount sfs (char *disk name) This function mounts the disk (disk_name). The on disk structures are read into memory to handle the file system operations. The function returns 0 on success, and -1 on failure This function unmounts the disk (disk name) from your file system. All the meta data and file system related data that are on memory should be wrote into appropriate on disk structures. Finally, it should call close disk() . The function returns 0 on success, and-1 on failure Next, you need to implement the following access routines int sfs open (char file name) The file (file_name) is opened for reading and writing. This function returns the file descriptor of the file on success and -1 on failure. Note that the same file may opened many times, and for each open call a different file descriptor should be returned. The maximum number of files that can remain opened at a time is specified by constant MAX OPEN FILES in the sfs.h header file int sfs close (int fd) The file descriptor fd is closed. The closed file descriptor can no longer be used to access the corresponding file. However, the closed file descriptor should be reused during another sfs_open () call. This function returns 0 on success and-1 on failure int sfs create (char *file name) The file specified by file_name is created. The file is created only if it is not already present The length of the file name is specified by the constant FNAME_LENGTH. The function returns 0 on success and -1 on failure. The number of files that are in a directory is restricted to MAX FILES int sfs delete (char *file name) The file specified by file_name is deleted. The file is deleted only if it has been already created. On deletion all the data blocks, on disk and on memory data structures related to the file data and meta data are released. Also, the file can be deleted only if it is not open. This function returns 0 on success and -1 on failure

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!