Changeset bb9ec2d in mainline for uspace/srv/vfs/vfs_file.c
- Timestamp:
- 2017-03-07T20:47:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
- Children:
- a737667e
- Parents:
- e796dc8
- git-author:
- Jiri Zarevucky <zarevucky.jiri@…> (2017-03-07 20:47:35)
- git-committer:
- Jakub Jermar <jakub@…> (2017-03-07 20:47:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_file.c
re796dc8 rbb9ec2d 59 59 typedef struct { 60 60 link_t link; 61 int handle; 61 vfs_node_t *node; 62 int permissions; 62 63 } vfs_boxed_handle_t; 63 64 … … 365 366 vfs_client_data_t *acceptor_data = NULL; 366 367 vfs_file_t *donor_file = NULL; 367 vfs_file_t *acceptor_file = NULL;368 368 vfs_boxed_handle_t *bh; 369 int acceptor_fd;370 369 371 370 acceptor_data = async_get_client_data_by_id(acceptor_id); … … 377 376 378 377 link_initialize(&bh->link); 379 bh-> handle = -1;378 bh->node = NULL; 380 379 381 380 donor_data = async_get_client_data_by_id(donor_id); … … 386 385 if (!donor_file) 387 386 goto out; 388 389 acceptor_fd = _vfs_fd_alloc(acceptor_data, &acceptor_file, false);390 if (acceptor_fd < 0)391 goto out;392 393 bh->handle = acceptor_fd;394 387 395 388 /* … … 397 390 */ 398 391 vfs_node_addref(donor_file->node); 399 400 assert(acceptor_file); 401 402 /* 403 * Inherit attributes from the donor. 404 */ 405 acceptor_file->node = donor_file->node; 406 acceptor_file->permissions = donor_file->permissions; 407 408 // TODO: The file should not inherit its open status, but clients depend on this. 409 acceptor_file->pos = donor_file->pos; 410 acceptor_file->append = donor_file->append; 411 acceptor_file->open_read = donor_file->open_read; 412 acceptor_file->open_write = donor_file->open_write; 413 414 if (acceptor_file->open_read || acceptor_file->open_write) { 415 (void) vfs_open_node_remote(acceptor_file->node); 416 } 392 bh->node = donor_file->node; 393 bh->permissions = donor_file->permissions; 417 394 418 395 out: … … 428 405 if (donor_file) 429 406 _vfs_file_put(donor_data, donor_file); 430 if (acceptor_file) 431 _vfs_file_put(acceptor_data, acceptor_file); 432 433 } 434 435 int vfs_wait_handle_internal(void) 407 } 408 409 int vfs_wait_handle_internal(bool high_fd) 436 410 { 437 411 vfs_client_data_t *vfs_data = VFS_DATA; 438 int fd;439 412 440 413 fibril_mutex_lock(&vfs_data->lock); … … 446 419 447 420 vfs_boxed_handle_t *bh = list_get_instance(lnk, vfs_boxed_handle_t, link); 448 fd = bh->handle; 421 422 vfs_file_t *file; 423 int fd = _vfs_fd_alloc(vfs_data, &file, high_fd); 424 if (fd < 0) { 425 vfs_node_delref(bh->node); 426 free(bh); 427 return fd; 428 } 429 430 file->node = bh->node; 431 file->permissions = bh->permissions; 432 vfs_file_put(file); 449 433 free(bh); 450 451 434 return fd; 452 435 }
Note:
See TracChangeset
for help on using the changeset viewer.