84,6 → 84,8 |
{ |
dev_handle_t dev_handle; |
vfs_node_t *mp_node = NULL; |
int rc; |
int phone; |
|
/* |
* We expect the library to do the device-name to device-handle |
167,7 → 169,6 |
* node cannot be removed. However, we do take a reference to it so |
* that we can track how many times it has been mounted. |
*/ |
int rc; |
vfs_lookup_res_t mr_res; |
rc = lookup_root(fs_handle, dev_handle, &mr_res); |
if (rc != EOK) { |
225,11 → 226,29 |
} else { |
/* We still don't have the root file system mounted. */ |
if ((size == 1) && (buf[0] == '/')) { |
/* For this simple, but important case, we are done. */ |
rootfs = mr_res.triplet; |
/* |
* For this simple, but important case, |
* we are almost done. |
*/ |
free(buf); |
|
/* Inform the mount point about the root mount. */ |
phone = vfs_grab_phone(mr_res.triplet.fs_handle); |
rc = async_req_5_0(phone, VFS_MOUNT, |
(ipcarg_t) mr_res.triplet.dev_handle, |
(ipcarg_t) mr_res.triplet.index, |
(ipcarg_t) mr_res.triplet.fs_handle, |
(ipcarg_t) mr_res.triplet.dev_handle, |
(ipcarg_t) mr_res.triplet.index); |
vfs_release_phone(phone); |
|
if (rc == EOK) |
rootfs = mr_res.triplet; |
else |
vfs_node_put(mr_node); |
|
futex_up(&rootfs_futex); |
free(buf); |
ipc_answer_0(rid, EOK); |
ipc_answer_0(rid, rc); |
return; |
} else { |
/* |
253,24 → 272,20 |
* of the file system being mounted. |
*/ |
|
int phone = vfs_grab_phone(mp_res.triplet.fs_handle); |
/* Later we can use ARG3 to pass mode/flags. */ |
aid_t req1 = async_send_3(phone, VFS_MOUNT, |
/** |
* @todo |
* Add more IPC parameters so that we can send mount mode/flags. |
*/ |
phone = vfs_grab_phone(mp_res.triplet.fs_handle); |
rc = async_req_5_0(phone, VFS_MOUNT, |
(ipcarg_t) mp_res.triplet.dev_handle, |
(ipcarg_t) mp_res.triplet.index, 0, NULL); |
/* The second call uses the same method. */ |
aid_t req2 = async_send_3(phone, VFS_MOUNT, |
(ipcarg_t) mp_res.triplet.index, |
(ipcarg_t) mr_res.triplet.fs_handle, |
(ipcarg_t) mr_res.triplet.dev_handle, |
(ipcarg_t) mr_res.triplet.index, NULL); |
(ipcarg_t) mr_res.triplet.index); |
vfs_release_phone(phone); |
|
ipcarg_t rc1; |
ipcarg_t rc2; |
async_wait_for(req1, &rc1); |
async_wait_for(req2, &rc2); |
|
if ((rc1 != EOK) || (rc2 != EOK)) { |
if (rc != EOK) { |
/* Mount failed, drop references to mr_node and mp_node. */ |
vfs_node_put(mr_node); |
if (mp_node) |
277,12 → 292,7 |
vfs_node_put(mp_node); |
} |
|
if (rc2 == EOK) |
ipc_answer_0(rid, rc1); |
else if (rc1 == EOK) |
ipc_answer_0(rid, rc2); |
else |
ipc_answer_0(rid, rc1); |
ipc_answer_0(rid, rc); |
} |
|
void vfs_open(ipc_callid_t rid, ipc_call_t *request) |