Whamcloud - gitweb
LU-5170 lfs: Standardize error messages in lfs_mv() 39/28239/3
authorSteve Guminski <stephenx.guminski@intel.com>
Wed, 12 Jul 2017 13:56:44 +0000 (09:56 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 May 2018 02:22:20 +0000 (02:22 +0000)
Error messages in lfs_mv() are updated to a standard format.
Messages are prefixed with the name of the utility and the command
that caused the error.  User-provided values are delimited with
single quotes.

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: Id3d276024a2dcd1ca9169123f9d9193a846d7c85
Reviewed-on: https://review.whamcloud.com/28239
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
lustre/utils/lfs.c

index e05b3fb..5d18285 100644 (file)
@@ -5000,8 +5000,8 @@ static int lfs_mv(int argc, char **argv)
                case 'm':
                        param.fp_mdt_index = strtoul(optarg, &end, 0);
                        if (*end != '\0') {
-                               fprintf(stderr, "%s: invalid MDT index'%s'\n",
-                                       argv[0], optarg);
+                               fprintf(stderr, "%s mv: bad MDT index '%s'\n",
+                                       progname, optarg);
                                return CMD_HELP;
                        }
                        break;
@@ -5009,27 +5009,28 @@ static int lfs_mv(int argc, char **argv)
                        param.fp_verbose = VERBOSE_DETAIL;
                        break;
                default:
-                       fprintf(stderr, "error: %s: unrecognized option '%s'\n",
-                               argv[0], argv[optind - 1]);
+                       fprintf(stderr, "%s mv: unrecognized option '%s'\n",
+                               progname, argv[optind - 1]);
                        return CMD_HELP;
                }
        }
 
        if (param.fp_mdt_index == -1) {
-               fprintf(stderr, "%s: MDT index must be specified\n", argv[0]);
+               fprintf(stderr, "%s mv: MDT index must be specified\n",
+                       progname);
                return CMD_HELP;
        }
 
        if (optind >= argc) {
-               fprintf(stderr, "%s: missing operand path\n", argv[0]);
+               fprintf(stderr, "%s mv: DIR must be specified\n", progname);
                return CMD_HELP;
        }
 
        param.fp_migrate = 1;
        rc = llapi_migrate_mdt(argv[optind], &param);
        if (rc != 0)
-               fprintf(stderr, "%s: cannot migrate '%s' to MDT%04x: %s\n",
-                       argv[0], argv[optind], param.fp_mdt_index,
+               fprintf(stderr, "%s mv: cannot migrate '%s' to MDT%04x: %s\n",
+                       progname, argv[optind], param.fp_mdt_index,
                        strerror(-rc));
        return rc;
 }