summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2015-12-18 15:21:27 -0500
committerKaleb KEITHLEY <kkeithle@redhat.com>2016-02-15 01:32:14 -0800
commit62f9659554c07317c9d06251b74171d9eac0917e (patch)
treeb6296bf8e990d7e027c91ebf8e85c5ff7b1f3dea /xlators
parent954f2901345f42177033418112c052ed0795b295 (diff)
all: fix various cppcheck warnings
fixes for various warnings reported by cppcheck N.B. cppcheck output is in the bugzilla Change-Id: I33acec127bc4536935fdd8d52a0c490ec54d50b2 BUG: 1292954 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/13006 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-rename.c4
-rw-r--r--xlators/debug/io-stats/src/io-stats.c13
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c12
5 files changed, 26 insertions, 13 deletions
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 3b182016ee2..5170fac0e97 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -960,11 +960,9 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
xlator_t *src_cached = NULL;
dict_t *xattr = NULL;
- DHT_MARK_FOP_INTERNAL (xattr);
-
local = frame->local;
+ DHT_MARK_FOP_INTERNAL (xattr);
prev = cookie;
-
src_cached = local->src_cached;
if (op_ret == -1) {
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 8ce2ebbc6e9..eb604ea929b 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -651,7 +651,8 @@ ios_stats_cleanup (xlator_t *this, inode_t *inode)
} while (0)
int
-ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this, FILE* logfp)
+ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this,
+ FILE *logfp)
{
struct ios_stat_list *entry = NULL;
@@ -668,7 +669,7 @@ ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this, FILE* logf
int
ios_dump_throughput_stats (struct ios_stat_head *list_head, xlator_t *this,
- FILE* logfp, ios_stats_type_t type)
+ FILE *logfp, ios_stats_thru_t type)
{
struct ios_stat_list *entry = NULL;
struct timeval time = {0, };
@@ -1138,7 +1139,7 @@ out:
int
io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats,
- struct timeval *now, int interval, FILE* logfp)
+ struct timeval *now, int interval, FILE *logfp)
{
int i = 0;
int per_line = 0;
@@ -1280,13 +1281,15 @@ io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats,
ios_log (this, logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)"
"\tFILE NAME");
list_head = &conf->thru_list[IOS_STATS_THRU_READ];
- ios_dump_throughput_stats(list_head, this, logfp, IOS_STATS_TYPE_READ);
+ ios_dump_throughput_stats(list_head, this, logfp,
+ IOS_STATS_THRU_READ);
ios_log (this, logfp, "\n======Write Throughput File Stats======");
ios_log (this, logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)"
"\tFILE NAME");
list_head = &conf->thru_list[IOS_STATS_THRU_WRITE];
- ios_dump_throughput_stats (list_head, this, logfp, IOS_STATS_TYPE_WRITE);
+ ios_dump_throughput_stats (list_head, this, logfp,
+ IOS_STATS_THRU_WRITE);
}
return 0;
}
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index 4ee2020aaf1..e4d9113bd25 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -1685,6 +1685,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
"called");
va_start (ap, data);
output = va_arg (ap, dict_t *);
+ va_end (ap);
ret = br_scrubber_status_get (this, &output);
gf_msg_debug (this->name, 0, "returning %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 608b6dd5d35..c86587f6fbf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2274,6 +2274,9 @@ __glusterd_handle_fsm_log (rpcsvc_request_t *req)
GF_ASSERT (req);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("xlator", (this != NULL), out);
+
ret = xdr_to_generic (req->msg[0], &cli_req,
(xdrproc_t)xdr_gf1_cli_fsm_log_req);
if (ret < 0) {
@@ -2293,7 +2296,6 @@ __glusterd_handle_fsm_log (rpcsvc_request_t *req)
}
if (strcmp ("", cli_req.name) == 0) {
- this = THIS;
conf = this->private;
ret = glusterd_sm_tr_log_add_to_dict (dict, &conf->op_sm_log);
} else {
@@ -2917,6 +2919,9 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
GF_ASSERT (req);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("xlator", (this != NULL), out);
+
ret = xdr_to_generic (req->msg[0], &probe_req,
(xdrproc_t)xdr_gd1_mgmt_probe_req);
if (ret < 0) {
@@ -2928,8 +2933,6 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
goto out;
}
- this = THIS;
-
conf = this->private;
if (probe_req.port)
port = probe_req.port;
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 3373c93fd42..cb1c8e951e5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -6178,9 +6178,9 @@ glusterd_do_snap_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
{
int32_t ret = -1;
char *name = NULL;
+ char *volname = NULL;
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- glusterd_volinfo_t *volinfo = NULL;
glusterd_snap_t *snap = NULL;
this = THIS;
@@ -6194,11 +6194,19 @@ glusterd_do_snap_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
+ ret = dict_get_str (dict, "volname", &volname);
+ if (ret) {
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get"
+ " volume name");
+ goto out;
+ }
+
ret = dict_get_str (dict, "snapname", &name);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED, "getting the snap "
- "name failed (volume: %s)", volinfo->volname);
+ "name failed (volume: %s)", volname);
goto out;
}