#include <lunaix/fs.h>
#include <lunaix/mm/valloc.h>
+#include <lunaix/process.h>
#include <lunaix/spike.h>
#include <klibc/string.h>
int i = 0, j = 0;
if (depth >= VFS_SYMLINK_DEPTH) {
- return ENAMETOOLONG;
+ return ELOOP;
}
if (path[0] == VFS_PATH_DELIM || !start) {
panick("vfs: no root");
}
}
- i++;
+
+ if (path[0] == VFS_PATH_DELIM) {
+ i++;
+ }
}
+ assert(start);
+
struct v_dnode* dnode;
struct v_inode* current_inode;
struct v_dnode* current_level = start;
struct hstr name = HSTR(fname_buffer, 0);
char current = path[i++], lookahead;
- while (current && current_level) {
+ while (current) {
lookahead = path[i++];
if (current != VFS_PATH_DELIM) {
if (j >= VFS_NAME_MAXLEN - 1) {
if (!lookahead && (walk_options & VFS_WALK_PARENT)) {
if (component) {
- component->hash = name.hash;
- component->len = j;
- strcpy(component->value, fname_buffer);
+ hstrcpy(component, &name);
}
break;
}
}
// reposition the resolved subtree pointed by symlink
- vfs_dcache_rehash(current_level->parent, dnode);
+ // vfs_dcache_rehash(current_level->parent, dnode);
current_level = dnode;
current_inode = dnode->inode;
}