Subversion Repositories HelenOS

Rev

Rev 2788 | Rev 2958 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2788 Rev 2957
Line 82... Line 82...
82
 
82
 
83
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
83
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
84
{
84
{
85
    dev_handle_t dev_handle;
85
    dev_handle_t dev_handle;
86
    vfs_node_t *mp_node = NULL;
86
    vfs_node_t *mp_node = NULL;
-
 
87
    int rc;
87
 
88
 
88
    /*
89
    /*
89
     * We expect the library to do the device-name to device-handle
90
     * We expect the library to do the device-name to device-handle
90
     * translation for us, thus the device handle will arrive as ARG1
91
     * translation for us, thus the device handle will arrive as ARG1
91
     * in the request.
92
     * in the request.
Line 165... Line 166...
165
     * Lookup the root node of the filesystem being mounted.
166
     * Lookup the root node of the filesystem being mounted.
166
     * In this case, we don't need to take the namespace_futex as the root
167
     * In this case, we don't need to take the namespace_futex as the root
167
     * node cannot be removed. However, we do take a reference to it so
168
     * node cannot be removed. However, we do take a reference to it so
168
     * that we can track how many times it has been mounted.
169
     * that we can track how many times it has been mounted.
169
     */
170
     */
170
    int rc;
-
 
171
    vfs_lookup_res_t mr_res;
171
    vfs_lookup_res_t mr_res;
172
    rc = lookup_root(fs_handle, dev_handle, &mr_res);
172
    rc = lookup_root(fs_handle, dev_handle, &mr_res);
173
    if (rc != EOK) {
173
    if (rc != EOK) {
174
        free(buf);
174
        free(buf);
175
        ipc_answer_0(rid, rc);
175
        ipc_answer_0(rid, rc);
Line 251... Line 251...
251
     * At this point, we have all necessary pieces: file system and device
251
     * At this point, we have all necessary pieces: file system and device
252
     * handles, and we know the mount point VFS node and also the root node
252
     * handles, and we know the mount point VFS node and also the root node
253
     * of the file system being mounted.
253
     * of the file system being mounted.
254
     */
254
     */
255
 
255
 
-
 
256
    /**
-
 
257
     * @todo
-
 
258
     * Add more IPC parameters so that we can send mount mode/flags.
-
 
259
     */
256
    int phone = vfs_grab_phone(mp_res.triplet.fs_handle);
260
    int phone = vfs_grab_phone(mp_res.triplet.fs_handle);
257
    /* Later we can use ARG3 to pass mode/flags. */
-
 
258
    aid_t req1 = async_send_3(phone, VFS_MOUNT,
261
    rc = async_req_5_0(phone, VFS_MOUNT,
259
        (ipcarg_t) mp_res.triplet.dev_handle,
262
        (ipcarg_t) mp_res.triplet.dev_handle,
260
        (ipcarg_t) mp_res.triplet.index, 0, NULL);
263
        (ipcarg_t) mp_res.triplet.index,
261
    /* The second call uses the same method. */
-
 
262
    aid_t req2 = async_send_3(phone, VFS_MOUNT,
-
 
263
        (ipcarg_t) mr_res.triplet.fs_handle,
264
        (ipcarg_t) mr_res.triplet.fs_handle,
264
        (ipcarg_t) mr_res.triplet.dev_handle,
265
        (ipcarg_t) mr_res.triplet.dev_handle,
265
        (ipcarg_t) mr_res.triplet.index, NULL);
266
        (ipcarg_t) mr_res.triplet.index);
266
    vfs_release_phone(phone);
267
    vfs_release_phone(phone);
267
 
268
 
268
    ipcarg_t rc1;
-
 
269
    ipcarg_t rc2;
-
 
270
    async_wait_for(req1, &rc1);
-
 
271
    async_wait_for(req2, &rc2);
-
 
272
 
-
 
273
    if ((rc1 != EOK) || (rc2 != EOK)) {
269
    if (rc != EOK) {
274
        /* Mount failed, drop references to mr_node and mp_node. */
270
        /* Mount failed, drop references to mr_node and mp_node. */
275
        vfs_node_put(mr_node);
271
        vfs_node_put(mr_node);
276
        if (mp_node)
272
        if (mp_node)
277
            vfs_node_put(mp_node);
273
            vfs_node_put(mp_node);
278
    }
274
    }
279
   
275
   
280
    if (rc2 == EOK)
-
 
281
        ipc_answer_0(rid, rc1);
276
    ipc_answer_0(rid, rc);
282
    else if (rc1 == EOK)
-
 
283
        ipc_answer_0(rid, rc2);
-
 
284
    else
-
 
285
        ipc_answer_0(rid, rc1);
-
 
286
}
277
}
287
 
278
 
288
void vfs_open(ipc_callid_t rid, ipc_call_t *request)
279
void vfs_open(ipc_callid_t rid, ipc_call_t *request)
289
{
280
{
290
    if (!vfs_files_init()) {
281
    if (!vfs_files_init()) {