Changeset ac31040 in mainline for uspace/srv/fs/udf/udf_file.c
- Timestamp:
- 2012-09-04T19:48:22Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 78ca12b
- Parents:
- 85f7369 (diff), 8ec4144 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/udf/udf_file.c
r85f7369 rac31040 57 57 * 58 58 */ 59 int udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag,59 static int udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag, 60 60 uint32_t pos) 61 61 { … … 185 185 */ 186 186 if (FLE32(long_d->length) >> 30 == 3) { 187 udf_read_extended_allocator 187 udf_read_extended_allocator(node, icb_flag, pos_long_ad); 188 188 break; 189 189 } … … 296 296 } 297 297 298 /** Read ICB sequence of allocators in Unallocated space entry descriptor299 *300 * This function read ICB sequence if free space is saved by space table.301 * Not finished.302 *303 * @param uased Unallocated space entry descriptor304 * @param icb_flag Type of allocators in sequence.305 * According to ECMA 167 4/14.8.8306 * @param start_alloc Offset of the allocator307 * @param len Length of sequence308 *309 * @return EOK on success or a negative error code.310 *311 */312 int udf_read_free_space(uint8_t *uased, uint16_t icb_flag,313 uint32_t start_alloc, uint32_t len)314 {315 switch (icb_flag) {316 case UDF_SHORT_AD:317 log_msg(LVL_DEBUG,318 "UAICB: sequence of allocation descriptors - icbflag = short_ad_t");319 320 /* Identify number of current partition */321 322 size_t cnt = len / sizeof(udf_short_ad_t);323 size_t n = 0;324 325 while (n < cnt) {326 udf_short_ad_t *short_d =327 (udf_short_ad_t *) (uased + start_alloc + n * sizeof(udf_short_ad_t));328 329 if (short_d->length == 0)330 break;331 332 n++;333 }334 335 break;336 337 case UDF_LONG_AD:338 log_msg(LVL_DEBUG,339 "UAICB: sequence of allocation descriptors - icbflag = long_ad_t");340 341 cnt = len / sizeof(udf_long_ad_t);342 n = 0;343 344 while (n < cnt) {345 udf_long_ad_t *long_d =346 (udf_long_ad_t *) (uased + start_alloc + n * sizeof(udf_long_ad_t));347 348 if (long_d->length == 0)349 break;350 351 n++;352 }353 354 break;355 356 case UDF_EXTENDED_AD:357 log_msg(LVL_DEBUG,358 "UAICB: sequence of allocation descriptors - icbflag = extended_ad_t");359 break;360 361 case UDF_DATA_AD:362 log_msg(LVL_DEBUG,363 "UAICB: sequence of allocation descriptors - icbflag = 3, node contains data itself");364 break;365 }366 367 return EOK;368 }369 370 /** Read Unallocated space entry descriptor371 *372 * Read ICB sequence if free space is saved by space table.373 * Not finished.374 *375 */376 int udf_read_unallocated_space_entry(udf_instance_t * instance, uint64_t pos,377 uint32_t len)378 {379 block_t *block = NULL;380 int rc = block_get(&block, instance->service_id, pos, BLOCK_FLAGS_NONE);381 if (rc != EOK)382 return rc;383 384 udf_descriptor_tag_t *desc = (udf_descriptor_tag_t *) block->data;385 if (desc->checksum != udf_tag_checksum((uint8_t *) desc)) {386 block_put(block);387 return EINVAL;388 }389 390 if (FLE16(desc->id) != UDF_UASPACE_ENTRY) {391 // FIXME: Memory leak392 return EINVAL;393 }394 395 udf_unallocated_space_entry_descriptor_t *uased =396 (udf_unallocated_space_entry_descriptor_t *) block->data;397 if (uased->icbtag.file_type != UDF_ICBTYPE_UASE) {398 // FIXME: Memory leak399 return EINVAL;400 }401 402 uint16_t icb_flag = uased->icbtag.flags & UDF_ICBFLAG_MASK;403 404 rc = udf_read_free_space((uint8_t *) uased, icb_flag,405 UDF_UASE_OFFSET, uased->ad_lenght);406 407 return block_put(block);408 }409 410 298 /** Read data from disk - filling UDF node by allocators 411 299 * … … 419 307 node->link_cnt = 1; 420 308 return udf_read_icb(node); 421 }422 423 /** Read directory entry424 *425 * @param fid Returned value426 * @param block Returned value427 * @param node UDF node428 * @param pos Number of FID which we need to find429 *430 * @return EOK on success or a negative error code.431 *432 */433 int udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block,434 udf_node_t *node, aoff64_t pos)435 {436 if (node->data == NULL)437 return udf_get_fid_in_allocator(fid, block, node, pos);438 439 return udf_get_fid_in_data(fid, node, pos);440 309 } 441 310 … … 449 318 * 450 319 */ 451 int udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid,320 static int udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid, 452 321 udf_node_t *node, aoff64_t pos) 453 322 { … … 488 357 489 358 return ENOENT; 359 } 360 361 /** Read directory entry 362 * 363 * @param fid Returned value 364 * @param block Returned value 365 * @param node UDF node 366 * @param pos Number of FID which we need to find 367 * 368 * @return EOK on success or a negative error code. 369 * 370 */ 371 int udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block, 372 udf_node_t *node, aoff64_t pos) 373 { 374 if (node->data == NULL) 375 return udf_get_fid_in_allocator(fid, block, node, pos); 376 377 return udf_get_fid_in_data(fid, node, pos); 490 378 } 491 379
Note:
See TracChangeset
for help on using the changeset viewer.