summaryrefslogtreecommitdiff
path: root/fs/mount.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-10-14 22:36:16 +0200
committerMiguel <m.i@gmx.at>2018-10-14 22:36:16 +0200
commit2a6690e9fd53a02613796764248006e06ac482d6 (patch)
treeea3063ef3ecd0808e9291faf6c56949d91b1b09e /fs/mount.c
parent5aeab1c853e487aa0042d5c32200d623efe908d3 (diff)
ported vim et al
Diffstat (limited to 'fs/mount.c')
-rw-r--r--fs/mount.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/mount.c b/fs/mount.c
index 62cfe9f..9aa1aeb 100644
--- a/fs/mount.c
+++ b/fs/mount.c
@@ -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);
}