From 06e6e427c76bdb88a7f72dd04411d95a4bda3270 Mon Sep 17 00:00:00 2001 From: Miguel Date: Sun, 16 Sep 2018 23:46:30 +0200 Subject: starting to create sysfs --- testing/testing.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'testing/testing.c') diff --git a/testing/testing.c b/testing/testing.c index fc95054..7646b95 100644 --- a/testing/testing.c +++ b/testing/testing.c @@ -1,7 +1,58 @@ #include #include "log.h" #include "kmalloc.h" +#include "mount.h" +#include "lib/string/string.h" + +void testing_mount_add(char *path, uint32_t t) +{ + mount m; + memcpy(m.path,path,strlen(path)+1); + m.type=t; + mount_add(m); +} + +void testing_get_mount(char *path) +{ + /* + mount m; + char *subpath=get_mount_for_path(path,&m); + if(subpath==0) + { + testlog ("mount %s not found!",path); + } + else + { + testlog("mount [%s] is [%s] at [%s]",path, subpath, m.path); + } + */ +} + +void testing_mount() +{ + #ifndef FOOLOS_UNIT_TESTING + return; + #endif + testlog ("= UNIT TESTING MOUNTS ="); + testing_mount_add("/",MOUNT_TYPE_EXT2); + testing_mount_add("/pipes/",MOUNT_TYPE_PIPES); + testing_mount_add("/pipes/input/",MOUNT_TYPE_PIPES); + testing_mount_add("/sys/",MOUNT_TYPE_SYS); + mount_dump(); +// testing_get_mount("pipes/input"); + testing_get_mount("/dupa"); + testing_get_mount("/pipe"); + testing_get_mount("/pipes/input"); + testing_get_mount("/pipes/in"); + testing_get_mount("/pipes/input/"); + testing_get_mount("/pipes/input/dups"); + testing_get_mount("/sys"); + testing_get_mount("/sys/ass"); + testing_get_mount("/sys/ass/bass"); + testing_get_mount("/foo/sys/ass/bass"); + while(1); +} void testing_kmalloc_alloc(uint32_t size) { uint32_t addr=kballoc(size); -- cgit v1.2.3