Starting from:

$30

CSC415-File System Solved

 write a file system!

 You will need to format your volume, create and maintain a free space management system, initialize a root directory and maintain directory information, create, read, write, and delete files, and display info. See below for specifics.

 I will provide an initial “main” (fsShell.c) that will be the driver to test you file system. Your group can modifiy this driver as needed. The driver will be interactive (with all built in commands) to list directories, create directories, add and remove files, copy files, move files, and two “special commands” one to copy from the normal filesystem to your filesystem and the other from your filesystem to the normal filesystem.

 You should modify this driver as needed for your filesystem, adding the display/setting of any additional meta data, and other functions you want to add.

 The shell also calls two function in the file fsInit.c initFileSystem and exitFileSystem which are routines for you to fill in with whatever initialization and exit code you need for your file system.

 Some specifics - you need to provide the following interfaces:

 b_io_fd b_open (char * filename, int flags);
int b_read (b_io_fd fd, char * buffer, int count);
int b_write (b_io_fd fd, char * buffer, int count);
int b_seek (b_io_fd fd, off_t offset, int whence);
void b_close (b_io_fd fd);

 Note that the function are similar to the bread and bwrite you have done, there is a signifigant difference since you do not have the linux open and read to use.
You have to have methods of locating files, and knowing which logical block addresses are associated with the file.

 Directory Functions - see https://www.thegeekstuff.com/2012/06/c-directory/ for reference.

 int fs_mkdir(const char *pathname, mode_t mode);
int fs_rmdir(const char *pathname);
fdDir * fs_opendir(const char *name);
struct fs_diriteminfo *fs_readdir(fdDir *dirp);
int fs_closedir(fdDir *dirp);

char * fs_getcwd(char *buf, size_t size);
int fs_setcwd(char *buf);   //linux chdir
int fs_isFile(char * path);    //return 1 if file, 0 otherwise
int fs_isDir(char * path);        //return 1 if directory, 0 otherwise
int fs_delete(char* filename);    //removes a file

struct fs_diriteminfo
    {
    unsigned short d_reclen;    /* length of this record */
    unsigned char fileType;    
    char d_name[256];             /* filename max filename is 255 characters */
    };

 Finally file stats - not all the fields in the structure are needed for this assingment
 int fs_stat(const char *path, struct fs_stat *buf);
struct fs_stat
    {
    off_t     st_size;          /* total size, in bytes */
    blksize_t st_blksize;       /* blocksize for file system I/O */
    blkcnt_t  st_blocks;        /* number of 512B blocks allocated */
    time_t    st_accesstime;    /* time of last access */
    time_t    st_modtime;       /* time of last modification */
    time_t    st_createtime;    /* time of last status change */

    /* add additional attributes here for your file system */
    };

 These interfaces will also be provided to you in mfs.h.

 Note: You will need to modify mfs.h for the fdDIR strucutre to be what your file system need to maintain and track interation through the directory structure.

 A shell program designed to demonstrate your file system called fsshell.c is proviced. It has a number of built in functions that will work if you implement the above interfaces, these are:

 ls - Lists the file in a directory
cp - Copies a file - source [dest]
mv - Moves a file - source dest
md - Make a new directory
rm - Removes a file or directory
cp2l - Copies a file from the test file system to the linux file system
cp2fs - Copies a file from the Linux file system to the test file system
cd - Changes directory
pwd - Prints the working directory
history - Prints out the history
help - Prints out help

More products