aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_vfat.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-01 23:48:27 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-01 23:48:27 +0100
commit40e7d25aca1abbe080e00e2bed64b444a5ec7858 (patch)
tree05cda08f66542aeb94d1ebb906a0f04b04a41d62 /util-linux/mkfs_vfat.c
parent4875e7148b0512ee3c255526a484503da984935a (diff)
downloadbusybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.gz
busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.bz2
busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.zip
mkXXXX: unify [KBYTES] parameter handling (added it to mkswap)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkfs_vfat.c')
-rw-r--r--util-linux/mkfs_vfat.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index a9a65aa07..1363612f2 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -244,7 +244,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
244 // default volume ID = creation time 244 // default volume ID = creation time
245 volume_id = time(NULL); 245 volume_id = time(NULL);
246 246
247 dev = xopen(device_name, O_EXCL | O_RDWR); 247 dev = xopen(device_name, O_RDWR);
248 if (fstat(dev, &st) < 0) 248 if (fstat(dev, &st) < 0)
249 bb_simple_perror_msg_and_die(device_name); 249 bb_simple_perror_msg_and_die(device_name);
250 250
@@ -252,7 +252,6 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
252 // Get image size and sector size 252 // Get image size and sector size
253 // 253 //
254 bytes_per_sect = SECTOR_SIZE; 254 bytes_per_sect = SECTOR_SIZE;
255 volume_size_bytes = st.st_size;
256 if (!S_ISBLK(st.st_mode)) { 255 if (!S_ISBLK(st.st_mode)) {
257 if (!S_ISREG(st.st_mode)) { 256 if (!S_ISREG(st.st_mode)) {
258 if (!argv[1]) 257 if (!argv[1])
@@ -262,10 +261,6 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
262 opts &= ~OPT_c; 261 opts &= ~OPT_c;
263 } else { 262 } else {
264 int min_bytes_per_sect; 263 int min_bytes_per_sect;
265
266 // more portable than BLKGETSIZE[64]
267 volume_size_bytes = xlseek(dev, 0, SEEK_END);
268 xlseek(dev, 0, SEEK_SET);
269#if 0 264#if 0
270 unsigned device_num; 265 unsigned device_num;
271 // for true block devices we do check sanity 266 // for true block devices we do check sanity
@@ -290,12 +285,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
290 bb_error_msg("for this device sector size is %u", min_bytes_per_sect); 285 bb_error_msg("for this device sector size is %u", min_bytes_per_sect);
291 } 286 }
292 } 287 }
293 if (argv[1]) { 288 volume_size_bytes = get_volume_size_in_bytes(dev, argv[1], 1024, /*extend:*/ 1);
294 volume_size_bytes = XATOOFF(argv[1]);
295 if (volume_size_bytes >= MAXINT(off_t) / 1024)
296 bb_error_msg_and_die("image size is too big");
297 volume_size_bytes *= 1024;
298 }
299 volume_size_sect = volume_size_bytes / bytes_per_sect; 289 volume_size_sect = volume_size_bytes / bytes_per_sect;
300 290
301 // 291 //