Skip to contentSkip to conversation

mkfs: Make HDIO_GETGEO ioctl optional

PATCH Applied Ezequiel Garcia 2 participants 2 messages Dec 12, 2012 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs: Make HDIO_GETGEO ioctl optional

From: Ezequiel Garcia <[email protected]>

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.

---
 mkfs/f2fs_format.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
mkfs/f2fs_format.c +4 -5
index d3e1d0c..b542db5 100644
@@ -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");
Signature · 1 line
1.7.8.6
Applied
#1 lore raw

2012-12-11 (화), 23:08 -0300, Ezequiel Garcia:

Quoted 22 lines

From: Ezequiel Garcia <[email protected]>

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.

---
 mkfs/f2fs_format.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
mkfs/f2fs_format.c +0 -2
index d3e1d0c..b542db5 100644
@@ -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");

mkfs/f2fs_format.c static int8_t f2fs_get_device_info() · line 271

Quoted 10 lines
mkfs/f2fs_format.c +4 -3
-			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");

Merged, thanks. :)

Signature · 2 lines
Jaegeuk Kim
Samsung