scsi: target: use ISCSI_IQN_LEN in iscsi_target_stat

Move the ISCSI_IQN_LEN definition up, so that it can be used in more
places instead of a hardcoded value.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
David Disseldorp 2018-10-12 12:01:16 +02:00 committed by Martin K. Petersen
parent 3bccfba831
commit df711553f4
3 changed files with 7 additions and 7 deletions

View File

@ -328,10 +328,10 @@ static ssize_t iscsi_stat_tgt_attr_fail_intr_name_show(struct config_item *item,
{ {
struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item);
struct iscsi_login_stats *lstat = &tiqn->login_stats; struct iscsi_login_stats *lstat = &tiqn->login_stats;
unsigned char buf[224]; unsigned char buf[ISCSI_IQN_LEN];
spin_lock(&lstat->lock); spin_lock(&lstat->lock);
snprintf(buf, 224, "%s", lstat->last_intr_fail_name[0] ? snprintf(buf, ISCSI_IQN_LEN, "%s", lstat->last_intr_fail_name[0] ?
lstat->last_intr_fail_name : NONE); lstat->last_intr_fail_name : NONE);
spin_unlock(&lstat->lock); spin_unlock(&lstat->lock);

View File

@ -25,6 +25,7 @@ struct sock;
#define ISCSIT_TCP_BACKLOG 256 #define ISCSIT_TCP_BACKLOG 256
#define ISCSI_RX_THREAD_NAME "iscsi_trx" #define ISCSI_RX_THREAD_NAME "iscsi_trx"
#define ISCSI_TX_THREAD_NAME "iscsi_ttx" #define ISCSI_TX_THREAD_NAME "iscsi_ttx"
#define ISCSI_IQN_LEN 224
/* struct iscsi_node_attrib sanity values */ /* struct iscsi_node_attrib sanity values */
#define NA_DATAOUT_TIMEOUT 3 #define NA_DATAOUT_TIMEOUT 3
@ -270,9 +271,9 @@ struct iscsi_conn_ops {
}; };
struct iscsi_sess_ops { struct iscsi_sess_ops {
char InitiatorName[224]; char InitiatorName[ISCSI_IQN_LEN];
char InitiatorAlias[256]; char InitiatorAlias[256];
char TargetName[224]; char TargetName[ISCSI_IQN_LEN];
char TargetAlias[256]; char TargetAlias[256];
char TargetAddress[256]; char TargetAddress[256];
u16 TargetPortalGroupTag; /* [0..65535] */ u16 TargetPortalGroupTag; /* [0..65535] */
@ -855,7 +856,6 @@ struct iscsi_wwn_stat_grps {
}; };
struct iscsi_tiqn { struct iscsi_tiqn {
#define ISCSI_IQN_LEN 224
unsigned char tiqn[ISCSI_IQN_LEN]; unsigned char tiqn[ISCSI_IQN_LEN];
enum tiqn_state_table tiqn_state; enum tiqn_state_table tiqn_state;
int tiqn_access_count; int tiqn_access_count;

View File

@ -33,7 +33,7 @@ struct iscsi_sess_err_stats {
u32 cxn_timeout_errors; u32 cxn_timeout_errors;
u32 pdu_format_errors; u32 pdu_format_errors;
u32 last_sess_failure_type; u32 last_sess_failure_type;
char last_sess_fail_rem_name[224]; char last_sess_fail_rem_name[ISCSI_IQN_LEN];
} ____cacheline_aligned; } ____cacheline_aligned;
/* iSCSI login failure types (sub oids) */ /* iSCSI login failure types (sub oids) */
@ -56,7 +56,7 @@ struct iscsi_login_stats {
u32 last_fail_type; u32 last_fail_type;
int last_intr_fail_ip_family; int last_intr_fail_ip_family;
struct sockaddr_storage last_intr_fail_sockaddr; struct sockaddr_storage last_intr_fail_sockaddr;
char last_intr_fail_name[224]; char last_intr_fail_name[ISCSI_IQN_LEN];
} ____cacheline_aligned; } ____cacheline_aligned;
/* iSCSI logout stats */ /* iSCSI logout stats */