Changeset a35b458 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r3061bc1 ra35b458 163 163 tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link); 164 164 node_key_t *key = (node_key_t *)key_arg; 165 165 166 166 return key->service_id == node->service_id && key->index == node->index; 167 167 } … … 220 220 if (!hash_table_create(&nodes, 0, 0, &nodes_ops)) 221 221 return false; 222 222 223 223 return true; 224 224 } … … 228 228 fs_node_t *rfn; 229 229 errno_t rc; 230 230 231 231 rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY); 232 232 if (rc != EOK || !rfn) … … 240 240 service_id_t sid = *(service_id_t*)arg; 241 241 tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link); 242 242 243 243 if (node->service_id == sid) { 244 244 hash_table_remove_item(&nodes, &node->nh_link); … … 273 273 .index = index 274 274 }; 275 275 276 276 ht_link_t *lnk = hash_table_find(&nodes, &key); 277 277 278 278 if (lnk) { 279 279 tmpfs_node_t *nodep; … … 338 338 { 339 339 tmpfs_node_t *nodep = TMPFS_NODE(fn); 340 340 341 341 assert(!nodep->lnkcnt); 342 342 assert(list_empty(&nodep->cs_list)); 343 343 344 344 hash_table_remove_item(&nodes, &nodep->nh_link); 345 345 … … 406 406 if (!childp) 407 407 return ENOENT; 408 408 409 409 if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_list)) 410 410 return ENOTEMPTY; … … 432 432 fs_node_t *rootfn; 433 433 errno_t rc; 434 434 435 435 /* Check if this device is not already mounted. */ 436 436 rc = tmpfs_root_get(&rootfn, service_id); … … 474 474 .index = index 475 475 }; 476 476 477 477 ht_link_t *hlp = hash_table_find(&nodes, &key); 478 478 if (!hlp) 479 479 return ENOENT; 480 480 481 481 tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link); 482 482 483 483 /* 484 484 * Receive the read request. … … 499 499 tmpfs_dentry_t *dentryp; 500 500 link_t *lnk; 501 501 502 502 assert(nodep->type == TMPFS_DIRECTORY); 503 503 504 504 /* 505 505 * Yes, we really use O(n) algorithm here. … … 508 508 */ 509 509 lnk = list_nth(&nodep->cs_list, pos); 510 510 511 511 if (lnk == NULL) { 512 512 async_answer_0(callid, ENOENT); … … 536 536 .index = index 537 537 }; 538 538 539 539 ht_link_t *hlp = hash_table_find(&nodes, &key); 540 540 541 541 if (!hlp) 542 542 return ENOENT; 543 543 544 544 tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link); 545 545 … … 599 599 .index = index 600 600 }; 601 601 602 602 ht_link_t *hlp = hash_table_find(&nodes, &key); 603 603 604 604 if (!hlp) 605 605 return ENOENT; 606 606 tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link); 607 607 608 608 if (size == nodep->size) 609 609 return EOK; 610 610 611 611 if (size > SIZE_MAX) 612 612 return ENOMEM; 613 613 614 614 void *newdata = realloc(nodep->data, size); 615 615 if (!newdata) 616 616 return ENOMEM; 617 617 618 618 if (size > nodep->size) { 619 619 size_t delta = size - nodep->size; 620 620 memset(newdata + nodep->size, 0, delta); 621 621 } 622 622 623 623 nodep->size = size; 624 624 nodep->data = newdata; … … 637 637 .index = index 638 638 }; 639 639 640 640 ht_link_t *hlp = hash_table_find(&nodes, &key); 641 641 if (!hlp)
Note:
See TracChangeset
for help on using the changeset viewer.