summaryrefslogtreecommitdiff
path: root/fs/sysfs.c
diff options
context:
space:
mode:
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;
}