Whamcloud - gitweb
LU-5406: liblustre: remove \n from some llapi_error strings 14/11214/4
authorFrank Zago <fzago@cray.com>
Thu, 24 Jul 2014 16:27:22 +0000 (11:27 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 18 Aug 2014 17:14:33 +0000 (17:14 +0000)
Some strings passed to llapi_error() contain a \n. But llapi_error's
callback, error_callback_default(), adds one too. So fix these strings.

Converted a few spaces to tabs.

Change-Id: I0e639bd52813ac672c677e7c10713f211ea0888a
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11214
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/ll_dirstripe_verify.c
lustre/utils/liblustreapi.c

index b44c32b..c41b567 100644 (file)
@@ -233,13 +233,13 @@ int main(int argc, char **argv)
                 return 1;
         }
 
-        dir = opendir(argv[1]);
-        if (dir == NULL) {
-                rc = -errno;
-                llapi_error(LLAPI_MSG_ERROR, rc,
-                            "error: %s opendir failed\n", argv[1]);
-                return rc;
-        }
+       dir = opendir(argv[1]);
+       if (dir == NULL) {
+               rc = -errno;
+               llapi_error(LLAPI_MSG_ERROR, rc,
+                           "error: %s opendir failed", argv[1]);
+               return rc;
+       }
 
        lum_size = lov_user_md_size(MAX_LOV_UUID_COUNT, LOV_USER_MAGIC);
        lum_dir = (struct lov_user_md *)malloc(lum_size);
@@ -251,61 +251,62 @@ int main(int argc, char **argv)
                goto cleanup;
        }
 
-        rc = llapi_file_get_stripe(argv[1], lum_dir);
-        if (rc) {
-                if (rc == -ENODATA) {
-                        free(lum_dir);
-                        lum_dir = NULL;
-                } else {
-                        llapi_error(LLAPI_MSG_ERROR, rc,
-                                    "error: can't get EA for %s\n", argv[1]);
-                        goto cleanup;
-                }
-        }
-
-        /* XXX should be llapi_lov_getname() */
-        rc = llapi_file_get_lov_uuid(argv[1], &lov_uuid);
-        if (rc) {
-                llapi_error(LLAPI_MSG_ERROR, rc,
-                            "error: can't get lov name for %s\n",
-                            argv[1]);
-                return rc;
-        }
+       rc = llapi_file_get_stripe(argv[1], lum_dir);
+       if (rc) {
+               if (rc == -ENODATA) {
+                       free(lum_dir);
+                       lum_dir = NULL;
+               } else {
+                       llapi_error(LLAPI_MSG_ERROR, rc,
+                                   "error: can't get EA for %s", argv[1]);
+                       goto cleanup;
+               }
+       }
 
-        if ((lum_file1 = (struct lov_user_md *)malloc(lum_size)) == NULL) {
-                rc = -ENOMEM;
-                llapi_error(LLAPI_MSG_ERROR, rc,
-                            "error: can't allocate %d bytes for EA\n",
-                            lum_size);
-                goto cleanup;
-        }
+       /* XXX should be llapi_lov_getname() */
+       rc = llapi_file_get_lov_uuid(argv[1], &lov_uuid);
+       if (rc) {
+               llapi_error(LLAPI_MSG_ERROR, rc,
+                           "error: can't get lov name for %s",
+                           argv[1]);
+               return rc;
+       }
 
-        rc = llapi_file_get_stripe(argv[2], lum_file1);
-        if (rc) {
-                llapi_error(LLAPI_MSG_ERROR, rc,
-                            "error: unable to get EA for %s\n", argv[2]);
-                goto cleanup;
-        }
+       lum_file1 = malloc(lum_size);
+       if (lum_file1 == NULL) {
+               rc = -ENOMEM;
+               llapi_error(LLAPI_MSG_ERROR, rc,
+                           "error: can't allocate %d bytes for EA",
+                           lum_size);
+               goto cleanup;
+       }
 
-        if (argc == 4) {
-                lum_file2 = (struct lov_user_md *)malloc(lum_size);
-                if (lum_file2 == NULL) {
-                        rc = -ENOMEM;
-                        llapi_error(LLAPI_MSG_ERROR, rc,
-                                    "error: can't allocate %d "
-                                    "bytes for file2 EA\n", lum_size);
-                        goto cleanup;
-                }
+       rc = llapi_file_get_stripe(argv[2], lum_file1);
+       if (rc) {
+               llapi_error(LLAPI_MSG_ERROR, rc,
+                           "error: unable to get EA for %s", argv[2]);
+               goto cleanup;
+       }
 
-                rc = llapi_file_get_stripe(argv[3], lum_file2);
-                if (rc) {
-                        llapi_error(LLAPI_MSG_ERROR, rc,
-                                    "error: can't get EA for %s\n", argv[3]);
-                        goto cleanup;
-                }
-        }
+       if (argc == 4) {
+               lum_file2 = (struct lov_user_md *)malloc(lum_size);
+               if (lum_file2 == NULL) {
+                       rc = -ENOMEM;
+                       llapi_error(LLAPI_MSG_ERROR, rc,
+                                   "error: can't allocate %d "
+                                   "bytes for file2 EA", lum_size);
+                       goto cleanup;
+               }
+
+               rc = llapi_file_get_stripe(argv[3], lum_file2);
+               if (rc) {
+                       llapi_error(LLAPI_MSG_ERROR, rc,
+                                   "error: can't get EA for %s", argv[3]);
+                       goto cleanup;
+               }
+       }
 
-        rc = compare(lum_dir, lum_file1, lum_file2);
+       rc = compare(lum_dir, lum_file1, lum_file2);
 
 cleanup:
         closedir(dir);
index 2ebdc58..cc3c97e 100644 (file)
@@ -3172,7 +3172,7 @@ static int cb_mv_init(char *path, DIR *parent, DIR **dirp,
                        *dirp = NULL;
                        ret = -errno;
                        llapi_error(LLAPI_MSG_ERROR, ret,
-                                   "can not open %s\n", path);
+                                   "can not open %s", path);
                        return ret;
                }
        }
@@ -3741,7 +3741,7 @@ static int rmtacl_notify(int ops)
                 if (fd < 0) {
                         rc = -errno;
                         llapi_error(LLAPI_MSG_ERROR, rc,
-                                    "Can't open '%s'\n", mnt->mnt_dir);
+                                   "Can't open '%s'", mnt->mnt_dir);
                        goto out;
                 }
 
@@ -3750,7 +3750,7 @@ static int rmtacl_notify(int ops)
                 if (rc < 0) {
                         rc = -errno;
                        llapi_error(LLAPI_MSG_ERROR, rc,
-                                   "ioctl RMTACL on '%s' err %d\n",
+                                   "ioctl RMTACL on '%s' err %d",
                                    mnt->mnt_dir, rc);
                        goto out;
                 }
@@ -3915,14 +3915,14 @@ static int do_rmtacl(int argc, char *argv[], int ops, int (output_func)(char *))
         if (output_func) {
                 if (pipe(fd) < 0) {
                         rc = -errno;
-                        llapi_error(LLAPI_MSG_ERROR, rc, "Can't create pipe\n");
+                       llapi_error(LLAPI_MSG_ERROR, rc, "Can't create pipe");
                         return rc;
                 }
 
                 pid = fork();
                 if (pid < 0) {
                         rc = -errno;
-                        llapi_error(LLAPI_MSG_ERROR, rc, "Can't fork\n");
+                       llapi_error(LLAPI_MSG_ERROR, rc, "Can't fork");
                         close(fd[0]);
                         close(fd[1]);
                         return rc;
@@ -3933,7 +3933,7 @@ static int do_rmtacl(int argc, char *argv[], int ops, int (output_func)(char *))
                         if (dup2(fd[1], 1) < 0) {
                                 rc = -errno;
                                 llapi_error(LLAPI_MSG_ERROR, rc,
-                                            "Can't dup2 %d\n", fd[1]);
+                                           "Can't dup2 %d", fd[1]);
                                 close(fd[1]);
                                 return rc;
                         }
@@ -3954,7 +3954,7 @@ static int do_rmtacl(int argc, char *argv[], int ops, int (output_func)(char *))
         fp = fdopen(fd[0], "r");
         if (fp == NULL) {
                 rc = -errno;
-                llapi_error(LLAPI_MSG_ERROR, rc, "fdopen %d failed\n", fd[0]);
+               llapi_error(LLAPI_MSG_ERROR, rc, "fdopen %d failed", fd[0]);
                 kill(pid, SIGKILL);
                 close(fd[0]);
                 return rc;
@@ -3970,7 +3970,7 @@ static int do_rmtacl(int argc, char *argv[], int ops, int (output_func)(char *))
 
         if (waitpid(pid, &status, 0) < 0) {
                 rc = -errno;
-                llapi_error(LLAPI_MSG_ERROR, rc, "waitpid %d failed\n", pid);
+               llapi_error(LLAPI_MSG_ERROR, rc, "waitpid %d failed", pid);
                 return rc;
         }
 
@@ -4523,7 +4523,7 @@ int llapi_create_volatile_idx(char *directory, int idx, int open_flags)
        fd = open("/dev/urandom", O_RDONLY);
        if (fd < 0) {
                llapi_error(LLAPI_MSG_ERROR, errno,
-                           "Cannot open /dev/urandom\n");
+                           "Cannot open /dev/urandom");
                return -errno;
        }
        rc = read(fd, &random, sizeof(random));
@@ -4549,7 +4549,7 @@ int llapi_create_volatile_idx(char *directory, int idx, int open_flags)
        fd = open(file_path, O_RDWR | O_CREAT | open_flags, S_IRUSR | S_IWUSR);
        if (fd < 0) {
                llapi_error(LLAPI_MSG_ERROR, errno,
-                           "Cannot create volatile file '%s' in '%s'\n",
+                           "Cannot create volatile file '%s' in '%s'",
                            filename + LUSTRE_VOLATILE_HDR_LEN,
                            directory);
                return -errno;
@@ -4613,7 +4613,7 @@ int llapi_swap_layouts(const char *path1, const char *path2,
        rc = llapi_fswap_layouts(fd1, fd2, dv1, dv2, flags);
        if (rc < 0)
                llapi_error(LLAPI_MSG_ERROR, rc,
-                           "error: cannot swap layout between '%s' and '%s'\n",
+                           "error: cannot swap layout between '%s' and '%s'",
                            path1, path2);
 
        close(fd2);