From dba17c0dee3347722185e959cb80c0255a117aba Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 6 Oct 2013 09:35:42 +0000 Subject: [PATCH] qla2x00t and iscsi-scst: Suppress checkpatch complaints about __attribute__((packed|aligned)) (merge r3952 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@5050 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/include/iscsi_scst.h | 9 +++--- iscsi-scst/kernel/iscsi.h | 5 ++-- mvsas_tgt/mv_tgt.h | 2 +- qla2x00t/qla2x00-target/qla2x00t.h | 6 ++-- qla2x00t/qla2x_tgt_def.h | 48 +++++++++++++++--------------- scst/include/scst.h | 11 +++++-- scst/include/scst_user.h | 2 +- 7 files changed, 43 insertions(+), 40 deletions(-) diff --git a/iscsi-scst/include/iscsi_scst.h b/iscsi-scst/include/iscsi_scst.h index c28e0fdfd..0c42f1b61 100644 --- a/iscsi-scst/include/iscsi_scst.h +++ b/iscsi-scst/include/iscsi_scst.h @@ -17,8 +17,11 @@ #ifndef _ISCSI_SCST_U_H #define _ISCSI_SCST_U_H -#ifndef __KERNEL__ +#ifdef __KERNEL__ +#include +#else #include +#define aligned_u64 uint64_t __attribute__((aligned(8))) #endif #include "iscsi_scst_ver.h" @@ -36,10 +39,6 @@ #define SCSI_ID_LEN 24 -#ifndef aligned_u64 -#define aligned_u64 uint64_t __attribute__((aligned(8))) -#endif - #define ISCSI_MAX_ATTR_NAME_LEN 50 #define ISCSI_MAX_ATTR_VALUE_LEN 512 diff --git a/iscsi-scst/kernel/iscsi.h b/iscsi-scst/kernel/iscsi.h index 582f27c12..72b7976cc 100644 --- a/iscsi-scst/kernel/iscsi.h +++ b/iscsi-scst/kernel/iscsi.h @@ -221,7 +221,7 @@ struct iscsi_conn { * All 2 protected by wr_lock. Modified independently to the * above field, hence the alignment. */ - unsigned short wr_state __attribute__((aligned(sizeof(long)))); + unsigned short wr_state __aligned(sizeof(long)); unsigned short wr_space_ready:1; struct list_head wr_list_entry; @@ -465,8 +465,7 @@ struct iscsi_cmnd { * modified independently to the above field, hence the * alignment. */ - int not_processed_rsp_cnt - __attribute__((aligned(sizeof(long)))); + int not_processed_rsp_cnt __aligned(sizeof(long)); }; /* Response only fields */ diff --git a/mvsas_tgt/mv_tgt.h b/mvsas_tgt/mv_tgt.h index 8da4f0923..fbbd0b3d1 100644 --- a/mvsas_tgt/mv_tgt.h +++ b/mvsas_tgt/mv_tgt.h @@ -83,7 +83,7 @@ extern unsigned long mvst_trace_flag; #define DEBUG(x) do {} while (0); #endif -#define BUFFER_PACKED __attribute__((packed)) +#define BUFFER_PACKED __packed #define MVST_TARGET_MAGIC 0xFFF1 #define MVST_INITIATOR_MAGIC 0xFFF2 diff --git a/qla2x00t/qla2x00-target/qla2x00t.h b/qla2x00t/qla2x00-target/qla2x00t.h index f7b308ba8..ad592f8c0 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.h +++ b/qla2x00t/qla2x00-target/qla2x00t.h @@ -221,7 +221,7 @@ struct q2t_cmd { union { atio7_entry_t atio7; atio_entry_t atio2x; - } __attribute__((packed)) atio; + } __packed atio; }; struct q2t_sess_work_param { @@ -249,7 +249,7 @@ struct q2t_mgmt_cmd { notify_entry_t notify_entry; notify24xx_entry_t notify_entry24; abts24_recv_entry_t abts; - } __attribute__((packed)) orig_iocb; + } __packed orig_iocb; }; struct q2t_prm { @@ -273,7 +273,7 @@ struct srr_imm { union { notify_entry_t notify_entry; notify24xx_entry_t notify_entry24; - } __attribute__((packed)) imm; + } __packed imm; }; struct srr_ctio { diff --git a/qla2x00t/qla2x_tgt_def.h b/qla2x00t/qla2x_tgt_def.h index 9c55a2753..8ff6b0182 100644 --- a/qla2x00t/qla2x_tgt_def.h +++ b/qla2x00t/qla2x_tgt_def.h @@ -149,7 +149,7 @@ typedef struct { uint16_t reserved_5; uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */ uint16_t reserved_6[20]; -} __attribute__((packed)) elun_entry_t; +} __packed elun_entry_t; #define ENABLE_LUN_SUCCESS 0x01 #define ENABLE_LUN_RC_NONZERO 0x04 #define ENABLE_LUN_INVALID_REQUEST 0x06 @@ -180,7 +180,7 @@ typedef struct { uint16_t reserved_5; uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */ uint16_t reserved_7[20]; -} __attribute__((packed)) modify_lun_entry_t; +} __packed modify_lun_entry_t; #define MODIFY_LUN_SUCCESS 0x01 #define MODIFY_LUN_CMD_ADD BIT_0 #define MODIFY_LUN_CMD_SUB BIT_1 @@ -220,7 +220,7 @@ typedef struct { uint16_t srr_ox_id; uint8_t reserved_2[30]; uint16_t ox_id; -} __attribute__((packed)) notify_entry_t; +} __packed notify_entry_t; #endif #ifndef NOTIFY_ACK_TYPE @@ -251,7 +251,7 @@ typedef struct { uint8_t srr_reject_code_expl; uint8_t reserved_2[26]; uint16_t ox_id; -} __attribute__((packed)) nack_entry_t; +} __packed nack_entry_t; #define NOTIFY_ACK_SRR_FLAGS_ACCEPT 0 #define NOTIFY_ACK_SRR_FLAGS_REJECT 1 @@ -288,7 +288,7 @@ typedef struct { uint8_t initiator_port_name[WWN_SIZE]; /* on qla23xx */ uint16_t reserved_32[6]; uint16_t ox_id; -} __attribute__((packed)) atio_entry_t; +} __packed atio_entry_t; #endif #ifndef CONTINUE_TGT_IO_TYPE @@ -315,7 +315,7 @@ typedef struct { uint16_t scsi_status; uint32_t transfer_length; uint32_t dseg_0_address[0]; -} __attribute__((packed)) ctio_common_entry_t; +} __packed ctio_common_entry_t; #define ATIO_PATH_INVALID 0x07 #define ATIO_CANT_PROV_CAP 0x16 #define ATIO_CDB_VALID 0x3D @@ -334,7 +334,7 @@ typedef struct { uint32_t dseg_1_length; /* Data segment 1 length. */ uint32_t dseg_2_address; /* Data segment 2 address. */ uint32_t dseg_2_length; /* Data segment 2 length. */ -} __attribute__((packed)) ctio_entry_t; +} __packed ctio_entry_t; #define CTIO_SUCCESS 0x01 #define CTIO_ABORTED 0x02 #define CTIO_INVALID_RX_ID 0x08 @@ -372,7 +372,7 @@ typedef struct { uint16_t scsi_status; uint16_t response_length; uint8_t sense_data[26]; -} __attribute__((packed)) ctio_ret_entry_t; +} __packed ctio_ret_entry_t; #endif #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ @@ -390,7 +390,7 @@ typedef struct { uint16_t ox_id; uint16_t rx_id; uint32_t parameter; -} __attribute__((packed)) fcp_hdr_t; +} __packed fcp_hdr_t; typedef struct { uint8_t d_id[3]; @@ -405,7 +405,7 @@ typedef struct { uint16_t rx_id; uint16_t ox_id; uint32_t parameter; -} __attribute__((packed)) fcp_hdr_le_t; +} __packed fcp_hdr_le_t; #define F_CTL_EXCH_CONTEXT_RESP BIT_23 #define F_CTL_SEQ_CONTEXT_RESIP BIT_22 @@ -450,7 +450,7 @@ typedef struct { */ uint8_t add_cdb[4]; /* uint32_t data_length; */ -} __attribute__((packed)) fcp_cmnd_t; +} __packed fcp_cmnd_t; /* * ISP queue - Accept Target I/O (ATIO) type 7 entry for 24xx structure @@ -471,7 +471,7 @@ typedef struct { #define ATIO_EXCHANGE_ADDRESS_UNKNOWN 0xFFFFFFFF fcp_hdr_t fcp_hdr; fcp_cmnd_t fcp_cmnd; -} __attribute__((packed)) atio7_entry_t; +} __packed atio7_entry_t; #define CTIO_TYPE7 0x12 /* Continue target I/O entry (for 24xx) */ @@ -495,7 +495,7 @@ typedef struct { uint8_t initiator_id[3]; uint8_t reserved; uint32_t exchange_addr; -} __attribute__((packed)) ctio7_common_entry_t; +} __packed ctio7_common_entry_t; typedef struct { ctio7_common_entry_t common; @@ -510,7 +510,7 @@ typedef struct { uint32_t reserved3; uint32_t dseg_0_address[2]; /* Data segment 0 address. */ uint32_t dseg_0_length; /* Data segment 0 length. */ -} __attribute__((packed)) ctio7_status0_entry_t; +} __packed ctio7_status0_entry_t; typedef struct { ctio7_common_entry_t common; @@ -522,7 +522,7 @@ typedef struct { uint16_t response_len; uint16_t reserved; uint8_t sense_data[24]; -} __attribute__((packed)) ctio7_status1_entry_t; +} __packed ctio7_status1_entry_t; typedef struct { uint8_t entry_type; /* Entry type. */ @@ -543,7 +543,7 @@ typedef struct { uint16_t reserved3; uint32_t relative_offset; uint8_t reserved4[24]; -} __attribute__((packed)) ctio7_fw_entry_t; +} __packed ctio7_fw_entry_t; /* CTIO7 flags values */ #define CTIO7_FLAGS_SEND_STATUS BIT_15 @@ -587,7 +587,7 @@ typedef struct { uint8_t reserved_6; uint16_t reserved_7; uint16_t ox_id; -} __attribute__((packed)) notify24xx_entry_t; +} __packed notify24xx_entry_t; #define ELS_PLOGI 0x3 #define ELS_FLOGI 0x4 @@ -625,7 +625,7 @@ typedef struct { uint8_t srr_reject_code; uint8_t reserved_5[7]; uint16_t ox_id; -} __attribute__((packed)) nack24xx_entry_t; +} __packed nack24xx_entry_t; /* * ISP queue - ABTS received/response entries structure definition for 24xx. @@ -653,7 +653,7 @@ typedef struct { fcp_hdr_le_t fcp_hdr_le; uint8_t reserved_4[16]; uint32_t exchange_addr_to_abort; -} __attribute__((packed)) abts24_recv_entry_t; +} __packed abts24_recv_entry_t; #define ABTS_PARAM_ABORT_SEQ BIT_0 @@ -667,7 +667,7 @@ typedef struct { uint16_t ox_id; uint16_t high_seq_cnt; uint16_t low_seq_cnt; -} __attribute__((packed)) ba_acc_le_t; +} __packed ba_acc_le_t; typedef struct { uint8_t vendor_uniq; @@ -676,7 +676,7 @@ typedef struct { #define BA_RJT_REASON_CODE_INVALID_COMMAND 0x1 #define BA_RJT_REASON_CODE_UNABLE_TO_PERFORM 0x9 uint8_t reserved; -} __attribute__((packed)) ba_rjt_le_t; +} __packed ba_rjt_le_t; typedef struct { uint8_t entry_type; /* Entry type. */ @@ -701,10 +701,10 @@ typedef struct { union { ba_acc_le_t ba_acct; ba_rjt_le_t ba_rjt; - } __attribute__((packed)) payload; + } __packed payload; uint32_t reserved_4; uint32_t exchange_addr_to_abort; -} __attribute__((packed)) abts24_resp_entry_t; +} __packed abts24_resp_entry_t; typedef struct { uint8_t entry_type; /* Entry type. */ @@ -732,7 +732,7 @@ typedef struct { #define ABTS_RESP_SUBCODE_ERR_ABORTED_EXCH_NOT_TERM 0x1E uint32_t error_subcode2; uint32_t exchange_addr_to_abort; -} __attribute__((packed)) abts24_resp_fw_entry_t; +} __packed abts24_resp_fw_entry_t; /********************************************************************\ * Type Definitions used by initiator & target halves diff --git a/scst/include/scst.h b/scst/include/scst.h index 8a570a68f..874507dbe 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -62,6 +62,11 @@ typedef _Bool bool; #define false 0 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21) && !defined(RHEL_MAJOR) +#define __packed __attribute__((packed)) +#define __aligned __attribute__((aligned)) +#endif + #ifdef INSIDE_KERNEL_TREE #include #else @@ -2274,7 +2279,7 @@ struct scst_device { ** below fields, hence the alignment. *************************************************************/ - unsigned int queue_alg:4 __attribute__((aligned(sizeof(long)))); + unsigned int queue_alg:4 __aligned(sizeof(long)); unsigned int tst:3; unsigned int tas:1; unsigned int swp:1; @@ -2316,7 +2321,7 @@ struct scst_device { * Set if dev is persistently reserved. Protected by dev_pr_mutex. * Modified independently to the above field, hence the alignment. */ - unsigned int pr_is_set:1 __attribute__((aligned(sizeof(long)))); + unsigned int pr_is_set:1 __aligned(sizeof(long)); /* * Set if there is a thread changing or going to change PR state(s). @@ -2346,7 +2351,7 @@ struct scst_device { * True if persist through power loss is activated. Modified * independently to the above field, hence the alignment. */ - unsigned short pr_aptpl:1 __attribute__((aligned(sizeof(long)))); + unsigned short pr_aptpl:1 __aligned(sizeof(long)); /* Persistent reservation type */ uint8_t pr_type; diff --git a/scst/include/scst_user.h b/scst/include/scst_user.h index 417ba54b3..e239be963 100644 --- a/scst/include/scst_user.h +++ b/scst/include/scst_user.h @@ -56,7 +56,7 @@ #define SCST_USER_MAX_PARTIAL_TRANSFERS_OPT \ SCST_USER_PARTIAL_TRANSFERS_SUPPORTED -#ifndef aligned_u64 +#ifndef __KERNEL__ #define aligned_u64 uint64_t __attribute__((aligned(8))) #endif