summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-10-22 14:06:04 +0200
committerMichal Idziorek <m.i@gmx.at>2014-10-22 14:06:04 +0200
commit95450710a8b8290a110686d78c2357d3920bcda5 (patch)
tree4e3ef7556289bb1c18bce0c6e73235d497364a4d /fs
parent17d28200533f6a02d08cee2bf5352036bea92762 (diff)
working on filesys and readdir syscall
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2.c6
-rw-r--r--fs/fs.c40
-rw-r--r--fs/fs.h19
3 files changed, 39 insertions, 26 deletions
diff --git a/fs/ext2.c b/fs/ext2.c
index 90897e9..bc83f55 100644
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -1,8 +1,7 @@
// ext2 minidriver
// based on osdev wiki article: http://wiki.osdev.org/Ext2
-#include <stdint.h>
-#include <stdio.h>
+#include "lib/int/stdint.h"
typedef struct ext2_superblock_struct
{
@@ -97,6 +96,7 @@ typedef struct ext2_inode_struct
+ /*
int main()
{
ext2_superblock super;
@@ -191,6 +191,6 @@ int main()
puts("");
}
-
+*/
diff --git a/fs/fs.c b/fs/fs.c
index a213861..85e04ca 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1,32 +1,26 @@
// 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)
+#include "fs.h"
+//
+// returns number of entries in the directory specified by name.
+// fills 0-max into *dirs
+int fs_readdir(const char *name,fs_dirent *dirs,int max)
{
+ int testdata=5;
-}
+ int inodes[]={13,14,15,16,17};
+ char names[][256]={"dupa","test","drei","vier","funf"};
+ char type[]={2,2,1,2,1};
-int fs_mount(char *dev, char *dir)
-{
+ for(int i=0;i<5;i++)
+ {
+ dirs[i].inode=inodes[i];
+ for(int j=0;j<256;j++)
+ dirs[i].name[j]=names[i][j];
+ dirs[i].type=type[i];
+ }
+ return 5;
}
diff --git a/fs/fs.h b/fs/fs.h
new file mode 100644
index 0000000..68675f0
--- /dev/null
+++ b/fs/fs.h
@@ -0,0 +1,19 @@
+#ifndef FOOLOS_FS
+#define FOOLOS_FS
+
+enum FS_FILE_TYPE{
+
+ FS_FILE_TYPE_DIR = 1,
+ FS_FILE_TYPE_FILE = 2
+};
+
+typedef struct fs_dirent_struct
+{
+ uint32_t inode;
+ uint32_t offset;
+ uint16_t length;
+ uint8_t type;
+ char name[256];
+}fs_dirent;
+
+#endif