Commit 0bcc297e authored by Christophe Vu-Brugier's avatar Christophe Vu-Brugier Committed by Nicholas Bellinger

target: cleanup some boolean tests

Convert "x == true" to "x" and "x == false" to "!x".
Signed-off-by: default avatarChristophe Vu-Brugier <cvubrugier@yahoo.fr>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9aff64e1
...@@ -300,7 +300,7 @@ bool iscsit_check_np_match( ...@@ -300,7 +300,7 @@ bool iscsit_check_np_match(
port = ntohs(sock_in->sin_port); port = ntohs(sock_in->sin_port);
} }
if ((ip_match == true) && (np->np_port == port) && if (ip_match && (np->np_port == port) &&
(np->np_network_transport == network_transport)) (np->np_network_transport == network_transport))
return true; return true;
...@@ -325,7 +325,7 @@ static struct iscsi_np *iscsit_get_np( ...@@ -325,7 +325,7 @@ static struct iscsi_np *iscsit_get_np(
} }
match = iscsit_check_np_match(sockaddr, np, network_transport); match = iscsit_check_np_match(sockaddr, np, network_transport);
if (match == true) { if (match) {
/* /*
* Increment the np_exports reference count now to * Increment the np_exports reference count now to
* prevent iscsit_del_np() below from being called * prevent iscsit_del_np() below from being called
...@@ -1120,7 +1120,7 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, ...@@ -1120,7 +1120,7 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr,
/* /*
* Special case for Unsupported SAM WRITE Opcodes and ImmediateData=Yes. * Special case for Unsupported SAM WRITE Opcodes and ImmediateData=Yes.
*/ */
if (dump_payload == true) if (dump_payload)
goto after_immediate_data; goto after_immediate_data;
immed_ret = iscsit_handle_immediate_data(cmd, hdr, immed_ret = iscsit_handle_immediate_data(cmd, hdr,
...@@ -3484,10 +3484,8 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) ...@@ -3484,10 +3484,8 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
len = sprintf(buf, "TargetAddress=" len = sprintf(buf, "TargetAddress="
"%s:%hu,%hu", "%s:%hu,%hu",
(inaddr_any == false) ? inaddr_any ? conn->local_ip : np->np_ip,
np->np_ip : conn->local_ip, inaddr_any ? conn->local_port : np->np_port,
(inaddr_any == false) ?
np->np_port : conn->local_port,
tpg->tpgt); tpg->tpgt);
len += 1; len += 1;
......
...@@ -1153,7 +1153,7 @@ iscsit_conn_set_transport(struct iscsi_conn *conn, struct iscsit_transport *t) ...@@ -1153,7 +1153,7 @@ iscsit_conn_set_transport(struct iscsi_conn *conn, struct iscsit_transport *t)
void iscsi_target_login_sess_out(struct iscsi_conn *conn, void iscsi_target_login_sess_out(struct iscsi_conn *conn,
struct iscsi_np *np, bool zero_tsih, bool new_sess) struct iscsi_np *np, bool zero_tsih, bool new_sess)
{ {
if (new_sess == false) if (!new_sess)
goto old_sess_out; goto old_sess_out;
pr_err("iSCSI Login negotiation failed.\n"); pr_err("iSCSI Login negotiation failed.\n");
......
...@@ -404,7 +404,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk) ...@@ -404,7 +404,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
} }
rc = schedule_delayed_work(&conn->login_work, 0); rc = schedule_delayed_work(&conn->login_work, 0);
if (rc == false) { if (!rc) {
pr_debug("iscsi_target_sk_data_ready, schedule_delayed_work" pr_debug("iscsi_target_sk_data_ready, schedule_delayed_work"
" got false\n"); " got false\n");
} }
...@@ -513,7 +513,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work) ...@@ -513,7 +513,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
state = (tpg->tpg_state == TPG_STATE_ACTIVE); state = (tpg->tpg_state == TPG_STATE_ACTIVE);
spin_unlock(&tpg->tpg_state_lock); spin_unlock(&tpg->tpg_state_lock);
if (state == false) { if (!state) {
pr_debug("iscsi_target_do_login_rx: tpg_state != TPG_STATE_ACTIVE\n"); pr_debug("iscsi_target_do_login_rx: tpg_state != TPG_STATE_ACTIVE\n");
iscsi_target_restore_sock_callbacks(conn); iscsi_target_restore_sock_callbacks(conn);
iscsi_target_login_drop(conn, login); iscsi_target_login_drop(conn, login);
...@@ -528,7 +528,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work) ...@@ -528,7 +528,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
state = iscsi_target_sk_state_check(sk); state = iscsi_target_sk_state_check(sk);
read_unlock_bh(&sk->sk_callback_lock); read_unlock_bh(&sk->sk_callback_lock);
if (state == false) { if (!state) {
pr_debug("iscsi_target_do_login_rx, TCP state CLOSE\n"); pr_debug("iscsi_target_do_login_rx, TCP state CLOSE\n");
iscsi_target_restore_sock_callbacks(conn); iscsi_target_restore_sock_callbacks(conn);
iscsi_target_login_drop(conn, login); iscsi_target_login_drop(conn, login);
......
...@@ -474,10 +474,10 @@ int iscsi_set_keys_to_negotiate( ...@@ -474,10 +474,10 @@ int iscsi_set_keys_to_negotiate(
if (!strcmp(param->name, AUTHMETHOD)) { if (!strcmp(param->name, AUTHMETHOD)) {
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, HEADERDIGEST)) { } else if (!strcmp(param->name, HEADERDIGEST)) {
if (iser == false) if (!iser)
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, DATADIGEST)) { } else if (!strcmp(param->name, DATADIGEST)) {
if (iser == false) if (!iser)
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, MAXCONNECTIONS)) { } else if (!strcmp(param->name, MAXCONNECTIONS)) {
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
...@@ -497,7 +497,7 @@ int iscsi_set_keys_to_negotiate( ...@@ -497,7 +497,7 @@ int iscsi_set_keys_to_negotiate(
} else if (!strcmp(param->name, IMMEDIATEDATA)) { } else if (!strcmp(param->name, IMMEDIATEDATA)) {
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) { } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) {
if (iser == false) if (!iser)
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) { } else if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) {
continue; continue;
...@@ -528,13 +528,13 @@ int iscsi_set_keys_to_negotiate( ...@@ -528,13 +528,13 @@ int iscsi_set_keys_to_negotiate(
} else if (!strcmp(param->name, OFMARKINT)) { } else if (!strcmp(param->name, OFMARKINT)) {
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, RDMAEXTENSIONS)) { } else if (!strcmp(param->name, RDMAEXTENSIONS)) {
if (iser == true) if (iser)
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) { } else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) {
if (iser == true) if (iser)
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} else if (!strcmp(param->name, TARGETRECVDATASEGMENTLENGTH)) { } else if (!strcmp(param->name, TARGETRECVDATASEGMENTLENGTH)) {
if (iser == true) if (iser)
SET_PSTATE_NEGOTIATE(param); SET_PSTATE_NEGOTIATE(param);
} }
} }
......
...@@ -450,7 +450,7 @@ static bool iscsit_tpg_check_network_portal( ...@@ -450,7 +450,7 @@ static bool iscsit_tpg_check_network_portal(
match = iscsit_check_np_match(sockaddr, np, match = iscsit_check_np_match(sockaddr, np,
network_transport); network_transport);
if (match == true) if (match)
break; break;
} }
spin_unlock(&tpg->tpg_np_lock); spin_unlock(&tpg->tpg_np_lock);
...@@ -472,7 +472,7 @@ struct iscsi_tpg_np *iscsit_tpg_add_network_portal( ...@@ -472,7 +472,7 @@ struct iscsi_tpg_np *iscsit_tpg_add_network_portal(
if (!tpg_np_parent) { if (!tpg_np_parent) {
if (iscsit_tpg_check_network_portal(tpg->tpg_tiqn, sockaddr, if (iscsit_tpg_check_network_portal(tpg->tpg_tiqn, sockaddr,
network_transport) == true) { network_transport)) {
pr_err("Network Portal: %s already exists on a" pr_err("Network Portal: %s already exists on a"
" different TPG on %s\n", ip_str, " different TPG on %s\n", ip_str,
tpg->tpg_tiqn->tiqn); tpg->tpg_tiqn->tiqn);
......
...@@ -504,7 +504,7 @@ void transport_deregister_session(struct se_session *se_sess) ...@@ -504,7 +504,7 @@ void transport_deregister_session(struct se_session *se_sess)
* ->acl_free_comp caller to wakeup configfs se_node_acl->acl_group * ->acl_free_comp caller to wakeup configfs se_node_acl->acl_group
* removal context. * removal context.
*/ */
if (se_nacl && comp_nacl == true) if (se_nacl && comp_nacl)
target_put_nacl(se_nacl); target_put_nacl(se_nacl);
transport_free_session(se_sess); transport_free_session(se_sess);
...@@ -2363,7 +2363,7 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, ...@@ -2363,7 +2363,7 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd,
* fabric acknowledgement that requires two target_put_sess_cmd() * fabric acknowledgement that requires two target_put_sess_cmd()
* invocations before se_cmd descriptor release. * invocations before se_cmd descriptor release.
*/ */
if (ack_kref == true) { if (ack_kref) {
kref_get(&se_cmd->cmd_kref); kref_get(&se_cmd->cmd_kref);
se_cmd->se_cmd_flags |= SCF_ACK_KREF; se_cmd->se_cmd_flags |= SCF_ACK_KREF;
} }
......
...@@ -70,7 +70,7 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op ...@@ -70,7 +70,7 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op
unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN], *dev_wwn; unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN], *dev_wwn;
int rc; int rc;
if (src == true) if (src)
dev_wwn = &xop->dst_tid_wwn[0]; dev_wwn = &xop->dst_tid_wwn[0];
else else
dev_wwn = &xop->src_tid_wwn[0]; dev_wwn = &xop->src_tid_wwn[0];
...@@ -88,7 +88,7 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op ...@@ -88,7 +88,7 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op
if (rc != 0) if (rc != 0)
continue; continue;
if (src == true) { if (src) {
xop->dst_dev = se_dev; xop->dst_dev = se_dev;
pr_debug("XCOPY 0xe4: Setting xop->dst_dev: %p from located" pr_debug("XCOPY 0xe4: Setting xop->dst_dev: %p from located"
" se_dev\n", xop->dst_dev); " se_dev\n", xop->dst_dev);
...@@ -166,7 +166,7 @@ static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op ...@@ -166,7 +166,7 @@ static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op
return -EINVAL; return -EINVAL;
} }
if (src == true) { if (src) {
memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN);
/* /*
* Determine if the source designator matches the local device * Determine if the source designator matches the local device
...@@ -236,7 +236,7 @@ static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd, ...@@ -236,7 +236,7 @@ static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd,
/* /*
* Assume target descriptors are in source -> destination order.. * Assume target descriptors are in source -> destination order..
*/ */
if (src == true) if (src)
src = false; src = false;
else else
src = true; src = true;
...@@ -560,7 +560,7 @@ static int target_xcopy_init_pt_lun( ...@@ -560,7 +560,7 @@ static int target_xcopy_init_pt_lun(
* reservations. The pt_cmd->se_lun pointer will be setup from within * reservations. The pt_cmd->se_lun pointer will be setup from within
* target_xcopy_setup_pt_port() * target_xcopy_setup_pt_port()
*/ */
if (remote_port == false) { if (!remote_port) {
pt_cmd->se_cmd_flags |= SCF_SE_LUN_CMD | SCF_CMD_XCOPY_PASSTHROUGH; pt_cmd->se_cmd_flags |= SCF_SE_LUN_CMD | SCF_CMD_XCOPY_PASSTHROUGH;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment