git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'interrupt-rework' into prog-loader
[lunaix-os.git]
/
lunaix-os
/
kernel
/
fs
/
path_walk.c
diff --git
a/lunaix-os/kernel/fs/path_walk.c
b/lunaix-os/kernel/fs/path_walk.c
index 0ffbabb84bb36fe1b763a6a2a23d6a69f9fffc41..cd0ac01565e4616ca68901a8ccaa7ed2938b244b 100644
(file)
--- a/
lunaix-os/kernel/fs/path_walk.c
+++ b/
lunaix-os/kernel/fs/path_walk.c
@@
-1,5
+1,6
@@
#include <lunaix/fs.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/fs.h>
#include <lunaix/mm/valloc.h>
+#include <lunaix/process.h>
#include <lunaix/spike.h>
#include <klibc/string.h>
#include <lunaix/spike.h>
#include <klibc/string.h>
@@
-21,7
+22,7
@@
__vfs_walk(struct v_dnode* start,
int i = 0, j = 0;
if (depth >= VFS_SYMLINK_DEPTH) {
int i = 0, j = 0;
if (depth >= VFS_SYMLINK_DEPTH) {
- return E
NAMETOOLONG
;
+ return E
LOOP
;
}
if (path[0] == VFS_PATH_DELIM || !start) {
}
if (path[0] == VFS_PATH_DELIM || !start) {
@@
-33,9
+34,14
@@
__vfs_walk(struct v_dnode* start,
panick("vfs: no root");
}
}
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 v_dnode* dnode;
struct v_inode* current_inode;
struct v_dnode* current_level = start;
@@
-43,7
+49,7
@@
__vfs_walk(struct v_dnode* start,
struct hstr name = HSTR(fname_buffer, 0);
char current = path[i++], lookahead;
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) {
lookahead = path[i++];
if (current != VFS_PATH_DELIM) {
if (j >= VFS_NAME_MAXLEN - 1) {
@@
-69,9
+75,7
@@
__vfs_walk(struct v_dnode* start,
if (!lookahead && (walk_options & VFS_WALK_PARENT)) {
if (component) {
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;
}
}
break;
}
@@
-103,7
+107,7
@@
__vfs_walk(struct v_dnode* start,
}
// reposition the resolved subtree pointed by symlink
}
// 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;
}
current_level = dnode;
current_inode = dnode->inode;
}