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