Subversion Repositories HelenOS

Rev

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

Rev 3535 Rev 3674
Line 232... Line 232...
232
            mr_res.triplet.fs_handle = fs_handle;
232
            mr_res.triplet.fs_handle = fs_handle;
233
            mr_res.triplet.dev_handle = dev_handle;
233
            mr_res.triplet.dev_handle = dev_handle;
234
            mr_res.triplet.index = (fs_index_t) rindex;
234
            mr_res.triplet.index = (fs_index_t) rindex;
235
            mr_res.size = (size_t) rsize;
235
            mr_res.size = (size_t) rsize;
236
            mr_res.lnkcnt = (unsigned) rlnkcnt;
236
            mr_res.lnkcnt = (unsigned) rlnkcnt;
-
 
237
            mr_res.type = VFS_NODE_DIRECTORY;
237
 
238
 
238
            rootfs.fs_handle = fs_handle;
239
            rootfs.fs_handle = fs_handle;
239
            rootfs.dev_handle = dev_handle;
240
            rootfs.dev_handle = dev_handle;
240
            futex_up(&rootfs_futex);
241
            futex_up(&rootfs_futex);
241
 
242
 
Line 300... Line 301...
300
    int lflag = IPC_GET_ARG1(*request);
301
    int lflag = IPC_GET_ARG1(*request);
301
    int oflag = IPC_GET_ARG2(*request);
302
    int oflag = IPC_GET_ARG2(*request);
302
    int mode = IPC_GET_ARG3(*request);
303
    int mode = IPC_GET_ARG3(*request);
303
    size_t len;
304
    size_t len;
304
 
305
 
-
 
306
    /*
-
 
307
     * Make sure that we are called with exactly one of L_FILE and
-
 
308
     * L_DIRECTORY.
-
 
309
     */
-
 
310
    if ((lflag & (L_FILE | L_DIRECTORY)) == 0 ||
-
 
311
        (lflag & (L_FILE | L_DIRECTORY)) == (L_FILE | L_DIRECTORY)) {
-
 
312
        ipc_answer_0(rid, EINVAL);
-
 
313
        return;
-
 
314
    }
-
 
315
 
305
    if (oflag & O_CREAT)
316
    if (oflag & O_CREAT)
306
        lflag |= L_CREATE;
317
        lflag |= L_CREATE;
307
    if (oflag & O_EXCL)
318
    if (oflag & O_EXCL)
308
        lflag |= L_EXCLUSIVE;
319
        lflag |= L_EXCLUSIVE;
309
 
320
 
Line 454... Line 465...
454
    /*
465
    /*
455
     * Lock the open file structure so that no other thread can manipulate
466
     * Lock the open file structure so that no other thread can manipulate
456
     * the same open file at a time.
467
     * the same open file at a time.
457
     */
468
     */
458
    futex_down(&file->lock);
469
    futex_down(&file->lock);
459
   
470
 
460
    /*
471
    /*
461
     * Lock the file's node so that no other client can read/write to it at
472
     * Lock the file's node so that no other client can read/write to it at
462
     * the same time.
473
     * the same time.
463
     */
474
     */
464
    if (read)
475
    if (read)
465
        rwlock_read_lock(&file->node->contents_rwlock);
476
        rwlock_read_lock(&file->node->contents_rwlock);
466
    else
477
    else
467
        rwlock_write_lock(&file->node->contents_rwlock);
478
        rwlock_write_lock(&file->node->contents_rwlock);
-
 
479
 
-
 
480
    if (file->node->type == VFS_NODE_DIRECTORY) {
-
 
481
        /*
-
 
482
         * Make sure that no one is modifying the namespace
-
 
483
         * while we are in readdir().
-
 
484
         */
-
 
485
        assert(read);
-
 
486
        rwlock_read_lock(&namespace_rwlock);
-
 
487
    }
468
   
488
   
469
    int fs_phone = vfs_grab_phone(file->node->fs_handle);  
489
    int fs_phone = vfs_grab_phone(file->node->fs_handle);  
470
   
490
   
471
    /* Make a VFS_READ/VFS_WRITE request at the destination FS server. */
491
    /* Make a VFS_READ/VFS_WRITE request at the destination FS server. */
472
    aid_t msg;
492
    aid_t msg;
Line 488... Line 508...
488
   
508
   
489
    /* Wait for reply from the FS server. */
509
    /* Wait for reply from the FS server. */
490
    ipcarg_t rc;
510
    ipcarg_t rc;
491
    async_wait_for(msg, &rc);
511
    async_wait_for(msg, &rc);
492
    size_t bytes = IPC_GET_ARG1(answer);
512
    size_t bytes = IPC_GET_ARG1(answer);
-
 
513
 
-
 
514
    if (file->node->type == VFS_NODE_DIRECTORY)
-
 
515
        rwlock_read_unlock(&namespace_rwlock);
493
   
516
   
494
    /* Unlock the VFS node. */
517
    /* Unlock the VFS node. */
495
    if (read)
518
    if (read)
496
        rwlock_read_unlock(&file->node->contents_rwlock);
519
        rwlock_read_unlock(&file->node->contents_rwlock);
497
    else {
520
    else {