diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-28 02:28:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-28 02:28:58 +0000 |
commit | 14ee4e65f196c451a9eea45a9936b4fe38533178 (patch) | |
tree | ee2d829e8c1fa0bd1ae0e25bd8e0f66045fa3239 /util-linux/mkfs_vfat.c | |
parent | 020f465cbd997a368f4bb0f82e6025433d2a808a (diff) | |
download | busybox-w32-14ee4e65f196c451a9eea45a9936b4fe38533178.tar.gz busybox-w32-14ee4e65f196c451a9eea45a9936b4fe38533178.tar.bz2 busybox-w32-14ee4e65f196c451a9eea45a9936b4fe38533178.zip |
mkfs.vfat: more of pointless tweaking
Diffstat (limited to 'util-linux/mkfs_vfat.c')
-rw-r--r-- | util-linux/mkfs_vfat.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index 95ebcbfba..679fcf111 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c | |||
@@ -163,8 +163,7 @@ static const char boot_code[] ALIGN1 = | |||
163 | "This is not a bootable disk\r\n"; | 163 | "This is not a bootable disk\r\n"; |
164 | 164 | ||
165 | 165 | ||
166 | // mark specified cluster as having a particular value | 166 | #define MARK_CLUSTER(cluster, value) \ |
167 | #define mark_cluster(cluster, value) \ | ||
168 | ((uint32_t *)fat)[cluster] = cpu_to_le32(value) | 167 | ((uint32_t *)fat)[cluster] = cpu_to_le32(value) |
169 | 168 | ||
170 | void BUG_unsupported_field_size(void); | 169 | void BUG_unsupported_field_size(void); |
@@ -437,7 +436,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
437 | buf = xzalloc(bufsize * bytes_per_sect); | 436 | buf = xzalloc(bufsize * bytes_per_sect); |
438 | } | 437 | } |
439 | 438 | ||
440 | { // boot, fsinfo sectors and their copies | 439 | { // boot and fsinfo sectors, and their copies |
441 | struct msdos_boot_sector *boot_blk = (void*)buf; | 440 | struct msdos_boot_sector *boot_blk = (void*)buf; |
442 | struct fat32_fsinfo *info = (void*)(buf + bytes_per_sect); | 441 | struct fat32_fsinfo *info = (void*)(buf + bytes_per_sect); |
443 | 442 | ||
@@ -492,10 +491,10 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
492 | 491 | ||
493 | memset(buf, 0, bytes_per_sect * 2); | 492 | memset(buf, 0, bytes_per_sect * 2); |
494 | // initial FAT entries | 493 | // initial FAT entries |
495 | mark_cluster(0, 0x0fffff00 | media_byte); | 494 | MARK_CLUSTER(0, 0x0fffff00 | media_byte); |
496 | mark_cluster(1, 0xffffffff); | 495 | MARK_CLUSTER(1, 0xffffffff); |
497 | // mark cluster 2 as EOF (used for root dir) | 496 | // mark cluster 2 as EOF (used for root dir) |
498 | mark_cluster(2, EOF_FAT32); | 497 | MARK_CLUSTER(2, EOF_FAT32); |
499 | for (i = 0; i < NUM_FATS; i++) { | 498 | for (i = 0; i < NUM_FATS; i++) { |
500 | xwrite(dev, buf, bytes_per_sect); | 499 | xwrite(dev, buf, bytes_per_sect); |
501 | for (j = 1; j < sect_per_fat; j++) | 500 | for (j = 1; j < sect_per_fat; j++) |
@@ -574,7 +573,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
574 | int cluster = (currently_testing * SECTORS_PER_BLOCK + i - start_data_sector) / (int) (sect_per_clust) / (bytes_per_sect / SECTOR_SIZE); | 573 | int cluster = (currently_testing * SECTORS_PER_BLOCK + i - start_data_sector) / (int) (sect_per_clust) / (bytes_per_sect / SECTOR_SIZE); |
575 | if (cluster < 0) | 574 | if (cluster < 0) |
576 | bb_error_msg_and_die("Invalid cluster number in mark_sector: probably bug!"); | 575 | bb_error_msg_and_die("Invalid cluster number in mark_sector: probably bug!"); |
577 | mark_cluster(cluster, BAD_FAT32); | 576 | MARK_CLUSTER(cluster, BAD_FAT32); |
578 | } | 577 | } |
579 | badblocks++; | 578 | badblocks++; |
580 | currently_testing++; | 579 | currently_testing++; |