From 35d63ea4ea2a8eb727dc6f5e5c525cfa42ecdf86 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Thu, 24 Jul 2014 11:27:22 -0500 Subject: [PATCH] LU-5406: liblustre: remove \n from some llapi_error strings 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 Reviewed-on: http://review.whamcloud.com/11214 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/tests/ll_dirstripe_verify.c | 115 +++++++++++++++++++------------------ lustre/utils/liblustreapi.c | 22 +++---- 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/lustre/tests/ll_dirstripe_verify.c b/lustre/tests/ll_dirstripe_verify.c index b44c32b..c41b567 100644 --- a/lustre/tests/ll_dirstripe_verify.c +++ b/lustre/tests/ll_dirstripe_verify.c @@ -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); diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 2ebdc58..cc3c97e 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -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); -- 1.8.3.1