diff --git a/BareFS.c b/BareFS.c new file mode 100644 index 0000000..0256ddb --- /dev/null +++ b/BareFS.c @@ -0,0 +1,48 @@ +#include<"File.h"> +#include +#include +#include +#include +#include +#include + + +void U_Fullpath(char filePath[MAX_PATH], const char* path) +{ + strcpy(filePath,inode->rootDir); + strncat(filePath,path,MAX_PATH); +} + +int U_getattr(const char *path, struct stat *statS) +{ + //int return_status; check to make sure it is written to a log + char filePath[MAX_PATH]; + //maybe log something + + U_Fullpath(filePath,path); + + return 0; +} +int U_readdir(const char *path, void *buf, fuse_fill_dirt filler, + off_t offset, struct fuse_file_info *fi) +{ + DIR *dp; + struct dirent *Directory; + + dp = (DIR*) (uintptr_t) fi->fh; + + Directory = readdir(dp); + if(Directory == 0) + { + return -1; + } + + do{ + if (filler(buf,Directory->d_name,NULL,0) != 0) + { + return -1; + } + + }while((Directory = readdir(dp)) != NULL); + +} \ No newline at end of file diff --git a/File.h b/File.h new file mode 100644 index 0000000..6b3b5b9 --- /dev/null +++ b/File.h @@ -0,0 +1,17 @@ +#ifndef _File_H_ +#define _File_H_ +#include +#include +#include +#include +#include + + +#define BLOCK_SIZE 4096 +#define MAX_PATH 16000 +typedef struct _metaData +{ + char *rootDir; +}metaData; + +#endif