Rev 3535 | Rev 4345 | Go to most recent revision | Show entire file | Regard 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 464... | Line 475... | ||
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); |
468 | 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 | } |
|
- | 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; |
473 | ipc_call_t answer; |
493 | ipc_call_t answer; |
Line 489... | Line 509... | ||
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); |
493 | 513 | ||
- | 514 | if (file->node->type == VFS_NODE_DIRECTORY) |
|
- | 515 | rwlock_read_unlock(&namespace_rwlock); |
|
- | 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 { |
498 | /* Update the cached version of node's size. */ |
521 | /* Update the cached version of node's size. */ |