Changeset b200230 in mainline
- Timestamp:
- 2012-02-24T23:11:27Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba55c194
- Parents:
- 3467821
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkexfat/mkexfat.c
r3467821 rb200230 400 400 assert(ncls > 0); 401 401 402 if (ncls == 1) {403 fat[cur_cls] = host2uint32_t_le(0xFFFFFFFF);404 rc = block_write_direct(service_id, fat_sec, 1, fat);405 goto exit;406 }407 408 402 for (; cur_cls < fat_entries && ncls > 1; ++cur_cls, --ncls) 409 403 fat[cur_cls] = host2uint32_t_le(cur_cls + 1); 410 404 411 405 if (cur_cls == fat_entries) { 406 /* This sector is full, there are no more free entries, 407 * read the next sector and restart the search. 408 */ 412 409 rc = block_write_direct(service_id, fat_sec++, 1, fat); 413 410 if (rc != EOK) … … 415 412 cur_cls = 0; 416 413 goto loop; 417 } else if (ncls == 1) 414 } else if (ncls == 1) { 415 /* This is the last cluster of this chain, mark it 416 * with EOK. 417 */ 418 418 fat[cur_cls] = host2uint32_t_le(0xFFFFFFFF); 419 } 419 420 420 421 rc = block_write_direct(service_id, fat_sec, 1, fat); … … 492 493 return ENOENT; 493 494 495 /* Compute the start sector of the upcase table */ 494 496 start_sec = cfg->data_start_sector; 495 497 start_sec += ((cfg->upcase_table_cluster - 2) * cfg->cluster_size) / 496 498 cfg->sector_size; 497 499 500 /* Compute the number of sectors needed to store the table on disk */ 498 501 nsecs = div_round_up(sizeof(upcase_table), cfg->sector_size); 499 502 table_ptr = (uint8_t *) upcase_table; … … 503 506 table_size -= cfg->sector_size) { 504 507 505 if (table_size < cfg->sector_size) 508 if (table_size < cfg->sector_size) { 509 /* Reset the content of the unused part 510 * of the last sector. 511 */ 506 512 memset(buf, 0, cfg->sector_size); 513 } 507 514 memcpy(buf, table_ptr, min(table_size, cfg->sector_size)); 508 515 … … 621 628 cfg_print_info(&cfg); 622 629 630 /* Initialize the FAT table */ 623 631 rc = fat_initialize(service_id, &cfg); 624 632 if (rc != EOK) { … … 657 665 } 658 666 667 /* Write the allocation bitmap to disk */ 659 668 rc = bitmap_write(service_id, &cfg); 660 669 if (rc != EOK) { … … 664 673 } 665 674 675 /* Write the upcase table to disk */ 666 676 rc = upcase_table_write(service_id, &cfg); 667 677 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.