lib: [blkdev.c] remove kernel version check from blkdev_get_sector_size()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
6678c06f5d
commit
c2e05a498c
|
@ -659,8 +659,7 @@ int main(int argc, char ** argv) {
|
|||
int sectorsize;
|
||||
|
||||
if (blkdev_get_sector_size(DEV, §orsize) == -1)
|
||||
errx(MKFS_ERROR, _("cannot determine sector size for %s"),
|
||||
device_name);
|
||||
sectorsize = DEFAULT_SECTOR_SIZE; /* kernel < 2.3.3 */
|
||||
if (BLOCK_SIZE < sectorsize)
|
||||
errx(MKFS_ERROR, _("block size smaller than physical "
|
||||
"sector size of %s"), device_name);
|
||||
|
|
13
lib/blkdev.c
13
lib/blkdev.c
|
@ -179,24 +179,17 @@ blkdev_get_sectors(int fd, unsigned long long *sectors)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* get logical sector size (default is 512)
|
||||
/*
|
||||
* Get logical sector size.
|
||||
*
|
||||
* This is the smallest unit the storage device can
|
||||
* address. It is typically 512 bytes.
|
||||
*/
|
||||
int
|
||||
blkdev_get_sector_size(int fd, int *sector_size)
|
||||
int blkdev_get_sector_size(int fd, int *sector_size)
|
||||
{
|
||||
#ifdef BLKSSZGET
|
||||
#ifdef __linux__
|
||||
if (get_linux_version() < KERNEL_VERSION(2,3,3)) {
|
||||
*sector_size = DEFAULT_SECTOR_SIZE;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (ioctl(fd, BLKSSZGET, sector_size) >= 0)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
#else
|
||||
*sector_size = DEFAULT_SECTOR_SIZE;
|
||||
|
|
Loading…
Reference in New Issue