]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: deprecate the "-F" foreign flag
authorEric Sandeen <sandeen@sandeen.net>
Fri, 3 Feb 2012 16:17:25 +0000 (10:17 -0600)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 3 Feb 2012 16:17:25 +0000 (10:17 -0600)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
io/init.c
io/open.c
man/man8/xfs_io.8

index a166ad1253e282369d35e1a48b405d50121a05d9..f416acf9bc77172114f082bcb5efb3d43657c368 100644 (file)
--- 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++;
index f1a65010473c74801e44e1aa89812f953c02e6ec..97631e22e177452ca6ae46d01ca5ef995f74ef5f 100644 (file)
--- 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;
 }
index 6fc6bad90ace472a5b4d40a151c14a4e6fef9753..332718c4b0b057bc26ff418b483bb55ae49d52e7 100644 (file)
@@ -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