Changes in uspace/srv/fs/mfs/mfs_ops.c [4f30222:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
r4f30222 rb7fd2a0 41 41 static bool check_magic_number(uint16_t magic, bool *native, 42 42 mfs_version_t *version, bool *longfilenames); 43 static int mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst,43 static errno_t mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst, 44 44 fs_index_t index); 45 static int mfs_node_put(fs_node_t *fsnode);46 static int mfs_node_open(fs_node_t *fsnode);45 static errno_t mfs_node_put(fs_node_t *fsnode); 46 static errno_t mfs_node_open(fs_node_t *fsnode); 47 47 static fs_index_t mfs_index_get(fs_node_t *fsnode); 48 48 static unsigned mfs_lnkcnt_get(fs_node_t *fsnode); 49 49 static bool mfs_is_directory(fs_node_t *fsnode); 50 50 static bool mfs_is_file(fs_node_t *fsnode); 51 static int mfs_has_children(bool *has_children, fs_node_t *fsnode);52 static int mfs_root_get(fs_node_t **rfn, service_id_t service_id);51 static errno_t mfs_has_children(bool *has_children, fs_node_t *fsnode); 52 static errno_t mfs_root_get(fs_node_t **rfn, service_id_t service_id); 53 53 static service_id_t mfs_service_get(fs_node_t *fsnode); 54 54 static aoff64_t mfs_size_get(fs_node_t *node); 55 static int mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component);56 static int mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags);57 static int mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name);58 static int mfs_unlink(fs_node_t *, fs_node_t *, const char *name);59 static int mfs_destroy_node(fs_node_t *fn);60 static int mfs_node_get(fs_node_t **rfn, service_id_t service_id,55 static errno_t mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component); 56 static errno_t mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags); 57 static errno_t mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name); 58 static errno_t mfs_unlink(fs_node_t *, fs_node_t *, const char *name); 59 static errno_t mfs_destroy_node(fs_node_t *fn); 60 static errno_t mfs_node_get(fs_node_t **rfn, service_id_t service_id, 61 61 fs_index_t index); 62 static int mfs_instance_get(service_id_t service_id,62 static errno_t mfs_instance_get(service_id_t service_id, 63 63 struct mfs_instance **instance); 64 static int mfs_check_sanity(struct mfs_sb_info *sbi);64 static errno_t mfs_check_sanity(struct mfs_sb_info *sbi); 65 65 static bool is_power_of_two(uint32_t n); 66 static int mfs_size_block(service_id_t service_id, uint32_t *size);67 static int mfs_total_block_count(service_id_t service_id, uint64_t *count);68 static int mfs_free_block_count(service_id_t service_id, uint64_t *count);66 static errno_t mfs_size_block(service_id_t service_id, uint32_t *size); 67 static errno_t mfs_total_block_count(service_id_t service_id, uint64_t *count); 68 static errno_t mfs_free_block_count(service_id_t service_id, uint64_t *count); 69 69 70 70 static hash_table_t open_nodes; … … 131 131 }; 132 132 133 int133 errno_t 134 134 mfs_global_init(void) 135 135 { … … 142 142 /** Read the superblock. 143 143 */ 144 static int mfs_read_sb(service_id_t service_id, struct mfs_sb_info **rsbi)144 static errno_t mfs_read_sb(service_id_t service_id, struct mfs_sb_info **rsbi) 145 145 { 146 146 struct mfs_superblock *sb = NULL; … … 151 151 mfs_version_t version; 152 152 uint16_t magic; 153 int rc;153 errno_t rc; 154 154 155 155 /* Allocate space for generic MFS superblock */ … … 277 277 278 278 279 static int mfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)279 static errno_t mfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 280 280 { 281 281 struct mfs_sb_info *sbi = NULL; 282 int rc;282 errno_t rc; 283 283 284 284 /* Initialize libblock */ … … 294 294 } 295 295 296 static int296 static errno_t 297 297 mfs_mounted(service_id_t service_id, const char *opts, fs_index_t *index, 298 298 aoff64_t *size) … … 301 301 struct mfs_sb_info *sbi = NULL; 302 302 struct mfs_instance *instance = NULL; 303 int rc;303 errno_t rc; 304 304 305 305 /* Check for option enabling write through. */ … … 365 365 } 366 366 367 static int367 static errno_t 368 368 mfs_unmounted(service_id_t service_id) 369 369 { … … 372 372 mfsdebug("%s()\n", __FUNCTION__); 373 373 374 int r = mfs_instance_get(service_id, &inst);374 errno_t r = mfs_instance_get(service_id, &inst); 375 375 if (r != EOK) 376 376 return r; … … 396 396 } 397 397 398 static int398 static errno_t 399 399 mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags) 400 400 { 401 int r;401 errno_t r; 402 402 struct mfs_instance *inst; 403 403 struct mfs_node *mnode; … … 483 483 } 484 484 485 static int485 static errno_t 486 486 mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component) 487 487 { … … 489 489 struct mfs_ino_info *ino_i = mnode->ino_i; 490 490 struct mfs_dentry_info d_info; 491 int r;491 errno_t r; 492 492 493 493 if (!S_ISDIR(ino_i->i_mode)) … … 530 530 } 531 531 532 static int532 static errno_t 533 533 mfs_node_get(fs_node_t **rfn, service_id_t service_id, 534 534 fs_index_t index) 535 535 { 536 int rc;536 errno_t rc; 537 537 struct mfs_instance *instance; 538 538 … … 544 544 } 545 545 546 static int546 static errno_t 547 547 mfs_node_put(fs_node_t *fsnode) 548 548 { 549 int rc = EOK;549 errno_t rc = EOK; 550 550 struct mfs_node *mnode = fsnode->data; 551 551 … … 568 568 } 569 569 570 static int570 static errno_t 571 571 mfs_node_open(fs_node_t *fsnode) 572 572 { … … 601 601 } 602 602 603 static int603 static errno_t 604 604 mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst, 605 605 fs_index_t index) … … 607 607 fs_node_t *node = NULL; 608 608 struct mfs_node *mnode = NULL; 609 int rc;609 errno_t rc; 610 610 611 611 fibril_mutex_lock(&open_nodes_lock); … … 688 688 } 689 689 690 static int690 static errno_t 691 691 mfs_root_get(fs_node_t **rfn, service_id_t service_id) 692 692 { 693 int rc = mfs_node_get(rfn, service_id, MFS_ROOT_INO);693 errno_t rc = mfs_node_get(rfn, service_id, MFS_ROOT_INO); 694 694 return rc; 695 695 } 696 696 697 static int697 static errno_t 698 698 mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name) 699 699 { … … 706 706 return ENAMETOOLONG; 707 707 708 int r = mfs_insert_dentry(parent, name, child->ino_i->index);708 errno_t r = mfs_insert_dentry(parent, name, child->ino_i->index); 709 709 if (r != EOK) 710 710 return r; … … 736 736 exit: 737 737 if (destroy_dentry) { 738 int r2 = mfs_remove_dentry(parent, name);738 errno_t r2 = mfs_remove_dentry(parent, name); 739 739 if (r2 != EOK) 740 740 r = r2; … … 746 746 } 747 747 748 static int748 static errno_t 749 749 mfs_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *name) 750 750 { … … 752 752 struct mfs_node *child = cfn->data; 753 753 bool has_children; 754 int r;754 errno_t r; 755 755 756 756 if (!parent) … … 787 787 } 788 788 789 static int789 static errno_t 790 790 mfs_has_children(bool *has_children, fs_node_t *fsnode) 791 791 { 792 792 struct mfs_node *mnode = fsnode->data; 793 793 struct mfs_sb_info *sbi = mnode->instance->sbi; 794 int r;794 errno_t r; 795 795 796 796 *has_children = false; … … 819 819 } 820 820 821 static int821 static errno_t 822 822 mfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos, 823 823 size_t *rbytes) 824 824 { 825 int rc;825 errno_t rc; 826 826 fs_node_t *fn = NULL; 827 827 … … 926 926 out_error: 927 927 ; 928 int tmp = mfs_node_put(fn);928 errno_t tmp = mfs_node_put(fn); 929 929 async_answer_0(callid, tmp != EOK ? tmp : rc); 930 930 return tmp != EOK ? tmp : rc; 931 931 } 932 932 933 static int933 static errno_t 934 934 mfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos, 935 935 size_t *wbytes, aoff64_t *nsize) 936 936 { 937 937 fs_node_t *fn; 938 int r;938 errno_t r; 939 939 int flags = BLOCK_FLAGS_NONE; 940 940 … … 1015 1015 } 1016 1016 1017 static int1017 static errno_t 1018 1018 mfs_destroy(service_id_t service_id, fs_index_t index) 1019 1019 { 1020 1020 fs_node_t *fn = NULL; 1021 int r;1021 errno_t r; 1022 1022 1023 1023 r = mfs_node_get(&fn, service_id, index); … … 1031 1031 } 1032 1032 1033 static int1033 static errno_t 1034 1034 mfs_destroy_node(fs_node_t *fn) 1035 1035 { 1036 1036 struct mfs_node *mnode = fn->data; 1037 1037 bool has_children; 1038 int r;1038 errno_t r; 1039 1039 1040 1040 mfsdebug("mfs_destroy_node %d\n", mnode->ino_i->index); … … 1059 1059 } 1060 1060 1061 static int1061 static errno_t 1062 1062 mfs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size) 1063 1063 { 1064 1064 fs_node_t *fn; 1065 int r;1065 errno_t r; 1066 1066 1067 1067 r = mfs_node_get(&fn, service_id, index); … … 1083 1083 } 1084 1084 1085 static int1085 static errno_t 1086 1086 mfs_instance_get(service_id_t service_id, struct mfs_instance **instance) 1087 1087 { 1088 1088 void *data; 1089 int rc;1089 errno_t rc; 1090 1090 1091 1091 rc = fs_instance_get(service_id, &data); … … 1135 1135 * @return EOK on success, ENOTSUP otherwise. 1136 1136 */ 1137 static int1137 static errno_t 1138 1138 mfs_check_sanity(struct mfs_sb_info *sbi) 1139 1139 { … … 1152 1152 } 1153 1153 1154 static int1154 static errno_t 1155 1155 mfs_close(service_id_t service_id, fs_index_t index) 1156 1156 { … … 1158 1158 } 1159 1159 1160 static int1160 static errno_t 1161 1161 mfs_sync(service_id_t service_id, fs_index_t index) 1162 1162 { 1163 1163 fs_node_t *fn = NULL; 1164 int rc = mfs_node_get(&fn, service_id, index);1164 errno_t rc = mfs_node_get(&fn, service_id, index); 1165 1165 if (rc != EOK) 1166 1166 return rc; … … 1189 1189 } 1190 1190 1191 static int1191 static errno_t 1192 1192 mfs_size_block(service_id_t service_id, uint32_t *size) 1193 1193 { 1194 1194 struct mfs_instance *inst; 1195 int rc;1195 errno_t rc; 1196 1196 1197 1197 rc = mfs_instance_get(service_id, &inst); … … 1207 1207 } 1208 1208 1209 static int1209 static errno_t 1210 1210 mfs_total_block_count(service_id_t service_id, uint64_t *count) 1211 1211 { 1212 1212 struct mfs_instance *inst; 1213 int rc;1213 errno_t rc; 1214 1214 1215 1215 rc = mfs_instance_get(service_id, &inst); … … 1225 1225 } 1226 1226 1227 static int1227 static errno_t 1228 1228 mfs_free_block_count(service_id_t service_id, uint64_t *count) 1229 1229 { … … 1231 1231 1232 1232 struct mfs_instance *inst; 1233 int rc = mfs_instance_get(service_id, &inst);1233 errno_t rc = mfs_instance_get(service_id, &inst); 1234 1234 if (rc != EOK) 1235 1235 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.