linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <elezegarcia@gmail.com>
To: <linux-fsdevel@vger.kernel.org>
Cc: jaegeuk.kim@samsung.com, Ezequiel Garcia <elezegarcia@gmail.com>,
	Ezequiel Garcia <ezequiel@free-electrons.com>
Subject: [PATCH] [f2fs-tools] mkfs: Make HDIO_GETGEO ioctl optional
Date: Tue, 11 Dec 2012 23:08:35 -0300	[thread overview]
Message-ID: <1355278115-12537-1-git-send-email-elezegarcia@gmail.com> (raw)

From: Ezequiel Garcia <ezequiel@free-electrons.com>

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@free-electrons.com>
---
 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


             reply	other threads:[~2012-12-12  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  2:08 Ezequiel Garcia [this message]
2012-12-12  2:19 ` [PATCH] [f2fs-tools] mkfs: Make HDIO_GETGEO ioctl optional Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355278115-12537-1-git-send-email-elezegarcia@gmail.com \
    --to=elezegarcia@gmail.com \
    --cc=ezequiel@free-electrons.com \
    --cc=jaegeuk.kim@samsung.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).