From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] xfs_io: deprecate the "-F" foreign flag
Date: Thu, 02 Feb 2012 11:35:04 -0600 [thread overview]
Message-ID: <4F2AC948.1050909@redhat.com> (raw)
There's no real reason to force the user to specify "-F" for non-xfs
files, when we can just test for that after it's opened.
* Remove the -F flag from usage() & man pages, but still accept it.
* Set IO_FOREIGN when we open the file, if the fd tests as non-xfs.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/io/init.c b/io/init.c
index a166ad1..f416acf 100644
--- a/io/init.c
+++ b/io/init.c
@@ -32,7 +32,7 @@ void
usage(void)
{
fprintf(stderr,
- _("Usage: %s [-adFfmrRstx] [-p prog] [-c cmd]... file\n"),
+ _("Usage: %s [-adfmrRstx] [-p prog] [-c cmd]... file\n"),
progname);
exit(1);
}
@@ -145,7 +145,7 @@ init(
flags |= IO_DIRECT;
break;
case 'F':
- flags |= IO_FOREIGN;
+ /* Ignored / deprecated now, handled automatically */
break;
case 'f':
flags |= IO_CREAT;
@@ -188,9 +188,10 @@ init(
}
while (optind < argc) {
- if ((c = openfile(argv[optind], flags & IO_FOREIGN ?
- NULL : &geometry, flags, mode)) < 0)
+ if ((c = openfile(argv[optind], &geometry, flags, mode)) < 0)
exit(1);
+ if (!platform_test_xfs_fd(c))
+ flags |= IO_FOREIGN;
if (addfile(argv[optind], c, &geometry, flags) < 0)
exit(1);
optind++;
diff --git a/io/open.c b/io/open.c
index f1a6501..97631e2 100644
--- a/io/open.c
+++ b/io/open.c
@@ -163,17 +163,9 @@ openfile(
}
}
- if (!geom)
+ if (!platform_test_xfs_fd(fd))
return fd;
- if (!platform_test_xfs_fd(fd)) {
- fprintf(stderr, _("%s: specified file "
- "[\"%s\"] is not on an XFS filesystem\n"),
- progname, path);
- close(fd);
- return -1;
- }
-
if (xfsctl(path, fd, XFS_IOC_FSGEOMETRY, geom) < 0) {
perror("XFS_IOC_FSGEOMETRY");
close(fd);
@@ -282,10 +274,10 @@ open_f(
return 0;
}
- while ((c = getopt(argc, argv, "FRacdfm:nrstx")) != EOF) {
+ while ((c = getopt(argc, argv, "Racdfm:nrstx")) != EOF) {
switch (c) {
case 'F':
- flags |= IO_FOREIGN;
+ /* Ignored / deprecated now, handled automatically */
break;
case 'a':
flags |= IO_APPEND;
@@ -328,11 +320,13 @@ open_f(
if (optind != argc - 1)
return command_usage(&open_cmd);
- fd = openfile(argv[optind], flags & IO_FOREIGN ?
- NULL : &geometry, flags, mode);
+ fd = openfile(argv[optind], &geometry, flags, mode);
if (fd < 0)
return 0;
+ if (!platform_test_xfs_fd(fd))
+ flags |= IO_FOREIGN;
+
addfile(argv[optind], fd, &geometry, flags);
return 0;
}
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 6fc6bad..332718c 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -4,7 +4,7 @@ xfs_io \- debug the I/O path of an XFS filesystem
.SH SYNOPSIS
.B xfs_io
[
-.B \-adFfmrRstx
+.B \-adfmrRstx
] [
.B \-c
.I cmd
@@ -37,12 +37,6 @@ Set the program name for prompts and some error messages,
the default value is
.BR xfs_io .
.TP
-.B \-F
-Allow
-.I file
-to reside in non-XFS (foreign) filesystems.
-This mode has a restricted set of commands.
-.TP
.B \-f
Create
.I file
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2012-02-02 17:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 17:35 Eric Sandeen [this message]
2012-02-03 15:04 ` [PATCH] xfs_io: deprecate the "-F" foreign flag Christoph Hellwig
2012-02-03 16:10 ` Eric Sandeen
2012-02-13 19:00 ` Christoph Hellwig
2012-02-14 17:18 ` Eric Sandeen
2012-03-08 21:39 ` Mark Tinguely
2012-03-08 22:16 ` Eric Sandeen
2012-03-08 22:20 ` [PATCH] xfs_io: allow -F in open args Eric Sandeen
2012-03-08 22:37 ` Mark Tinguely
2012-03-08 22:37 ` Eric Sandeen
2012-03-08 22:39 ` Mark Tinguely
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=4F2AC948.1050909@redhat.com \
--to=sandeen@redhat.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/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