Question: can someone help me implement fs _ setcwd please i have the mfs . h file based on that please implement fs _
can someone help me implement fssetcwd" please i have the mfsh file based on that please implement fssetcwd". #ifndef MFSH
#define MFSH
#include
#include
#include
#include bioh
#include "directoryEntry.h
#include
#define FTREGFILE DTREG
#define FTDIRECTORY DTDIR
#define FTLINK DTLNK
#ifndef uintt
typedef uintt uintt;
#endif
#ifndef uintt
typedef uintt uintt;
#endif
This structure is returned by fsreaddir to provide the caller with information
about each file as it iterates through a directory
struct fsdiriteminfo
unsigned short dreclen; length of this record
unsigned char fileType;
char dname; filename max filename is characters
;
This is a private structure used only by fsopendir, fsreaddir, and fsclosedir
Think of this like a file descriptor but for a directory one can only read
from a directory. This structure helps you the file system keep track of
which directory entry you are currently processing so that everytime the caller
calls the function readdir, you give the next entry in the directory
typedef struct
TO DO: Fill in this structure with what your openread directory needs
unsigned short dreclen; length of this record
unsigned short dirEntryPosition; which directory entry position, like file pos
DE directory; Pointer to the loaded directory you want to iterate
struct fsdiriteminfo di; Pointer to the structure you return from read
fdDir;
Key directory functions
int fsmkdirconst char pathname modet mode;
int fsrmdirconst char pathname;
Directory iteration functions
fdDir fsopendirconst char pathname;
struct fsdiriteminfo fsreaddirfdDir dirp;
int fsclosedirfdDir dirp;
Misc directory functions
char fsgetcwdchar pathname sizet size;
int fssetcwdchar pathname; linux chdir
int fsisFilechar filename; return if file, otherwise
int fsisDirchar pathname; return if directory, otherwise
int fsdeletechar filename; removes a file
This is the strucutre that is filled in from a call to fsstat
struct fsstat
offt stsize; total size, in bytes
blksizet stblksize; blocksize for file system IO
blkcntt stblocks; number of B blocks allocated
timet staccesstime; time of last access
timet stmodtime; time of last modification
timet stcreatetime; time of last status change
add additional attributes here for your file system
;
int fsstatconst char path struct fsstat buf;
parses the path given to setcwd, returns tokenized array
char parsePathchar longPath char parsed;
returns index of an already parsed path
int parsedIndexchar parsedPath;
DE loadDirconst char pathname;
#endif
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
