Changes in uspace/srv/fs/cdfs/cdfs_ops.c [b7fd2a0:38d150e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/cdfs/cdfs_ops.c
rb7fd2a0 r38d150e 331 331 }; 332 332 333 static errno_t cdfs_node_get(fs_node_t **rfn, service_id_t service_id,333 static int cdfs_node_get(fs_node_t **rfn, service_id_t service_id, 334 334 fs_index_t index) 335 335 { … … 351 351 } 352 352 353 static errno_t cdfs_root_get(fs_node_t **rfn, service_id_t service_id)353 static int cdfs_root_get(fs_node_t **rfn, service_id_t service_id) 354 354 { 355 355 return cdfs_node_get(rfn, service_id, CDFS_SOME_ROOT); … … 371 371 } 372 372 373 static errno_t create_node(fs_node_t **rfn, cdfs_t *fs, int lflag,373 static int create_node(fs_node_t **rfn, cdfs_t *fs, int lflag, 374 374 fs_index_t index) 375 375 { … … 392 392 393 393 fs_node_t *rootfn; 394 errno_t rc = cdfs_root_get(&rootfn, fs->service_id);394 int rc = cdfs_root_get(&rootfn, fs->service_id); 395 395 396 396 assert(rc == EOK); … … 417 417 } 418 418 419 static errno_t link_node(fs_node_t *pfn, fs_node_t *fn, const char *name)419 static int link_node(fs_node_t *pfn, fs_node_t *fn, const char *name) 420 420 { 421 421 cdfs_node_t *parent = CDFS_NODE(pfn); … … 460 460 static char *cdfs_decode_str(void *data, size_t dsize, cdfs_enc_t enc) 461 461 { 462 errno_t rc;462 int rc; 463 463 char *str; 464 464 uint16_t *buf; … … 566 566 } 567 567 568 static errno_tcdfs_readdir(cdfs_t *fs, fs_node_t *fs_node)568 static bool cdfs_readdir(cdfs_t *fs, fs_node_t *fs_node) 569 569 { 570 570 cdfs_node_t *node = CDFS_NODE(fs_node); … … 572 572 573 573 if (node->processed) 574 return EOK;574 return true; 575 575 576 576 uint32_t blocks = node->size / BLOCK_SIZE; … … 580 580 for (uint32_t i = 0; i < blocks; i++) { 581 581 block_t *block; 582 errno_t rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE);582 int rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE); 583 583 if (rc != EOK) 584 return rc;584 return false; 585 585 586 586 cdfs_dir_t *dir; … … 614 614 615 615 fs_node_t *fn; 616 errno_t rc = create_node(&fn, fs, dentry_type,616 int rc = create_node(&fn, fs, dentry_type, 617 617 (node->lba + i) * BLOCK_SIZE + offset); 618 if (rc != EOK) 619 return rc; 620 621 assert(fn != NULL); 618 if ((rc != EOK) || (fn == NULL)) 619 return false; 622 620 623 621 cdfs_node_t *cur = CDFS_NODE(fn); … … 628 626 dir->name_length, node->fs->enc, dentry_type); 629 627 if (name == NULL) 630 return EIO;628 return false; 631 629 632 630 // FIXME: check return value … … 643 641 644 642 node->processed = true; 645 return EOK;643 return true; 646 644 } 647 645 … … 652 650 653 651 block_t *block; 654 errno_t rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE);652 int rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE); 655 653 if (rc != EOK) 656 654 return NULL; … … 698 696 } 699 697 700 static errno_t cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component)698 static int cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component) 701 699 { 702 700 cdfs_node_t *parent = CDFS_NODE(pfn); 703 701 704 702 if (!parent->processed) { 705 errno_t rc = cdfs_readdir(parent->fs, pfn);703 int rc = cdfs_readdir(parent->fs, pfn); 706 704 if (rc != EOK) 707 705 return rc; … … 719 717 } 720 718 721 static errno_t cdfs_node_open(fs_node_t *fn)719 static int cdfs_node_open(fs_node_t *fn) 722 720 { 723 721 cdfs_node_t *node = CDFS_NODE(fn); … … 730 728 } 731 729 732 static errno_t cdfs_node_put(fs_node_t *fn)730 static int cdfs_node_put(fs_node_t *fn) 733 731 { 734 732 /* Nothing to do */ … … 736 734 } 737 735 738 static errno_t cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag)736 static int cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag) 739 737 { 740 738 /* Read-only */ … … 742 740 } 743 741 744 static errno_t cdfs_destroy_node(fs_node_t *fn)742 static int cdfs_destroy_node(fs_node_t *fn) 745 743 { 746 744 /* Read-only */ … … 748 746 } 749 747 750 static errno_t cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)748 static int cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name) 751 749 { 752 750 /* Read-only */ … … 754 752 } 755 753 756 static errno_t cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)754 static int cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name) 757 755 { 758 756 /* Read-only */ … … 760 758 } 761 759 762 static errno_t cdfs_has_children(bool *has_children, fs_node_t *fn)760 static int cdfs_has_children(bool *has_children, fs_node_t *fn) 763 761 { 764 762 cdfs_node_t *node = CDFS_NODE(fn); … … 806 804 } 807 805 808 static errno_t cdfs_size_block(service_id_t service_id, uint32_t *size)806 static int cdfs_size_block(service_id_t service_id, uint32_t *size) 809 807 { 810 808 *size = BLOCK_SIZE; … … 813 811 } 814 812 815 static errno_t cdfs_total_block_count(service_id_t service_id, uint64_t *count)813 static int cdfs_total_block_count(service_id_t service_id, uint64_t *count) 816 814 { 817 815 *count = 0; … … 820 818 } 821 819 822 static errno_t cdfs_free_block_count(service_id_t service_id, uint64_t *count)820 static int cdfs_free_block_count(service_id_t service_id, uint64_t *count) 823 821 { 824 822 *count = 0; … … 851 849 /** Verify that escape sequence corresonds to one of the allowed encoding 852 850 * escape sequences allowed for Joliet. */ 853 static errno_t cdfs_verify_joliet_esc_seq(uint8_t *seq)851 static int cdfs_verify_joliet_esc_seq(uint8_t *seq) 854 852 { 855 853 size_t i, j, k; … … 895 893 * @return EOK if found, ENOENT if not 896 894 */ 897 static errno_t cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot,895 static int cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot, 898 896 uint32_t *rlba, uint32_t *rsize, char **vol_ident) 899 897 { … … 902 900 for (bi = altroot + 17; ; bi++) { 903 901 block_t *block; 904 errno_t rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE);902 int rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE); 905 903 if (rc != EOK) 906 904 break; … … 963 961 964 962 /** Read the volume descriptors. */ 965 static errno_tiso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot,963 static bool iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot, 966 964 uint32_t *rlba, uint32_t *rsize, cdfs_enc_t *enc, char **vol_ident) 967 965 { 968 966 /* First 16 blocks of isofs are empty */ 969 967 block_t *block; 970 errno_t rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);968 int rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE); 971 969 if (rc != EOK) 972 return rc;970 return false; 973 971 974 972 cdfs_vol_desc_t *vol_desc = (cdfs_vol_desc_t *) block->data; … … 982 980 (vol_desc->version != 1)) { 983 981 block_put(block); 984 return ENOTSUP;982 return false; 985 983 } 986 984 … … 1002 1000 */ 1003 1001 block_put(block); 1004 return ENOTSUP;1002 return false; 1005 1003 } 1006 1004 … … 1008 1006 if (block_size != BLOCK_SIZE) { 1009 1007 block_put(block); 1010 return ENOTSUP;1008 return false; 1011 1009 } 1012 1010 … … 1033 1031 1034 1032 block_put(block); 1035 return EOK;1036 } 1037 1038 static errno_tiso_readfs(cdfs_t *fs, fs_node_t *rfn,1033 return true; 1034 } 1035 1036 static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn, 1039 1037 cdfs_lba_t altroot) 1040 1038 { 1041 1039 cdfs_node_t *node = CDFS_NODE(rfn); 1042 1040 1043 errno_t rc = iso_read_vol_desc(fs->service_id, altroot, &node->lba, 1044 &node->size, &fs->enc, &fs->vol_ident); 1045 if (rc != EOK) 1046 return rc; 1041 if (!iso_read_vol_desc(fs->service_id, altroot, &node->lba, 1042 &node->size, &fs->enc, &fs->vol_ident)) 1043 return false; 1047 1044 1048 1045 return cdfs_readdir(fs, rfn); … … 1064 1061 1065 1062 /* Create root node */ 1066 errno_t rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++);1063 int rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++); 1067 1064 1068 1065 if ((rc != EOK) || (!rfn)) … … 1075 1072 1076 1073 /* Check if there is cdfs in given session */ 1077 if ( iso_readfs(fs, rfn, altroot) != EOK)1074 if (!iso_readfs(fs, rfn, altroot)) 1078 1075 goto error; 1079 1076 … … 1086 1083 } 1087 1084 1088 static errno_t cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)1085 static int cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 1089 1086 { 1090 1087 char *vol_ident; 1091 1088 1092 1089 /* Initialize the block layer */ 1093 errno_t rc = block_init(service_id, BLOCK_SIZE);1090 int rc = block_init(service_id, BLOCK_SIZE); 1094 1091 if (rc != EOK) 1095 1092 return rc; … … 1128 1125 uint32_t rsize; 1129 1126 cdfs_enc_t enc; 1130 rc = iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc, 1131 &vol_ident); 1132 if (rc != EOK) { 1127 if (!iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc, 1128 &vol_ident)) { 1133 1129 block_cache_fini(service_id); 1134 1130 block_fini(service_id); 1135 return rc;1131 return EIO; 1136 1132 } 1137 1133 … … 1144 1140 } 1145 1141 1146 static errno_t cdfs_mounted(service_id_t service_id, const char *opts,1142 static int cdfs_mounted(service_id_t service_id, const char *opts, 1147 1143 fs_index_t *index, aoff64_t *size) 1148 1144 { 1149 1145 /* Initialize the block layer */ 1150 errno_t rc = block_init(service_id, BLOCK_SIZE);1146 int rc = block_init(service_id, BLOCK_SIZE); 1151 1147 if (rc != EOK) 1152 1148 return rc; … … 1238 1234 } 1239 1235 1240 static errno_t cdfs_unmounted(service_id_t service_id)1236 static int cdfs_unmounted(service_id_t service_id) 1241 1237 { 1242 1238 cdfs_t *fs; … … 1250 1246 } 1251 1247 1252 static errno_t cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,1248 static int cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos, 1253 1249 size_t *rbytes) 1254 1250 { … … 1266 1262 1267 1263 if (!node->processed) { 1268 errno_t rc = cdfs_readdir(node->fs, FS_NODE(node));1264 int rc = cdfs_readdir(node->fs, FS_NODE(node)); 1269 1265 if (rc != EOK) 1270 1266 return rc; … … 1290 1286 1291 1287 block_t *block; 1292 errno_t rc = block_get(&block, service_id, node->lba + lba,1288 int rc = block_get(&block, service_id, node->lba + lba, 1293 1289 BLOCK_FLAGS_NONE); 1294 1290 if (rc != EOK) { … … 1321 1317 } 1322 1318 1323 static errno_t cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,1319 static int cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos, 1324 1320 size_t *wbytes, aoff64_t *nsize) 1325 1321 { … … 1332 1328 } 1333 1329 1334 static errno_t cdfs_truncate(service_id_t service_id, fs_index_t index,1330 static int cdfs_truncate(service_id_t service_id, fs_index_t index, 1335 1331 aoff64_t size) 1336 1332 { … … 1373 1369 } 1374 1370 1375 static errno_t cdfs_close(service_id_t service_id, fs_index_t index)1371 static int cdfs_close(service_id_t service_id, fs_index_t index) 1376 1372 { 1377 1373 /* Root node is always in memory */ … … 1399 1395 } 1400 1396 1401 static errno_t cdfs_destroy(service_id_t service_id, fs_index_t index)1397 static int cdfs_destroy(service_id_t service_id, fs_index_t index) 1402 1398 { 1403 1399 /* … … 1409 1405 } 1410 1406 1411 static errno_t cdfs_sync(service_id_t service_id, fs_index_t index)1407 static int cdfs_sync(service_id_t service_id, fs_index_t index) 1412 1408 { 1413 1409 /*
Note:
See TracChangeset
for help on using the changeset viewer.