diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-28 03:22:08 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-28 03:22:08 +0000 |
| commit | f54dd0917169de33faf799a6f0aaae9a1b7d3ce7 (patch) | |
| tree | 00ab50668f8970375125b4cbb906c2e0ac4229f5 /util-linux | |
| parent | 14ee4e65f196c451a9eea45a9936b4fe38533178 (diff) | |
| download | busybox-w32-f54dd0917169de33faf799a6f0aaae9a1b7d3ce7.tar.gz busybox-w32-f54dd0917169de33faf799a6f0aaae9a1b7d3ce7.tar.bz2 busybox-w32-f54dd0917169de33faf799a6f0aaae9a1b7d3ce7.zip | |
mkfs.vfat: mkdosfs compat with choosing clyster size
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/mkfs_vfat.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index 679fcf111..30996b267 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c | |||
| @@ -198,7 +198,6 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
| 198 | char *buf; | 198 | char *buf; |
| 199 | char *device_name; | 199 | char *device_name; |
| 200 | uoff_t volume_size_bytes; | 200 | uoff_t volume_size_bytes; |
| 201 | uoff_t volume_size_blocks; | ||
| 202 | uoff_t volume_size_sect; | 201 | uoff_t volume_size_sect; |
| 203 | uint32_t total_clust; | 202 | uint32_t total_clust; |
| 204 | uint32_t volume_id; | 203 | uint32_t volume_id; |
| @@ -293,7 +292,6 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
| 293 | bb_error_msg_and_die("image size is too big"); | 292 | bb_error_msg_and_die("image size is too big"); |
| 294 | volume_size_bytes *= 1024; | 293 | volume_size_bytes *= 1024; |
| 295 | } | 294 | } |
| 296 | volume_size_blocks = (volume_size_bytes >> BLOCK_SIZE_BITS); | ||
| 297 | volume_size_sect = volume_size_bytes / bytes_per_sect; | 295 | volume_size_sect = volume_size_bytes / bytes_per_sect; |
| 298 | 296 | ||
| 299 | // | 297 | // |
| @@ -325,9 +323,9 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
| 325 | * fs size <= 16G: 8k clusters | 323 | * fs size <= 16G: 8k clusters |
| 326 | * fs size > 16G: 16k clusters | 324 | * fs size > 16G: 16k clusters |
| 327 | */ | 325 | */ |
| 328 | sect_per_clust = volume_size_bytes > ((off_t)16)*1024*1024*1024 ? 32 : | 326 | sect_per_clust = volume_size_bytes >= ((off_t)16)*1024*1024*1024 ? 32 : |
| 329 | volume_size_bytes > ((off_t)8)*1024*1024*1024 ? 16 : | 327 | volume_size_bytes >= ((off_t)8)*1024*1024*1024 ? 16 : |
| 330 | volume_size_bytes > 260*1024*1024 ? 8 : 1; | 328 | volume_size_bytes >= 260*1024*1024 ? 8 : 1; |
| 331 | } else { | 329 | } else { |
| 332 | int not_floppy = ioctl(dev, FDGETPRM, ¶m); | 330 | int not_floppy = ioctl(dev, FDGETPRM, ¶m); |
| 333 | if (not_floppy == 0) { | 331 | if (not_floppy == 0) { |
| @@ -531,6 +529,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
| 531 | 529 | ||
| 532 | #if 0 | 530 | #if 0 |
| 533 | if (opts & OPT_c) { | 531 | if (opts & OPT_c) { |
| 532 | uoff_t volume_size_blocks; | ||
| 534 | unsigned start_data_sector; | 533 | unsigned start_data_sector; |
| 535 | unsigned start_data_block; | 534 | unsigned start_data_block; |
| 536 | unsigned badblocks = 0; | 535 | unsigned badblocks = 0; |
| @@ -538,6 +537,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
| 538 | off_t currently_testing; | 537 | off_t currently_testing; |
| 539 | char *blkbuf = xmalloc(BLOCK_SIZE * TEST_BUFFER_BLOCKS); | 538 | char *blkbuf = xmalloc(BLOCK_SIZE * TEST_BUFFER_BLOCKS); |
| 540 | 539 | ||
| 540 | volume_size_blocks = (volume_size_bytes >> BLOCK_SIZE_BITS); | ||
| 541 | // N.B. the two following vars are in hard sectors, i.e. SECTOR_SIZE byte sectors! | 541 | // N.B. the two following vars are in hard sectors, i.e. SECTOR_SIZE byte sectors! |
| 542 | start_data_sector = (reserved_sect + NUM_FATS * sect_per_fat) * (bytes_per_sect / SECTOR_SIZE); | 542 | start_data_sector = (reserved_sect + NUM_FATS * sect_per_fat) * (bytes_per_sect / SECTOR_SIZE); |
| 543 | start_data_block = (start_data_sector + SECTORS_PER_BLOCK - 1) / SECTORS_PER_BLOCK; | 543 | start_data_block = (start_data_sector + SECTORS_PER_BLOCK - 1) / SECTORS_PER_BLOCK; |
