linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] mke2fs: fix up topo complaints on regular files
Date: Sat, 23 Jan 2010 21:50:45 -0600	[thread overview]
Message-ID: <4B5BC395.2050805@redhat.com> (raw)

mkfsing a plain file would lead to a warning about being unable
to determine geometry; we should just skip the topology-getting
if we see that we have a regular file.

This was breaking "make check" but I had missed it since I
inadvertently stopped running the checks during the Fedora
RPM build.

Also, add a newline to the warning.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 94b4c81..81b34ab 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -47,6 +47,7 @@ extern int optind;
 #endif
 #include <sys/ioctl.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <libgen.h>
 #include <limits.h>
 #include <blkid/blkid.h>
@@ -1035,6 +1036,11 @@ static int ext2fs_get_device_geometry(const char *file,
 	blkid_topology tp;
 	unsigned long min_io;
 	unsigned long opt_io;
+	struct stat statbuf;
+
+	/* Nothing to do for a regular file */
+	if (!stat(file, &statbuf) && S_ISREG(statbuf.st_mode))
+		return 0;
 
 	pr = blkid_new_probe_from_filename(file);
 	if (!pr)
@@ -1630,7 +1636,7 @@ got_size:
 	retval = ext2fs_get_device_geometry(device_name, &fs_param);
 	if (retval < 0) {
 		fprintf(stderr,
-			_("warning: Unable to get device geometry for %s"),
+			_("warning: Unable to get device geometry for %s\n"),
 			device_name);
 	} else if (retval) {
 		printf(_("%s alignment is offset by %lu bytes.\n"),


             reply	other threads:[~2010-01-24  3:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-24  3:50 Eric Sandeen [this message]
2010-02-06 13:01 ` [PATCH] mke2fs: fix up topo complaints on regular files tytso

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=4B5BC395.2050805@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@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).