diff options
Diffstat (limited to 'fs/mount.c')
| -rw-r--r-- | fs/mount.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -6,6 +6,7 @@ #include "log.h" #include "lib/string/string.h" +#include "lib/printf/printf.h" #include "fd.h" @@ -58,12 +59,15 @@ static uint32_t check_match(char *p1, char *p2) */ static char* get_mount_for_path(char *path,mount *mnt) { - if(path[0]!='/')kpanic("this works only for absolute paths!"); // start with root as default uint32_t best=0; uint32_t best_len=1; + if(path[0]!='/'){ + kpanic("this works only for absolute paths! supplied: %s",path); + } + for(int i=0;i<mounts_count;i++) { mount *m=&mounts[i]; @@ -83,7 +87,17 @@ static char* get_mount_for_path(char *path,mount *mnt) fd mount_file_open(char *path) { mount m; - char *p=get_mount_for_path(path,&m); + char buf[256]; + if(path[0]!='/'){ + // TODO: use environemnet PWD var! + sprintf(buf,"/home/miguel/%s",path); + } + else + { + sprintf(buf,"%s",path); + } + + char *p=get_mount_for_path(buf,&m); return m.mount_file_open(&m,p); } |
