From d5ffb2234bd336cbd7b00b697b585dba1709b9f7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 23 Mar 2012 22:03:22 +0000 Subject: [PATCH] Cleanup mgmt parameters initialization. It's better to do it via a single function. Patch from Alexey Obitotskiy git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4165 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/ft_cmd.c | 3 ++- iscsi-scst/kernel/iscsi.c | 3 ++- scst/include/scst.h | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fcst/ft_cmd.c b/fcst/ft_cmd.c index 55832d8a1..f2968d982 100644 --- a/fcst/ft_cmd.c +++ b/fcst/ft_cmd.c @@ -505,7 +505,8 @@ static void ft_recv_tm(struct scst_session *scst_sess, struct scst_rx_mgmt_params params; int ret; - memset(¶ms, 0, sizeof(params)); + scst_rx_mgmt_params_init(¶ms); + params.lun = fcp->fc_lun; params.lun_len = sizeof(fcp->fc_lun); params.lun_set = 1; diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index ec75b1d1b..c1ab52928 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -2531,7 +2531,8 @@ static void execute_task_management(struct iscsi_cmnd *req) } else spin_unlock(&sess->sn_lock); - memset(¶ms, 0, sizeof(params)); + scst_rx_mgmt_params_init(¶ms); + params.atomic = SCST_NON_ATOMIC; params.tgt_priv = req; diff --git a/scst/include/scst.h b/scst/include/scst.h index c9647c1d8..f666fe4ea 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2837,6 +2837,12 @@ void scst_tgt_cmd_done(struct scst_cmd *cmd, int scst_rx_mgmt_fn(struct scst_session *sess, const struct scst_rx_mgmt_params *params); +static inline void scst_rx_mgmt_params_init( + struct scst_rx_mgmt_params *params) +{ + memset(params, 0, sizeof(*params)); +} + /* * Creates new management command using tag and sends it for execution. * Can be used for SCST_ABORT_TASK only. @@ -2852,7 +2858,8 @@ static inline int scst_rx_mgmt_fn_tag(struct scst_session *sess, int fn, BUG_ON(fn != SCST_ABORT_TASK); - memset(¶ms, 0, sizeof(params)); + scst_rx_mgmt_params_init(¶ms); + params.fn = fn; params.tag = tag; params.tag_set = 1; @@ -2876,7 +2883,8 @@ static inline int scst_rx_mgmt_fn_lun(struct scst_session *sess, int fn, BUG_ON(fn == SCST_ABORT_TASK); - memset(¶ms, 0, sizeof(params)); + scst_rx_mgmt_params_init(¶ms); + params.fn = fn; params.lun = lun; params.lun_len = lun_len;