42,14 → 42,14 |
#include <string.h> |
#include <stdarg.h> |
#include <bool.h> |
#include <futex.h> |
#include <fibril_sync.h> |
#include <adt/list.h> |
#include <vfs/canonify.h> |
|
#define min(a, b) ((a) < (b) ? (a) : (b)) |
|
futex_t plb_futex = FUTEX_INITIALIZER; |
link_t plb_head; /**< PLB entry ring buffer. */ |
FIBRIL_MUTEX_INITIALIZE(plb_mutex); |
LIST_INITIALIZE(plb_head); /**< PLB entry ring buffer. */ |
uint8_t *plb = NULL; |
|
/** Perform a path lookup. |
92,7 → 92,7 |
va_end(ap); |
} |
|
futex_down(&plb_futex); |
fibril_mutex_lock(&plb_mutex); |
|
plb_entry_t entry; |
link_initialize(&entry.plb_link); |
119,7 → 119,7 |
/* |
* The buffer cannot absorb the path. |
*/ |
futex_up(&plb_futex); |
fibril_mutex_unlock(&plb_mutex); |
return ELIMIT; |
} |
} else { |
127,7 → 127,7 |
/* |
* The buffer cannot absorb the path. |
*/ |
futex_up(&plb_futex); |
fibril_mutex_unlock(&plb_mutex); |
return ELIMIT; |
} |
} |
146,7 → 146,7 |
*/ |
list_append(&entry.plb_link, &plb_head); |
|
futex_up(&plb_futex); |
fibril_mutex_unlock(&plb_mutex); |
|
/* |
* Copy the path into PLB. |
159,16 → 159,16 |
|
ipc_call_t answer; |
int phone = vfs_grab_phone(root->fs_handle); |
aid_t req = async_send_5(phone, VFS_LOOKUP, (ipcarg_t) first, |
aid_t req = async_send_5(phone, VFS_OUT_LOOKUP, (ipcarg_t) first, |
(ipcarg_t) (first + len - 1) % PLB_SIZE, |
(ipcarg_t) root->dev_handle, (ipcarg_t) lflag, (ipcarg_t) index, |
&answer); |
vfs_release_phone(phone); |
|
ipcarg_t rc; |
async_wait_for(req, &rc); |
vfs_release_phone(phone); |
|
futex_down(&plb_futex); |
fibril_mutex_lock(&plb_mutex); |
list_remove(&entry.plb_link); |
/* |
* Erasing the path from PLB will come handy for debugging purposes. |
175,7 → 175,7 |
*/ |
memset(&plb[first], 0, cnt1); |
memset(plb, 0, cnt2); |
futex_up(&plb_futex); |
fibril_mutex_unlock(&plb_mutex); |
|
if ((rc == EOK) && (result)) { |
result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer); |
204,14 → 204,14 |
int phone = vfs_grab_phone(result->triplet.fs_handle); |
|
ipc_call_t answer; |
aid_t req = async_send_2(phone, VFS_OPEN_NODE, |
aid_t req = async_send_2(phone, VFS_OUT_OPEN_NODE, |
(ipcarg_t) result->triplet.dev_handle, |
(ipcarg_t) result->triplet.index, &answer); |
|
vfs_release_phone(phone); |
|
ipcarg_t rc; |
async_wait_for(req, &rc); |
vfs_release_phone(phone); |
|
if (rc == EOK) { |
result->size = (size_t) IPC_GET_ARG1(answer); |