[PATCH] [f2fs-tools] mkfs: Make HDIO_GETGEO ioctl optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxx>

Some block devices don't implement HDIO_GETGEP ioctl;
loop device being a notable example.
Without this patch, it's not possible to make a f2fs
on a file mounted over a loop device.

Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxx>
---
 mkfs/f2fs_format.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index d3e1d0c..b542db5 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -262,11 +262,10 @@ static int8_t f2fs_get_device_info()
 			return -1;
 		}
 
-		if (ioctl(fd, HDIO_GETGEO, &geom) < 0) {
-			printf("\n\tError: Cannot get the device geometry\n");
-			return -1;
-		}
-		f2fs_params.start_sector = geom.start;
+		if (ioctl(fd, HDIO_GETGEO, &geom) < 0)
+			f2fs_params.start_sector = 0;
+		else
+			f2fs_params.start_sector = geom.start;
 	}
 	else {
 		printf("\n\n\tError: Volume type is not supported!!!\n");
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux