summaryrefslogtreecommitdiff
path: root/fs/sysfs.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-19 01:52:14 +0200
committerMiguel <m.i@gmx.at>2018-09-19 01:52:14 +0200
commit1e08b64b43bf9c50b644da3f76d5a8bcc73f62da (patch)
tree53aca729b7faeb781b04b9c62a7b1b13efa21991 /fs/sysfs.c
parent2d91384197847a7e8fe2c3f548918a8277d3086d (diff)
addding sysfs and pipes etc
Diffstat (limited to 'fs/sysfs.c')
-rw-r--r--fs/sysfs.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/sysfs.c b/fs/sysfs.c
index 57a56c8..de679f2 100644
--- a/fs/sysfs.c
+++ b/fs/sysfs.c
@@ -1,6 +1,6 @@
#include "mount.h"
+#include <stdlib.h>
#include "sysfs.h"
-
#include "mem.h"
#include "kmalloc.h"
#include "mount.h"
@@ -9,10 +9,13 @@
#include "lib/string/string.h"
-static const char* names[] = {"/mem","/kmalloc","/mount"};
-static uint32_t map[]={mem_sysfs,kmalloc_sysfs,mount_sysfs};
-static uint32_t count=3;
+static const char* names[] = {"mem","kmalloc","mount"};
+static uint32_t map[]={mem_sysfs,mem_sysfs_set,
+ kmalloc_sysfs,NULL,
+ mount_sysfs,NULL,
+ };
+static uint32_t count=3;
/* mount interface */
@@ -22,15 +25,16 @@ fd sysfs_file_open(mount *m,char *path)
for (int i=0;i<count;i++)
{
if(!strcmp(path,names[i]))
- return fd_from_sysfs(map[i]);
+ return fd_from_sysfs(map[2*i],map[2*i+1]);
}
- return fd_from_sysfs(map[0]);
+ return fd_from_sysfs(map[0],map[1]);
}
int sysfs_read_dir(mount *m,char *path, fs_dirent *dirs, uint32_t *pos)
{
if(*pos>=count)return 0;
memcpy(dirs->name,names[*pos],strlen(names[*pos])+1);
+ dirs->inode=0;
*pos+=1;
return 1;
}