summaryrefslogtreecommitdiff
path: root/fs/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/mount.c')
-rw-r--r--fs/mount.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/mount.c b/fs/mount.c
index eca0b2c..a54fb92 100644
--- a/fs/mount.c
+++ b/fs/mount.c
@@ -49,6 +49,7 @@ static uint32_t check_match(char *p1, char *p2)
c++;
p1++;
p2++;
+ if(*p1=='/')return c;
}
}
@@ -71,9 +72,9 @@ static char* get_mount_for_path(char *path,mount *mnt)
for(int i=0;i<mounts_count;i++)
{
mount *m=&mounts[i];
- uint32_t len=check_match(path,m->path);
+ uint32_t len=check_match(path+1,(m->path)+1);
- if(len>best_len)//&&len==strlen(m->path))
+ if(len>best_len&&path[len-1]=='/')//&&len==strlen(m->path))
{
best=i;
best_len=len;
@@ -89,8 +90,25 @@ fd mount_file_open(char *path)
mount m;
char buf[256];
if(path[0]!='/'){
- // TODO: use environemnet PWD var!
- sprintf(buf,"/home/miguel/%s",path);
+
+ // we extract the PWD env variable!
+ // TODO: this is ugly!
+ char **env1=VMEM_USER_ENV+1024*2;
+
+ int i=0;
+ while(1)
+ {
+ if(env1[i]==0)kpanic("unable to extract PWD!");
+ if(!strcmp_l("PWD=",env1[i],4))
+ {
+ sprintf(buf,"%s/%s",env1[i]+4,path);
+ klog("absolute path exracted: %s",buf);
+ break;
+ }
+ i++;
+ }
+
+
}
else
{
@@ -101,7 +119,7 @@ fd mount_file_open(char *path)
return m.mount_file_open(&m,p);
}
-int mount_read_dir (char *path, fs_dirent *dirs, uint32_t *pos)
+int mount_read_dir (char *path, struct dirent *dirs, uint32_t *pos)
{
mount m;
char *p=get_mount_for_path(path,&m);