Changes in uspace/srv/fs/cdfs/cdfs_ops.c [395df52:d2c8533] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/cdfs/cdfs_ops.c
r395df52 rd2c8533 906 906 } 907 907 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) 908 static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn, 909 cdfs_lba_t altroot) 911 910 { 912 911 /* First 16 blocks of isofs are empty */ 913 912 block_t *block; 914 int rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);913 int rc = block_get(&block, fs->service_id, altroot + 16, BLOCK_FLAGS_NONE); 915 914 if (rc != EOK) 916 915 return false; … … 957 956 // TODO: implement path table support 958 957 958 cdfs_node_t *node = CDFS_NODE(rfn); 959 959 960 /* Search for Joliet SVD */ 960 961 … … 962 963 uint32_t jrsize; 963 964 964 rc = cdfs_find_joliet_svd( sid, altroot, &jrlba, &jrsize);965 rc = cdfs_find_joliet_svd(fs->service_id, altroot, &jrlba, &jrsize); 965 966 if (rc == EOK) { 966 967 /* Found */ 967 *rlba = jrlba;968 *rsize = jrsize;969 *enc = enc_ucs2;968 node->lba = jrlba; 969 node->size = jrsize; 970 fs->enc = enc_ucs2; 970 971 } else { 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; 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; 974 980 } 975 981 976 982 block_put(block); 977 983 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);993 984 } 994 985 … … 1032 1023 static int cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 1033 1024 { 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; 1025 return ENOTSUP; 1079 1026 } 1080 1027
Note:
See TracChangeset
for help on using the changeset viewer.