Rev 2753 | Rev 2766 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2753 | Rev 2763 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include "vfs.h" |
38 | #include "vfs.h" |
39 | #include <ipc/ipc.h> |
39 | #include <ipc/ipc.h> |
40 | #include <async.h> |
40 | #include <async.h> |
41 | #include <errno.h> |
41 | #include <errno.h> |
42 | #include <string.h> |
42 | #include <string.h> |
- | 43 | #include <stdarg.h> |
|
43 | #include <bool.h> |
44 | #include <bool.h> |
44 | #include <futex.h> |
45 | #include <futex.h> |
45 | #include <libadt/list.h> |
46 | #include <libadt/list.h> |
46 | #include <atomic.h> |
47 | #include <atomic.h> |
47 | #include <vfs/canonify.h> |
48 | #include <vfs/canonify.h> |
Line 63... | Line 64... | ||
63 | * of the whole VFS tree. |
64 | * of the whole VFS tree. |
64 | * |
65 | * |
65 | * @return EOK on success or an error code from errno.h. |
66 | * @return EOK on success or an error code from errno.h. |
66 | */ |
67 | */ |
67 | int vfs_lookup_internal(char *path, int lflag, vfs_lookup_res_t *result, |
68 | int vfs_lookup_internal(char *path, int lflag, vfs_lookup_res_t *result, |
68 | vfs_pair_t *altroot) |
69 | vfs_pair_t *altroot, ...) |
69 | { |
70 | { |
70 | vfs_pair_t *root; |
71 | vfs_pair_t *root; |
71 | 72 | ||
72 | if (altroot) |
73 | if (altroot) |
73 | root = altroot; |
74 | root = altroot; |
Line 80... | Line 81... | ||
80 | size_t len; |
81 | size_t len; |
81 | path = canonify(path, &len); |
82 | path = canonify(path, &len); |
82 | if (!path) |
83 | if (!path) |
83 | return EINVAL; |
84 | return EINVAL; |
84 | 85 | ||
- | 86 | unsigned long index = 0; |
|
- | 87 | if (lflag & L_LINK) { |
|
- | 88 | va_list ap; |
|
- | 89 | ||
- | 90 | va_start(ap, altroot); |
|
- | 91 | index = va_arg(ap, unsigned long); |
|
- | 92 | va_end(ap); |
|
- | 93 | } |
|
- | 94 | ||
85 | futex_down(&plb_futex); |
95 | futex_down(&plb_futex); |
86 | 96 | ||
87 | plb_entry_t entry; |
97 | plb_entry_t entry; |
88 | link_initialize(&entry.plb_link); |
98 | link_initialize(&entry.plb_link); |
89 | entry.len = len; |
99 | entry.len = len; |
Line 147... | Line 157... | ||
147 | memcpy(&plb[first], path, cnt1); |
157 | memcpy(&plb[first], path, cnt1); |
148 | memcpy(plb, &path[cnt1], cnt2); |
158 | memcpy(plb, &path[cnt1], cnt2); |
149 | 159 | ||
150 | ipc_call_t answer; |
160 | ipc_call_t answer; |
151 | int phone = vfs_grab_phone(root->fs_handle); |
161 | int phone = vfs_grab_phone(root->fs_handle); |
152 | aid_t req = async_send_4(phone, VFS_LOOKUP, (ipcarg_t) first, |
162 | aid_t req = async_send_5(phone, VFS_LOOKUP, (ipcarg_t) first, |
153 | (ipcarg_t) (first + len - 1) % PLB_SIZE, |
163 | (ipcarg_t) (first + len - 1) % PLB_SIZE, |
154 | (ipcarg_t) root->dev_handle, (ipcarg_t) lflag, &answer); |
164 | (ipcarg_t) root->dev_handle, (ipcarg_t) lflag, (ipcarg_t) index, |
- | 165 | &answer); |
|
155 | vfs_release_phone(phone); |
166 | vfs_release_phone(phone); |
156 | 167 | ||
157 | ipcarg_t rc; |
168 | ipcarg_t rc; |
158 | async_wait_for(req, &rc); |
169 | async_wait_for(req, &rc); |
159 | 170 |