Changeset 395df52 in mainline for uspace/srv/fs/cdfs/cdfs_ops.c
- Timestamp:
- 2017-05-12T19:58:27Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e48947e
- Parents:
- de5b708
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/cdfs/cdfs_ops.c
rde5b708 r395df52 906 906 } 907 907 908 static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn, 909 cdfs_lba_t altroot) 908 /** Read the volume descriptors. */ 909 static bool iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot, 910 uint32_t *rlba, uint32_t *rsize, cdfs_enc_t *enc) 910 911 { 911 912 /* First 16 blocks of isofs are empty */ 912 913 block_t *block; 913 int rc = block_get(&block, fs->service_id, altroot + 16, BLOCK_FLAGS_NONE);914 int rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE); 914 915 if (rc != EOK) 915 916 return false; … … 956 957 // TODO: implement path table support 957 958 958 cdfs_node_t *node = CDFS_NODE(rfn);959 960 959 /* Search for Joliet SVD */ 961 960 … … 963 962 uint32_t jrsize; 964 963 965 rc = cdfs_find_joliet_svd( fs->service_id, altroot, &jrlba, &jrsize);964 rc = cdfs_find_joliet_svd(sid, altroot, &jrlba, &jrsize); 966 965 if (rc == EOK) { 967 966 /* Found */ 968 node->lba = jrlba;969 node->size = jrsize;970 fs->enc = enc_ucs2;967 *rlba = jrlba; 968 *rsize = jrsize; 969 *enc = enc_ucs2; 971 970 } else { 972 node->lba = uint32_lb(vol_desc->data.prisec.root_dir.lba); 973 node->size = uint32_lb(vol_desc->data.prisec.root_dir.size); 974 fs->enc = enc_ascii; 975 } 976 977 if (!cdfs_readdir(fs, rfn)) { 978 block_put(block); 979 return false; 971 *rlba = uint32_lb(vol_desc->data.prisec.root_dir.lba); 972 *rsize = uint32_lb(vol_desc->data.prisec.root_dir.size); 973 *enc = enc_ascii; 980 974 } 981 975 982 976 block_put(block); 983 977 return true; 978 } 979 980 static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn, 981 cdfs_lba_t altroot) 982 { 983 int rc; 984 985 cdfs_node_t *node = CDFS_NODE(rfn); 986 987 rc = iso_read_vol_desc(fs->service_id, altroot, &node->lba, 988 &node->size, &fs->enc); 989 if (rc != EOK) 990 return false; 991 992 return cdfs_readdir(fs, rfn); 984 993 } 985 994 … … 1023 1032 static int cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 1024 1033 { 1025 return ENOTSUP; 1034 /* Initialize the block layer */ 1035 int rc = block_init(service_id, BLOCK_SIZE); 1036 if (rc != EOK) 1037 return rc; 1038 1039 cdfs_lba_t altroot = 0; 1040 1041 /* 1042 * Read TOC multisession information and get the start address 1043 * of the first track in the last session 1044 */ 1045 scsi_toc_multisess_data_t toc; 1046 1047 rc = block_read_toc(service_id, 1, &toc, sizeof(toc)); 1048 if (rc == EOK && (uint16_t_be2host(toc.toc_len) == 10)) 1049 altroot = uint32_t_be2host(toc.ftrack_lsess.start_addr); 1050 1051 /* Initialize the block cache */ 1052 rc = block_cache_init(service_id, BLOCK_SIZE, 0, CACHE_MODE_WT); 1053 if (rc != EOK) { 1054 block_fini(service_id); 1055 return rc; 1056 } 1057 1058 /* Check if this device is not already mounted */ 1059 fs_node_t *rootfn; 1060 rc = cdfs_root_get(&rootfn, service_id); 1061 if ((rc == EOK) && (rootfn)) { 1062 cdfs_node_put(rootfn); 1063 block_cache_fini(service_id); 1064 block_fini(service_id); 1065 return EOK; 1066 } 1067 1068 /* Read volume descriptors */ 1069 uint32_t rlba; 1070 uint32_t rsize; 1071 cdfs_enc_t enc; 1072 if (!iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc)) { 1073 block_cache_fini(service_id); 1074 block_fini(service_id); 1075 return EIO; 1076 } 1077 1078 return EOK; 1026 1079 } 1027 1080
Note:
See TracChangeset
for help on using the changeset viewer.