Changes in uspace/srv/fs/fat/fat_ops.c [38d150e:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r38d150e rb7fd2a0 73 73 * Forward declarations of FAT libfs operations. 74 74 */ 75 static int fat_root_get(fs_node_t **, service_id_t);76 static int fat_match(fs_node_t **, fs_node_t *, const char *);77 static int fat_node_get(fs_node_t **, service_id_t, fs_index_t);78 static int fat_node_open(fs_node_t *);79 static int fat_node_put(fs_node_t *);80 static int fat_create_node(fs_node_t **, service_id_t, int);81 static int fat_destroy_node(fs_node_t *);82 static int fat_link(fs_node_t *, fs_node_t *, const char *);83 static int fat_unlink(fs_node_t *, fs_node_t *, const char *);84 static int fat_has_children(bool *, fs_node_t *);75 static errno_t fat_root_get(fs_node_t **, service_id_t); 76 static errno_t fat_match(fs_node_t **, fs_node_t *, const char *); 77 static errno_t fat_node_get(fs_node_t **, service_id_t, fs_index_t); 78 static errno_t fat_node_open(fs_node_t *); 79 static errno_t fat_node_put(fs_node_t *); 80 static errno_t fat_create_node(fs_node_t **, service_id_t, int); 81 static errno_t fat_destroy_node(fs_node_t *); 82 static errno_t fat_link(fs_node_t *, fs_node_t *, const char *); 83 static errno_t fat_unlink(fs_node_t *, fs_node_t *, const char *); 84 static errno_t fat_has_children(bool *, fs_node_t *); 85 85 static fs_index_t fat_index_get(fs_node_t *); 86 86 static aoff64_t fat_size_get(fs_node_t *); … … 89 89 static bool fat_is_file(fs_node_t *node); 90 90 static service_id_t fat_service_get(fs_node_t *node); 91 static int fat_size_block(service_id_t, uint32_t *);92 static int fat_total_block_count(service_id_t, uint64_t *);93 static int fat_free_block_count(service_id_t, uint64_t *);91 static errno_t fat_size_block(service_id_t, uint32_t *); 92 static errno_t fat_total_block_count(service_id_t, uint64_t *); 93 static errno_t fat_free_block_count(service_id_t, uint64_t *); 94 94 95 95 /* … … 114 114 } 115 115 116 static int fat_node_sync(fat_node_t *node)116 static errno_t fat_node_sync(fat_node_t *node) 117 117 { 118 118 block_t *b; 119 119 fat_bs_t *bs; 120 120 fat_dentry_t *d; 121 int rc;121 errno_t rc; 122 122 123 123 assert(node->dirty); … … 148 148 } 149 149 150 static int fat_node_fini_by_service_id(service_id_t service_id)151 { 152 int rc;150 static errno_t fat_node_fini_by_service_id(service_id_t service_id) 151 { 152 errno_t rc; 153 153 154 154 /* … … 204 204 } 205 205 206 static int fat_node_get_new(fat_node_t **nodepp)206 static errno_t fat_node_get_new(fat_node_t **nodepp) 207 207 { 208 208 fs_node_t *fn; 209 209 fat_node_t *nodep; 210 int rc;210 errno_t rc; 211 211 212 212 fibril_mutex_lock(&ffn_mutex); … … 266 266 * @param idxp Locked index structure. 267 267 */ 268 static int fat_node_get_core(fat_node_t **nodepp, fat_idx_t *idxp)268 static errno_t fat_node_get_core(fat_node_t **nodepp, fat_idx_t *idxp) 269 269 { 270 270 block_t *b; … … 272 272 fat_dentry_t *d; 273 273 fat_node_t *nodep = NULL; 274 int rc;274 errno_t rc; 275 275 276 276 if (idxp->nodep) { … … 365 365 */ 366 366 367 int fat_root_get(fs_node_t **rfn, service_id_t service_id)367 errno_t fat_root_get(fs_node_t **rfn, service_id_t service_id) 368 368 { 369 369 return fat_node_get(rfn, service_id, 0); 370 370 } 371 371 372 int fat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)372 errno_t fat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component) 373 373 { 374 374 fat_node_t *parentp = FAT_NODE(pfn); … … 376 376 fat_dentry_t *d; 377 377 service_id_t service_id; 378 int rc;378 errno_t rc; 379 379 380 380 fibril_mutex_lock(&parentp->idx->lock); … … 426 426 427 427 /** Instantiate a FAT in-core node. */ 428 int fat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)428 errno_t fat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index) 429 429 { 430 430 fat_node_t *nodep; 431 431 fat_idx_t *idxp; 432 int rc;432 errno_t rc; 433 433 434 434 idxp = fat_idx_get_by_index(service_id, index); … … 445 445 } 446 446 447 int fat_node_open(fs_node_t *fn)447 errno_t fat_node_open(fs_node_t *fn) 448 448 { 449 449 /* … … 454 454 } 455 455 456 int fat_node_put(fs_node_t *fn)456 errno_t fat_node_put(fs_node_t *fn) 457 457 { 458 458 fat_node_t *nodep = FAT_NODE(fn); … … 483 483 } 484 484 485 int fat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)485 errno_t fat_create_node(fs_node_t **rfn, service_id_t service_id, int flags) 486 486 { 487 487 fat_idx_t *idxp; … … 489 489 fat_bs_t *bs; 490 490 fat_cluster_t mcl, lcl; 491 int rc;491 errno_t rc; 492 492 493 493 bs = block_bb_get(service_id); … … 538 538 } 539 539 540 int fat_destroy_node(fs_node_t *fn)540 errno_t fat_destroy_node(fs_node_t *fn) 541 541 { 542 542 fat_node_t *nodep = FAT_NODE(fn); 543 543 fat_bs_t *bs; 544 544 bool has_children; 545 int rc;545 errno_t rc; 546 546 547 547 /* … … 575 575 } 576 576 577 int fat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)577 errno_t fat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name) 578 578 { 579 579 fat_node_t *parentp = FAT_NODE(pfn); … … 584 584 fat_directory_t di; 585 585 fat_dentry_t de; 586 int rc;586 errno_t rc; 587 587 588 588 fibril_mutex_lock(&childp->lock); … … 696 696 } 697 697 698 int fat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)698 errno_t fat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm) 699 699 { 700 700 fat_node_t *parentp = FAT_NODE(pfn); 701 701 fat_node_t *childp = FAT_NODE(cfn); 702 702 bool has_children; 703 int rc;703 errno_t rc; 704 704 705 705 if (!parentp) … … 753 753 } 754 754 755 int fat_has_children(bool *has_children, fs_node_t *fn)755 errno_t fat_has_children(bool *has_children, fs_node_t *fn) 756 756 { 757 757 fat_bs_t *bs; … … 760 760 block_t *b; 761 761 unsigned i, j; 762 int rc;762 errno_t rc; 763 763 764 764 if (nodep->type != FAT_DIRECTORY) { … … 843 843 } 844 844 845 int fat_size_block(service_id_t service_id, uint32_t *size)845 errno_t fat_size_block(service_id_t service_id, uint32_t *size) 846 846 { 847 847 fat_bs_t *bs; … … 853 853 } 854 854 855 int fat_total_block_count(service_id_t service_id, uint64_t *count)855 errno_t fat_total_block_count(service_id_t service_id, uint64_t *count) 856 856 { 857 857 fat_bs_t *bs; … … 863 863 } 864 864 865 int fat_free_block_count(service_id_t service_id, uint64_t *count)865 errno_t fat_free_block_count(service_id_t service_id, uint64_t *count) 866 866 { 867 867 fat_bs_t *bs; 868 868 fat_cluster_t e0; 869 869 uint64_t block_count; 870 int rc;870 errno_t rc; 871 871 uint32_t cluster_no, clusters; 872 872 … … 910 910 }; 911 911 912 static int fat_fs_open(service_id_t service_id, enum cache_mode cmode,912 static errno_t fat_fs_open(service_id_t service_id, enum cache_mode cmode, 913 913 fs_node_t **rrfn, fat_idx_t **rridxp) 914 914 { 915 915 fat_bs_t *bs; 916 int rc;916 errno_t rc; 917 917 918 918 /* initialize libblock */ … … 1037 1037 */ 1038 1038 1039 static int fat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)1039 static errno_t fat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 1040 1040 { 1041 1041 fat_idx_t *ridxp; … … 1044 1044 fat_directory_t di; 1045 1045 char label[FAT_VOLLABEL_LEN + 1]; 1046 int rc;1046 errno_t rc; 1047 1047 1048 1048 rc = fat_fs_open(service_id, CACHE_MODE_WT, &rfn, &ridxp); … … 1076 1076 } 1077 1077 1078 static int1078 static errno_t 1079 1079 fat_mounted(service_id_t service_id, const char *opts, fs_index_t *index, 1080 1080 aoff64_t *size) … … 1084 1084 fat_idx_t *ridxp; 1085 1085 fs_node_t *rfn; 1086 int rc;1086 errno_t rc; 1087 1087 1088 1088 instance = malloc(sizeof(fat_instance_t)); … … 1125 1125 } 1126 1126 1127 static int fat_update_fat32_fsinfo(service_id_t service_id)1127 static errno_t fat_update_fat32_fsinfo(service_id_t service_id) 1128 1128 { 1129 1129 fat_bs_t *bs; 1130 1130 fat32_fsinfo_t *info; 1131 1131 block_t *b; 1132 int rc;1132 errno_t rc; 1133 1133 1134 1134 bs = block_bb_get(service_id); … … 1156 1156 } 1157 1157 1158 static int fat_unmounted(service_id_t service_id)1158 static errno_t fat_unmounted(service_id_t service_id) 1159 1159 { 1160 1160 fs_node_t *fn; 1161 1161 fat_node_t *nodep; 1162 1162 fat_bs_t *bs; 1163 int rc;1163 errno_t rc; 1164 1164 1165 1165 bs = block_bb_get(service_id); … … 1208 1208 } 1209 1209 1210 static int1210 static errno_t 1211 1211 fat_read(service_id_t service_id, fs_index_t index, aoff64_t pos, 1212 1212 size_t *rbytes) … … 1217 1217 size_t bytes; 1218 1218 block_t *b; 1219 int rc;1219 errno_t rc; 1220 1220 1221 1221 rc = fat_node_get(&fn, service_id, index); … … 1318 1318 } 1319 1319 1320 static int1320 static errno_t 1321 1321 fat_write(service_id_t service_id, fs_index_t index, aoff64_t pos, 1322 1322 size_t *wbytes, aoff64_t *nsize) … … 1329 1329 aoff64_t boundary; 1330 1330 int flags = BLOCK_FLAGS_NONE; 1331 int rc;1331 errno_t rc; 1332 1332 1333 1333 rc = fat_node_get(&fn, service_id, index); … … 1455 1455 } 1456 1456 1457 static int1457 static errno_t 1458 1458 fat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size) 1459 1459 { … … 1461 1461 fat_node_t *nodep; 1462 1462 fat_bs_t *bs; 1463 int rc;1463 errno_t rc; 1464 1464 1465 1465 rc = fat_node_get(&fn, service_id, index); … … 1514 1514 } 1515 1515 1516 static int fat_close(service_id_t service_id, fs_index_t index)1517 { 1518 return EOK; 1519 } 1520 1521 static int fat_destroy(service_id_t service_id, fs_index_t index)1516 static errno_t fat_close(service_id_t service_id, fs_index_t index) 1517 { 1518 return EOK; 1519 } 1520 1521 static errno_t fat_destroy(service_id_t service_id, fs_index_t index) 1522 1522 { 1523 1523 fs_node_t *fn; 1524 1524 fat_node_t *nodep; 1525 int rc;1525 errno_t rc; 1526 1526 1527 1527 rc = fat_node_get(&fn, service_id, index); … … 1542 1542 } 1543 1543 1544 static int fat_sync(service_id_t service_id, fs_index_t index)1544 static errno_t fat_sync(service_id_t service_id, fs_index_t index) 1545 1545 { 1546 1546 fs_node_t *fn; 1547 int rc = fat_node_get(&fn, service_id, index);1547 errno_t rc = fat_node_get(&fn, service_id, index); 1548 1548 if (rc != EOK) 1549 1549 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.