Subversion Repositories HelenOS

Rev

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

Rev 2698 Rev 2700
Line 69... Line 69...
69
    vfs_pair_t altroot = {
69
    vfs_pair_t altroot = {
70
        .fs_handle = fs_handle,
70
        .fs_handle = fs_handle,
71
        .dev_handle = dev_handle,
71
        .dev_handle = dev_handle,
72
    };
72
    };
73
 
73
 
74
    return vfs_lookup_internal("/", strlen("/"), result, &altroot);
74
    return vfs_lookup_internal("/", strlen("/"), L_DIRECTORY, result,
-
 
75
        &altroot);
75
}
76
}
76
 
77
 
77
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
78
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
78
{
79
{
79
    int dev_handle;
80
    int dev_handle;
Line 193... Line 194...
193
    if (rootfs.fs_handle) {
194
    if (rootfs.fs_handle) {
194
        /*
195
        /*
195
         * We already have the root FS.
196
         * We already have the root FS.
196
         */
197
         */
197
        rwlock_write_lock(&namespace_rwlock);
198
        rwlock_write_lock(&namespace_rwlock);
198
        rc = vfs_lookup_internal(buf, size, &mp_res, NULL);
199
        rc = vfs_lookup_internal(buf, size, L_DIRECTORY, &mp_res,
-
 
200
            NULL);
199
        if (rc != EOK) {
201
        if (rc != EOK) {
200
            /*
202
            /*
201
             * The lookup failed for some reason.
203
             * The lookup failed for some reason.
202
             */
204
             */
203
            rwlock_write_unlock(&namespace_rwlock);
205
            rwlock_write_unlock(&namespace_rwlock);
Line 295... Line 297...
295
        ipc_answer_0(rid, ENOMEM);
297
        ipc_answer_0(rid, ENOMEM);
296
        return;
298
        return;
297
    }
299
    }
298
 
300
 
299
    /*
301
    /*
300
     * The POSIX interface is open(path, flags, mode).
302
     * The POSIX interface is open(path, oflag, mode).
301
     * We can receive flags and mode along with the VFS_OPEN call; the path
303
     * We can receive oflags and mode along with the VFS_OPEN call; the path
302
     * will need to arrive in another call.
304
     * will need to arrive in another call.
-
 
305
     *
-
 
306
     * We also receive one private, non-POSIX set of flags called lflag
-
 
307
     * used to pass information to vfs_lookup_internal().
303
     */
308
     */
304
    int flags = IPC_GET_ARG1(*request);
309
    int lflag = IPC_GET_ARG1(*request);
-
 
310
    int oflag = IPC_GET_ARG2(*request);
305
    int mode = IPC_GET_ARG2(*request);
311
    int mode = IPC_GET_ARG3(*request);
306
    size_t len;
312
    size_t len;
307
 
313
 
308
    ipc_callid_t callid;
314
    ipc_callid_t callid;
309
 
315
 
310
    if (!ipc_data_write_receive(&callid, &len)) {
316
    if (!ipc_data_write_receive(&callid, &len)) {
Line 343... Line 349...
343
 
349
 
344
    /*
350
    /*
345
     * The path is now populated and we can call vfs_lookup_internal().
351
     * The path is now populated and we can call vfs_lookup_internal().
346
     */
352
     */
347
    vfs_lookup_res_t lr;
353
    vfs_lookup_res_t lr;
348
    rc = vfs_lookup_internal(path, len, &lr, NULL);
354
    rc = vfs_lookup_internal(path, len, lflag, &lr, NULL);
349
    if (rc) {
355
    if (rc) {
350
        rwlock_read_unlock(&namespace_rwlock);
356
        rwlock_read_unlock(&namespace_rwlock);
351
        ipc_answer_0(rid, rc);
357
        ipc_answer_0(rid, rc);
352
        free(path);
358
        free(path);
353
        return;
359
        return;