summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-28 04:23:57 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-28 03:34:58 -0700
commit550cdfbcf2a5300c926f87403e12f19424bffeac (patch)
tree21322ead4b1cbb9564e37c96deb7930009e0197d /xlators/protocol/server
parent927aedbb556ee07250248181f52642eeb6de9e58 (diff)
fix all clang errors in xlator/protocol
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1092 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1092
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r--xlators/protocol/server/src/server-handshake.c17
-rw-r--r--xlators/protocol/server/src/server-helpers.c17
-rw-r--r--xlators/protocol/server/src/server-resolve.c31
-rw-r--r--xlators/protocol/server/src/server.c2
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c58
5 files changed, 32 insertions, 93 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index f9a4bca364c..68964883836 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -266,6 +266,7 @@ server_getspec (rpcsvc_request_t *req)
if (xdr_to_glusterfs_req (req, &args, xdr_to_getspec_req)) {
//failed to decode msg;
req->rpc_err = GARBAGE_ARGS;
+ op_errno = EINVAL;
goto fail;
}
@@ -278,6 +279,7 @@ server_getspec (rpcsvc_request_t *req)
gf_log (conn->this->name, GF_LOG_ERROR,
"Unable to stat %s (%s)",
filename, strerror (errno));
+ op_errno = errno;
goto fail;
}
@@ -286,6 +288,7 @@ server_getspec (rpcsvc_request_t *req)
gf_log (conn->this->name, GF_LOG_ERROR,
"Unable to open %s (%s)",
filename, strerror (errno));
+ op_errno = errno;
goto fail;
}
ret = file_len = stbuf.st_size;
@@ -295,7 +298,7 @@ server_getspec (rpcsvc_request_t *req)
_volfile_update_checksum (conn->this, key, checksum);
}
} else {
- errno = ENOENT;
+ op_errno = ENOENT;
}
if (file_len) {
@@ -312,8 +315,8 @@ server_getspec (rpcsvc_request_t *req)
}
/* convert to XDR */
-fail:
op_errno = errno;
+fail:
rsp.op_errno = gf_errno_to_error (op_errno);
rsp.op_ret = ret;
@@ -471,6 +474,9 @@ server_setvolume (rpcsvc_request_t *req)
if (ret == 0) {
ret = dict_get_str (params, "volfile-key",
&volfile_key);
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to set 'volfile-key'");
ret = _validate_volfile_checksum (this, volfile_key,
checksum);
@@ -561,10 +567,15 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "process-uuid",
this->ctx->process_uuid);
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to set 'process-uuid'");
ret = dict_set_uint64 (reply, "transport-ptr",
((uint64_t) (long) req->conn->trans));
-
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to set 'transport-ptr'");
fail:
rsp.dict.dict_len = dict_serialized_length (reply);
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 84c66d1141d..126185321c8 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -942,15 +942,14 @@ destroy_server_conn_state (server_connection_t *conn)
void
print_caller (char *str, int size, call_frame_t *frame)
{
- int filled = 0;
server_state_t *state = NULL;
state = CALL_STATE (frame);
- filled += snprintf (str + filled, size - filled,
- " Callid=%"PRId64", Client=%s",
- frame->root->unique,
- state->xprt->peerinfo.identifier);
+ snprintf (str, size,
+ " Callid=%"PRId64", Client=%s",
+ frame->root->unique,
+ state->xprt->peerinfo.identifier);
return;
}
@@ -987,7 +986,7 @@ server_print_resolve (char *str, int size, server_resolve_t *resolve)
filled += snprintf (str + filled, size - filled,
"path=%s", resolve->path);
- filled += snprintf (str + filled, size - filled, "}");
+ snprintf (str + filled, size - filled, "}");
}
@@ -1014,7 +1013,7 @@ server_print_loc (char *str, int size, loc_t *loc)
filled += snprintf (str + filled, size - filled,
"parent=%p", loc->parent);
- filled += snprintf (str + filled, size - filled, "}");
+ snprintf (str + filled, size - filled, "}");
}
@@ -1060,8 +1059,8 @@ server_print_params (char *str, int size, server_state_t *state)
filled += snprintf (str + filled, size - filled,
"volume=%s,", state->volume);
- filled += snprintf (str + filled, size - filled,
- "bound_xl=%s}", state->conn->bound_xl->name);
+ snprintf (str + filled, size - filled,
+ "bound_xl=%s}", state->conn->bound_xl->name);
}
int
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 91cf0d96f30..ec955b1e872 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -41,8 +41,6 @@ component_count (const char *path)
int count = 0;
const char *trav = NULL;
- trav = path;
-
for (trav = path; *trav; trav++) {
if (*trav == '/')
count++;
@@ -56,7 +54,6 @@ int
prepare_components (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
server_resolve_t *resolve = NULL;
char *resolved = NULL;
int count = 0;
@@ -66,7 +63,6 @@ prepare_components (call_frame_t *frame)
state = CALL_STATE (frame);
- this = frame->this;
resolve = state->resolve_now;
resolved = gf_strdup (resolve->path);
@@ -117,6 +113,9 @@ resolve_loc_touchup (call_frame_t *frame)
} else if (loc->inode) {
ret = inode_path (loc->inode, NULL, &path);
}
+ if (ret)
+ gf_log ("", GF_LOG_DEBUG,
+ "return value inode_path %d", ret);
if (!path)
path = gf_strdup (resolve->path);
@@ -157,6 +156,9 @@ resolve_deep_continue (call_frame_t *frame)
ret = resolve_inode_simple (frame);
else if (resolve->path)
ret = resolve_path_simple (frame);
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "return value of resolve_*_simple %d", ret);
resolve_loc_touchup (frame);
@@ -228,12 +230,10 @@ int
resolve_path_deep (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
server_resolve_t *resolve = NULL;
int i = 0;
state = CALL_STATE (frame);
- this = frame->this;
resolve = state->resolve_now;
gf_log (BOUND_XL (frame)->name, GF_LOG_TRACE,
@@ -258,7 +258,6 @@ int
resolve_path_simple (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
server_resolve_t *resolve = NULL;
struct resolve_comp *components = NULL;
int ret = -1;
@@ -267,7 +266,6 @@ resolve_path_simple (call_frame_t *frame)
int i = 0;
state = CALL_STATE (frame);
- this = frame->this;
resolve = state->resolve_now;
components = resolve->components;
@@ -412,14 +410,10 @@ int
server_resolve_entry (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
- server_resolve_t *resolve = NULL;
int ret = 0;
loc_t *loc = NULL;
state = CALL_STATE (frame);
- this = frame->this;
- resolve = state->resolve_now;
loc = state->loc_now;
ret = resolve_entry_simple (frame);
@@ -443,13 +437,11 @@ int
resolve_inode_simple (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
server_resolve_t *resolve = NULL;
inode_t *inode = NULL;
int ret = 0;
state = CALL_STATE (frame);
- this = frame->this;
resolve = state->resolve_now;
if (resolve->type == RESOLVE_EXACT) {
@@ -488,14 +480,10 @@ int
server_resolve_inode (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
- server_resolve_t *resolve = NULL;
int ret = 0;
loc_t *loc = NULL;
state = CALL_STATE (frame);
- this = frame->this;
- resolve = state->resolve_now;
loc = state->loc_now;
ret = resolve_inode_simple (frame);
@@ -519,13 +507,11 @@ int
server_resolve_fd (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
server_resolve_t *resolve = NULL;
server_connection_t *conn = NULL;
uint64_t fd_no = -1;
state = CALL_STATE (frame);
- this = frame->this;
resolve = state->resolve_now;
conn = SERVER_CONNECTION (frame);
@@ -548,11 +534,9 @@ int
server_resolve (call_frame_t *frame)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
server_resolve_t *resolve = NULL;
state = CALL_STATE (frame);
- this = frame->this;
resolve = state->resolve_now;
if (resolve->fd_no != -1) {
@@ -644,13 +628,10 @@ int
resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn)
{
server_state_t *state = NULL;
- xlator_t *this = NULL;
state = CALL_STATE (frame);
state->resume_fn = fn;
- this = frame->this;
-
server_resolve_all (frame);
return 0;
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 874c2615e31..0dce85b020e 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -332,6 +332,8 @@ validate_auth_options (xlator_t *this, dict_t *dict)
if (ret == 0) {
/* for module type */
tmp = strtok_r (NULL, ".", &saveptr);
+ if (!tmp)
+ break;
/* for volume name */
tmp = strtok_r (NULL, ".", &saveptr);
}
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index d100f5fde65..18ace876c7b 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -1742,7 +1742,7 @@ server_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl)
{
server_state_t *state = NULL;
int op_ret = 0;
- int op_errno = 0;
+ int op_errno = EINVAL;
state = CALL_STATE (frame);
@@ -1758,7 +1758,7 @@ server_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl)
return 0;
err:
- server_rchecksum_cbk (frame, NULL, frame->this, -1, EINVAL, 0, NULL);
+ server_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0, NULL);
return 0;
@@ -2842,7 +2842,6 @@ int
server_create (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_create_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -2851,8 +2850,6 @@ server_create (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.path = path;
args.bname = bname;
@@ -3675,7 +3672,6 @@ int
server_getxattr (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_getxattr_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -3684,8 +3680,6 @@ server_getxattr (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.path = path;
args.name = name;
@@ -3728,7 +3722,6 @@ int
server_fgetxattr (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_fgetxattr_req args = {0,};
char name[4096] = {0,};
@@ -3736,8 +3729,6 @@ server_fgetxattr (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.name = name;
if (!xdr_to_fgetxattr_req (req->msg[0], &args)) {
//failed to decode msg;
@@ -3777,7 +3768,6 @@ int
server_removexattr (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_removexattr_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -3786,8 +3776,6 @@ server_removexattr (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.path = path;
args.name = name;
if (!xdr_to_removexattr_req (req->msg[0], &args)) {
@@ -3874,15 +3862,12 @@ int
server_readdirp (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_readdirp_req args = {0,};
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
if (!xdr_to_readdirp_req (req->msg[0], &args)) {
//failed to decode msg;
req->rpc_err = GARBAGE_ARGS;
@@ -3918,15 +3903,12 @@ int
server_readdir (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_readdir_req args = {0,};
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
if (!xdr_to_readdir_req (req->msg[0], &args)) {
//failed to decode msg;
req->rpc_err = GARBAGE_ARGS;
@@ -3962,15 +3944,12 @@ int
server_fsyncdir (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_fsyncdir_req args = {0,};
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
if (!xdr_to_fsyncdir_req (req->msg[0], &args)) {
//failed to decode msg;
req->rpc_err = GARBAGE_ARGS;
@@ -4007,7 +3986,6 @@ int
server_mknod (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_mknod_req args = {0,};
char bname[SERVER_PATH_MAX] = {0,};
@@ -4016,7 +3994,6 @@ server_mknod (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
args.path = path;
args.bname = bname;
@@ -4060,7 +4037,6 @@ int
server_mkdir (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_mkdir_req args = {0,};
char bname[SERVER_PATH_MAX] = {0,};
@@ -4069,7 +4045,6 @@ server_mkdir (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
args.path = path;
args.bname = bname;
@@ -4112,7 +4087,6 @@ int
server_rmdir (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_rmdir_req args = {0,};
char bname[SERVER_PATH_MAX] = {0,};
@@ -4121,7 +4095,6 @@ server_rmdir (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
args.path = path;
args.bname = bname;
@@ -4163,7 +4136,6 @@ int
server_inodelk (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_inodelk_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -4173,7 +4145,6 @@ server_inodelk (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
args.path = path;
args.volume = volume;
@@ -4242,7 +4213,6 @@ int
server_finodelk (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_finodelk_req args = {0,};
char volume[4096] = {0,};
@@ -4250,8 +4220,6 @@ server_finodelk (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.volume = volume;
if (!xdr_to_finodelk_req (req->msg[0], &args)) {
//failed to decode msg;
@@ -4317,7 +4285,6 @@ int
server_entrylk (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_entrylk_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -4331,8 +4298,6 @@ server_entrylk (rpcsvc_request_t *req)
args.volume = volume;
args.name = name;
- conn = req->conn->trans->xl_private;
-
if (!xdr_to_entrylk_req (req->msg[0], &args)) {
//failed to decode msg;
req->rpc_err = GARBAGE_ARGS;
@@ -4375,7 +4340,6 @@ int
server_fentrylk (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_fentrylk_req args = {0,};
char name[4096] = {0,};
@@ -4384,8 +4348,6 @@ server_fentrylk (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.name = name;
args.volume = volume;
if (!xdr_to_fentrylk_req (req->msg[0], &args)) {
@@ -4427,7 +4389,6 @@ int
server_access (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_access_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -4435,8 +4396,6 @@ server_access (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.path = path;
if (!xdr_to_access_req (req->msg[0], &args)) {
//failed to decode msg;
@@ -4476,7 +4435,6 @@ int
server_symlink (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_symlink_req args = {0,};
char linkname[4096] = {0,};
@@ -4486,7 +4444,6 @@ server_symlink (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
args.path = path;
args.bname = bname;
args.linkname = linkname;
@@ -4530,7 +4487,6 @@ int
server_link (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_link_req args = {0,};
char oldpath[SERVER_PATH_MAX] = {0,};
@@ -4540,8 +4496,6 @@ server_link (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.oldpath = oldpath;
args.newpath = newpath;
args.newbname = newbname;
@@ -4588,7 +4542,6 @@ int
server_rename (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_rename_req args = {0,};
char oldpath[SERVER_PATH_MAX] = {0,};
@@ -4599,8 +4552,6 @@ server_rename (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
args.oldpath = oldpath;
args.oldbname = oldbname;
args.newpath = newpath;
@@ -4723,15 +4674,12 @@ int
server_rchecksum (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_rchecksum_req args = {0,};
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
-
if (!xdr_to_rchecksum_req (req->msg[0], &args)) {
//failed to decode msg;
req->rpc_err = GARBAGE_ARGS;
@@ -4888,7 +4836,6 @@ int
server_statfs (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
- server_connection_t *conn = NULL;
call_frame_t *frame = NULL;
gfs3_statfs_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
@@ -4896,7 +4843,6 @@ server_statfs (rpcsvc_request_t *req)
if (!req)
return 0;
- conn = req->conn->trans->xl_private;
args.path = path;
if (!xdr_to_statfs_req (req->msg[0], &args)) {
//failed to decode msg;