Changeset 99f043e in mainline
- Timestamp:
- 2011-07-28T19:53:21Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bb8cd79
- Parents:
- e91b898
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkminix/mkminix.c
re91b898 r99f043e 446 446 { 447 447 aoff64_t inodes; 448 unsigned long ind; 449 unsigned long ind2; 450 unsigned long zones; 448 451 int rc; 449 452 … … 457 460 sb->n_zones = sb->dev_nblocks > UINT16_MAX ? 458 461 UINT16_MAX : sb->dev_nblocks; 462 ind = MFS_BLOCKSIZE / sizeof(uint16_t); 463 ind2 = ind * ind; 464 sb->max_file_size = (V1_NR_DIRECT_ZONES + ind + ind2) * MFS_BLOCKSIZE; 459 465 } else { 460 466 /*Valid for MFS V2/V3*/ 467 size_t ptrsize; 468 if (sb->fs_version == 2) 469 ptrsize = sizeof(uint16_t); 470 else 471 ptrsize = sizeof(uint32_t); 472 ind = sb->block_size / ptrsize; 473 ind2 = ind * ind; 474 zones = V2_NR_DIRECT_ZONES + ind + ind2; 475 sb->max_file_size = zones * sb->block_size; 461 476 sb->n_zones = sb->dev_nblocks > UINT32_MAX ? 462 477 UINT32_MAX : sb->dev_nblocks; 463 478 464 479 if (sb->fs_version == 3) { 480 if(INT32_MAX / sb->block_size < zones) 481 sb->max_file_size = INT32_MAX; 465 482 sb->ino_per_block = V3_INODES_PER_BLOCK(sb->block_size); 466 483 sb->n_zones /= (sb->block_size / MFS_MIN_BLOCKSIZE); … … 512 529 printf(NAME ": zone bitmap blocks = %ld\n", sb->zbmap_blocks); 513 530 printf(NAME ": first data zone = %d\n", (uint32_t) sb->first_data_zone); 531 printf(NAME ": max file size = %u\n", sb->max_file_size); 514 532 printf(NAME ": long fnames = %s\n", sb->longnames ? "Yes" : "No"); 515 533 … … 545 563 sb->s_first_data_zone = (uint16_t) sbi->first_data_zone; 546 564 sb->s_log2_zone_size = sbi->log2_zone_size; 547 sb->s_max_file_size = UINT32_MAX;565 sb->s_max_file_size = sbi->max_file_size; 548 566 sb->s_magic = sbi->magic; 549 567 sb->s_state = MFS_VALID_FS; … … 577 595 sb->s_first_data_zone = (uint16_t) sbi->first_data_zone; 578 596 sb->s_log2_zone_size = sbi->log2_zone_size; 579 sb->s_max_file_size = UINT32_MAX;597 sb->s_max_file_size = sbi->max_file_size; 580 598 sb->s_magic = sbi->magic; 581 599 sb->s_block_size = sbi->block_size;
Note:
See TracChangeset
for help on using the changeset viewer.