svn commit: [25846] trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Sat Mar 28 03:22:08 UTC 2009


Author: vda
Date: 2009-03-28 03:22:08 +0000 (Sat, 28 Mar 2009)
New Revision: 25846

Log:
mkfs.vfat: mkdosfs compat with choosing clyster size



Modified:
   trunk/busybox/util-linux/mkfs_vfat.c


Changeset:
Modified: trunk/busybox/util-linux/mkfs_vfat.c
===================================================================
--- trunk/busybox/util-linux/mkfs_vfat.c	2009-03-28 02:28:58 UTC (rev 25845)
+++ trunk/busybox/util-linux/mkfs_vfat.c	2009-03-28 03:22:08 UTC (rev 25846)
@@ -198,7 +198,6 @@
 	char *buf;
 	char *device_name;
 	uoff_t volume_size_bytes;
-	uoff_t volume_size_blocks;
 	uoff_t volume_size_sect;
 	uint32_t total_clust;
 	uint32_t volume_id;
@@ -293,7 +292,6 @@
 			bb_error_msg_and_die("image size is too big");
 		volume_size_bytes *= 1024;
 	}
-	volume_size_blocks = (volume_size_bytes >> BLOCK_SIZE_BITS);
 	volume_size_sect = volume_size_bytes / bytes_per_sect;
 
 	//
@@ -325,9 +323,9 @@
 			 * fs size <=  16G: 8k clusters
 			 * fs size >   16G: 16k clusters
 			 */
-			sect_per_clust = volume_size_bytes > ((off_t)16)*1024*1024*1024 ? 32 :
-					volume_size_bytes > ((off_t)8)*1024*1024*1024 ? 16 :
-					volume_size_bytes >        260*1024*1024 ? 8 : 1;
+			sect_per_clust = volume_size_bytes >= ((off_t)16)*1024*1024*1024 ? 32 :
+					volume_size_bytes >= ((off_t)8)*1024*1024*1024 ? 16 :
+					volume_size_bytes >=        260*1024*1024 ? 8 : 1;
 		} else {
 			int not_floppy = ioctl(dev, FDGETPRM, &param);
 			if (not_floppy == 0) {
@@ -531,6 +529,7 @@
 
 #if 0
 	if (opts & OPT_c) {
+		uoff_t volume_size_blocks;
 		unsigned start_data_sector;
 		unsigned start_data_block;
 		unsigned badblocks = 0;
@@ -538,6 +537,7 @@
 		off_t currently_testing;
 		char *blkbuf = xmalloc(BLOCK_SIZE * TEST_BUFFER_BLOCKS);
 
+		volume_size_blocks = (volume_size_bytes >> BLOCK_SIZE_BITS);
 		// N.B. the two following vars are in hard sectors, i.e. SECTOR_SIZE byte sectors!
 		start_data_sector = (reserved_sect + NUM_FATS * sect_per_fat) * (bytes_per_sect / SECTOR_SIZE);
 		start_data_block = (start_data_sector + SECTORS_PER_BLOCK - 1) / SECTORS_PER_BLOCK;



More information about the busybox-cvs mailing list