Whamcloud - gitweb
LU-5170 lfs: Standardize error messages in lfs_path2fid() 70/30670/3
authorSteve Guminski <stephenx.guminski@intel.com>
Wed, 12 Jul 2017 19:07:27 +0000 (15:07 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 May 2018 02:23:09 +0000 (02:23 +0000)
Error messages in lfs_path2fid() 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: I32ab8650ddced9569837aa3d106ef1708c974bce
Reviewed-on: https://review.whamcloud.com/30670
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 bf7bb98..321975f 100644 (file)
@@ -6582,14 +6582,18 @@ static int lfs_path2fid(int argc, char **argv)
                        show_parents = true;
                        break;
                default:
-                       fprintf(stderr, "error: %s: option '%s' unrecognized\n",
-                               argv[0], argv[optind - 1]);
+                       fprintf(stderr,
+                               "%s path2fid: unrecognized option '%s'\n",
+                               progname, argv[optind - 1]);
                        return CMD_HELP;
                }
        }
 
-       if (optind > argc - 1)
+       if (optind > argc - 1) {
+               fprintf(stderr, "%s path2fid: FILE... must be specified\n",
+                       progname);
                return CMD_HELP;
+       }
        else if (optind < argc - 1)
                sep = ": ";
 
@@ -6624,8 +6628,9 @@ static int lfs_path2fid(int argc, char **argv)
                }
 
                if (err) {
-                       fprintf(stderr, "%s: can't get %sfid for %s: %s\n",
-                               argv[0], show_parents ? "parent " : "", *path,
+                       fprintf(stderr,
+                               "%s path2fid: cannot get %sfid for '%s': %s\n",
+                               progname, show_parents ? "parent " : "", *path,
                                strerror(-err));
                        if (rc == 0) {
                                rc = err;