diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-10-22 09:51:03 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-10-22 09:51:03 +0200 |
| commit | 430112c8d7224bf9d1e192adfc9fb55e7a044f83 (patch) | |
| tree | cd6a1ba50070076861c73861a8410e2e288d9877 /fs | |
| parent | d272f7fda985b266588af8ba6091c97e44862287 (diff) | |
started abstraction for filesystems
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/Makefile | 9 | ||||
| -rw-r--r-- | fs/ext2.c | 5 | ||||
| -rw-r--r-- | fs/fs.c | 32 |
3 files changed, 42 insertions, 4 deletions
diff --git a/fs/Makefile b/fs/Makefile index c88dda4..d339621 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -4,6 +4,13 @@ a.out: ext2.c gcc ext2.c -std=c11 filesys: dd if=/dev/zero of=ext2.img bs=512 count=10000 - sudo mkfs.ext2 -O ^large_file ext2.img + sudo mkfs.ext2 -O none ext2.img + mkdir mnt + sudo mount ext2.img mnt + sudo chown miguel mnt + mkdir mnt/miguel + echo "hello one" > mnt/miguel/test1.txt + echo "hello two" > mnt/test2.txt + sync @@ -96,6 +96,7 @@ typedef struct ext2_inode_struct }ext2_inode; + int main() { ext2_superblock super; @@ -142,6 +143,7 @@ int main() int block_size=1024; int descriptor_start_block=2; fseek(stdin,block_size*descriptor_start_block,SEEK_SET); + fread(&desc,sizeof(desc),1,stdin); printf("block usage bitmap: 0x%x\n",desc.addr_block_bitmap); printf("inode usage bitmap: 0x%x\n",desc.addr_inode_bitmap); @@ -188,9 +190,6 @@ int main() puts(""); puts(""); - - - } @@ -0,0 +1,32 @@ +// abstraction layer for filesystems +#include <lib/int/stdint.h> + +enum FS_FILE_TYPE{ + + FS_FILE_TYPE_DIR = 1, + FS_FILE_TYPE_FILE = 2 +}; + +typedef struct fs_file_struct +{ + int type; + char name[256]; + +}fs_file; + +int fs_list(char *path, fs_file *list); +{ + +} + +int fs_read(char *path, uint8_t *buf) +{ + +} + +int fs_mount(char *dev, char *dir) +{ + +} + + |
