Whamcloud - gitweb
b=14836 Fail if "lfs setstripe" has positional parameters
authorAndreas Dilger <andreas.dilger@oracle.com>
Tue, 23 Nov 2010 21:17:32 +0000 (14:17 -0700)
committerVitaly Fertman <vitaly.fertman@oracle.com>
Tue, 23 Nov 2010 21:35:11 +0000 (00:35 +0300)
Since 1.6.1 it has been possible to use named options -c/-i/-s to
specify the layout parameters for "lfs setstripe".

Since 1.8.0 the use of the old positional parameters has generated
a warning that they are deprecated.

The code was set to fail building at 2.1.0.0, so this needs to be
resolved before moving to a release build.  Instead of simply removing
the conditional code, change "lfs setstripe" to return an error if
positional parameters are used.  That would avoid the confusion of
creating files with names of the old {size}, {offset}, and {count}
parameters, instead of returning a meaningful error to the user.

lustre/utils/lfs.c

index 996fbe8..20f2d60 100644 (file)
@@ -292,18 +292,12 @@ static int lfs_setstripe(int argc, char **argv)
         st_offset = -1;
         st_count = 0;
 
-#if LUSTRE_VERSION < OBD_OCD_VERSION(2,1,0,0)
+#if LUSTRE_VERSION < OBD_OCD_VERSION(2,4,50,0)
         if (argc == 5 && argv[1][0] != '-' &&
             isnumber(argv[2]) && isnumber(argv[3]) && isnumber(argv[4])) {
-                fprintf(stderr, "warning: deprecated usage of setstripe "
+                fprintf(stderr, "error: obsolete usage of setstripe "
                         "positional parameters.  Use -c, -i, -s instead.\n");
-                /* for compatibility with the existing positional parameter
-                 * usage */
-                fname = argv[1];
-                stripe_size_arg = argv[2];
-                stripe_off_arg = argv[3];
-                stripe_count_arg = argv[4];
-                optind = 4;
+                return CMD_HELP;
         } else
 #else
 #warning "remove obsolete positional parameter code"