summaryrefslogtreecommitdiff
path: root/mkfs_msdos.c
AgeCommit message (Collapse)Author
2021-02-15Fix expected BLKGETSIZE64 ioctl result type to 64 bitAlessio Balsini
The BLKGETSIZE64 ioctl writes 64 bit to the destination address. In the current implementation the destination pointer is set as u_long, that is only fine for 64 bit architectures. In 32 bit architectures u_long is a 32 bit unsigned and might cause the kernel to overwrite neighbor elements in the stack, leading to unexpected results. Fix by forcing the destination variable type to 64 bit. Bug: 180318855 Test: formatted SD card Change-Id: Ie13a5bae0db61356554340f45ee0bd89d71862fa Signed-off-by: Alessio Balsini <balsini@google.com>
2021-01-26Don't use BLKBSZSET on Linux.Elliott Hughes
This was a workaround for the previous lack of buffering when newfs_msdos would write in 512 byte sectors even if the underlying block device was doing 1024 bytes. Now we have a 1MiB buffer, overriding the sector size shouldn't make a difference. This brings us closer in line with upstream, which never had this change. Test: treehugger Change-Id: I51f9a46b1d9418820b938541adb7e8bc22ac46b5
2021-01-20Update to upstream 6424881cc82a65a833fc6fb79730474caedf6222.Elliott Hughes
Test: treehugger Change-Id: Ib11457ec6d166e774c9a053e23db4131c0030321
2021-01-20Fixes the partition size for FAT.Ed Tsai
BLKGETSIZE is in units of 512 bytes rather than bytes or the sector size returned by BLKSSZGET. Use BLKGETSIZE64 instead, to get the block size in bytes. Also rename block_size to make it clearer that it's actually the size of the whole block device. Change-Id: I9eb6cd4394722f8624c6ac6368b6da31583f026e Test: Create an new filesystem by newfs_msdos
2020-04-08set bdev->bd_block_size to reduce formatting timehyeongseok.kim
When bdev->bd_block_size is bigger than bytesPerSec, e.g. 1024 bytes, block write should read first to sync-up the mapped block. This fix could prevent unnecessary read by temporarily change bd_block_size to bytesPerSec size while flushing fat data. bd_block_size would be reconfigured again at open() or mount() time. Test: newfs_msdos -A /dev/<foo> (/dev/block/sdh1) [2TB disk / 32kb cluster] : FAT#1/#2 476879KiB/512 bytes to write, before : 476864 read I/Os (each 1024 bytes) : takes 180 seconds after : 0 read I/Os : takes 20 seconds Bug: 152893650 Change-Id: Idaa8d73e056cf740647345457ef9061c429f35a7 Signed-off-by: hyeongseok.kim <hyeongseok@gmail.com>
2018-06-20Remove failing HDIO_GETGEO ioctl.android-p-preview-5android-p-preview-4Elliott Hughes
This was copied across from the toolbox code, but it's outlived its usefulness: the ioctl is failing all the time now because we're acting on a partition rather than the underlying block device. Bug: http://b/29899852 Test: adb shell sm set-virtual-disk true Change-Id: I7f77e342e226b40ded1155f3e320b2604b4c0404
2018-06-20Build external/newfs_msdos.Elliott Hughes
Bug: http://b/29899852 Test: builds Change-Id: I3013d10d7a225ca474ce03026a5b38c6ab33fcab
2018-06-19Integrate FreeBSD r335189 for -A option.Xin Li
Bug: 110053628 Change-Id: Ic59054c7e13849b392971746cdaa901f11552fca
2018-06-13Initial commit for platform/external/newfs_msdos.Elliott Hughes
Bug: http://b/110053628 Test: N/A Change-Id: I4432b7d20fc4bac0ed331797023543db02bfcd19