Changeset 984a9ba in mainline for uspace/srv/fs/tmpfs
- Timestamp:
- 2018-07-05T09:34:09Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63d46341
- Parents:
- 76f566d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r76f566d r984a9ba 55 55 56 56 /** All root nodes have index 0. */ 57 #define TMPFS_SOME_ROOT 0 57 #define TMPFS_SOME_ROOT 0 58 58 59 /** Global counter for assigning node indices. Shared by all instances. */ 59 60 fs_index_t tmpfs_next_index = 1; … … 308 309 if (!nodep) 309 310 return ENOMEM; 311 310 312 tmpfs_node_initialize(nodep); 311 313 nodep->bp = malloc(sizeof(fs_node_t)); … … 314 316 return ENOMEM; 315 317 } 318 316 319 fs_node_initialize(nodep->bp); 317 nodep->bp->data = nodep; /* link the FS and TMPFS nodes */320 nodep->bp->data = nodep; /* Link the FS and TMPFS nodes */ 318 321 319 322 rc = tmpfs_root_get(&rootfn, service_id); … … 323 326 else 324 327 nodep->index = tmpfs_next_index++; 328 325 329 nodep->service_id = service_id; 326 330 if (lflag & L_DIRECTORY) … … 480 484 * Receive the read request. 481 485 */ 482 cap_call_handle_t chandle;486 ipc_call_t call; 483 487 size_t size; 484 if (!async_data_read_receive(&c handle, &size)) {485 async_answer_0( chandle, EINVAL);488 if (!async_data_read_receive(&call, &size)) { 489 async_answer_0(&call, EINVAL); 486 490 return EINVAL; 487 491 } … … 490 494 if (nodep->type == TMPFS_FILE) { 491 495 bytes = min(nodep->size - pos, size); 492 (void) async_data_read_finalize( chandle, nodep->data + pos,496 (void) async_data_read_finalize(&call, nodep->data + pos, 493 497 bytes); 494 498 } else { … … 506 510 507 511 if (lnk == NULL) { 508 async_answer_0( chandle, ENOENT);512 async_answer_0(&call, ENOENT); 509 513 return ENOENT; 510 514 } … … 512 516 dentryp = list_get_instance(lnk, tmpfs_dentry_t, link); 513 517 514 (void) async_data_read_finalize( chandle, dentryp->name,518 (void) async_data_read_finalize(&call, dentryp->name, 515 519 str_size(dentryp->name) + 1); 516 520 bytes = 1; … … 543 547 * Receive the write request. 544 548 */ 545 cap_call_handle_t chandle;549 ipc_call_t call; 546 550 size_t size; 547 if (!async_data_write_receive(&c handle, &size)) {548 async_answer_0( chandle, EINVAL);551 if (!async_data_write_receive(&call, &size)) { 552 async_answer_0(&call, EINVAL); 549 553 return EINVAL; 550 554 } … … 555 559 if (pos + size <= nodep->size) { 556 560 /* The file size is not changing. */ 557 (void) async_data_write_finalize( chandle, nodep->data + pos,561 (void) async_data_write_finalize(&call, nodep->data + pos, 558 562 size); 559 563 goto out; … … 569 573 void *newdata = realloc(nodep->data, nodep->size + delta); 570 574 if (!newdata) { 571 async_answer_0( chandle, ENOMEM);575 async_answer_0(&call, ENOMEM); 572 576 size = 0; 573 577 goto out; … … 577 581 nodep->size += delta; 578 582 nodep->data = newdata; 579 (void) async_data_write_finalize( chandle, nodep->data + pos, size);583 (void) async_data_write_finalize(&call, nodep->data + pos, size); 580 584 581 585 out:
Note:
See TracChangeset
for help on using the changeset viewer.