Changes in uspace/srv/fs/mfs/mfs_ops.c [1ba6651:5930e3f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
r1ba6651 r5930e3f 64 64 static int mfs_check_sanity(struct mfs_sb_info *sbi); 65 65 static bool is_power_of_two(uint32_t n); 66 static long mfs_size_block(service_id_t service_id); 66 67 67 68 static hash_table_t open_nodes; … … 84 85 .destroy = mfs_destroy_node, 85 86 .has_children = mfs_has_children, 86 .lnkcnt_get = mfs_lnkcnt_get 87 .lnkcnt_get = mfs_lnkcnt_get, 88 .size_block = mfs_size_block 87 89 }; 88 90 89 91 /* Hash table interface for open nodes hash table */ 92 90 93 typedef struct { 91 94 service_id_t service_id; … … 189 192 /* This is a V1 or V2 Minix filesystem */ 190 193 magic = sb->s_magic; 191 } else if (check_magic_number(sb3->s_magic, &native, 192 &version, &longnames)) { 194 } else if (check_magic_number(sb3->s_magic, &native, &version, &longnames)) { 193 195 /* This is a V3 Minix filesystem */ 194 196 magic = sb3->s_magic; … … 345 347 uint32_t inum; 346 348 349 mfsdebug("%s()\n", __FUNCTION__); 350 347 351 r = mfs_instance_get(service_id, &inst); 348 352 if (r != EOK) … … 377 381 ino_i->i_mode = S_IFDIR; 378 382 ino_i->i_nlinks = 1; /* This accounts for the '.' dentry */ 379 } else {383 } else 380 384 ino_i->i_mode = S_IFREG; 381 ino_i->i_nlinks = 0;382 }383 385 384 386 ino_i->i_uid = 0; … … 419 421 free(ino_i); 420 422 out_err: 421 mfs_free_inode(inst, inum);422 423 return r; 423 424 } … … 430 431 struct mfs_dentry_info d_info; 431 432 int r; 433 434 mfsdebug("%s()\n", __FUNCTION__); 432 435 433 436 if (!S_ISDIR(ino_i->i_mode)) … … 477 480 struct mfs_instance *instance; 478 481 482 mfsdebug("%s()\n", __FUNCTION__); 483 479 484 rc = mfs_instance_get(service_id, &instance); 480 485 if (rc != EOK) … … 489 494 int rc = EOK; 490 495 struct mfs_node *mnode = fsnode->data; 496 497 mfsdebug("%s()\n", __FUNCTION__); 491 498 492 499 fibril_mutex_lock(&open_nodes_lock); … … 549 556 int rc; 550 557 558 mfsdebug("%s()\n", __FUNCTION__); 559 551 560 fibril_mutex_lock(&open_nodes_lock); 552 561 … … 561 570 if (already_open) { 562 571 mnode = hash_table_get_inst(already_open, struct mfs_node, link); 563 564 572 *rfn = mnode->fsnode; 565 573 mnode->refcnt++; … … 642 650 struct mfs_sb_info *sbi = parent->instance->sbi; 643 651 bool destroy_dentry = false; 652 653 mfsdebug("%s()\n", __FUNCTION__); 644 654 645 655 if (str_size(name) > sbi->max_name_len) … … 665 675 r = mfs_insert_dentry(child, "..", parent->ino_i->index); 666 676 if (r != EOK) { 667 mfs_remove_dentry(child, ".");668 677 destroy_dentry = true; 669 678 goto exit; … … 693 702 bool has_children; 694 703 int r; 704 705 mfsdebug("%s()\n", __FUNCTION__); 695 706 696 707 if (!parent) … … 915 926 916 927 r = mfs_write_map(mnode, pos, block, &dummy); 917 if (r != EOK) { 918 mfs_free_zone(mnode->instance, block); 928 if (r != EOK) 919 929 goto out_err; 920 }921 930 922 931 flags = BLOCK_FLAGS_NOREAD; … … 958 967 mfs_destroy(service_id_t service_id, fs_index_t index) 959 968 { 960 fs_node_t *fn = NULL;969 fs_node_t *fn; 961 970 int r; 962 971 … … 1129 1138 } 1130 1139 1140 static long 1141 mfs_size_block(service_id_t service_id) 1142 { 1143 long block_size; 1144 1145 struct mfs_instance *inst; 1146 int rc = mfs_instance_get(service_id, &inst); 1147 if (rc != EOK) 1148 return rc; 1149 if (NULL == inst) 1150 return ENOENT; 1151 block_size = inst->sbi->block_size; 1152 return block_size; 1153 } 1154 1131 1155 vfs_out_ops_t mfs_ops = { 1132 1156 .mounted = mfs_mounted,
Note:
See TracChangeset
for help on using the changeset viewer.