Change __attribute__((packed)) into __packed and

__attribute__((aligned(x))) into __aligned(x) in kernel code since
checkpatch complains about the former.

BSD-signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3952 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2011-12-06 03:02:13 +00:00
parent 1bbf50a530
commit 69d8c2fbd7
6 changed files with 69 additions and 38 deletions

View File

@@ -17,8 +17,11 @@
#ifndef _ISCSI_SCST_U_H
#define _ISCSI_SCST_U_H
#ifndef __KERNEL__
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <sys/uio.h>
#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

View File

@@ -220,7 +220,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;
@@ -463,8 +463,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 */

View File

@@ -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

View File

@@ -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
@@ -439,7 +439,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
@@ -455,7 +455,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) */
@@ -479,7 +479,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;
@@ -494,7 +494,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;
@@ -506,7 +506,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. */
@@ -527,7 +527,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
@@ -571,7 +571,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
@@ -609,7 +609,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.
@@ -632,7 +632,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
@@ -646,7 +646,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;
@@ -655,7 +655,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. */
@@ -675,10 +675,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. */
@@ -701,7 +701,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

View File

@@ -66,8 +66,9 @@ typedef _Bool bool;
#define false 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
#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
@@ -2260,7 +2261,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;
@@ -2302,7 +2303,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).
@@ -2332,7 +2333,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;
@@ -4190,6 +4191,38 @@ if (!(condition)) { \
finish_wait(&(wq), &__wait); \
}
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5
static inline uint16_t get_unaligned_be16(const void *p)
{
return be16_to_cpu(get_unaligned((__be16 *)p));
}
static inline void put_unaligned_be16(uint16_t i, void *p)
{
put_unaligned(cpu_to_be16(i), (__be16 *)p);
}
static inline uint32_t get_unaligned_be32(const void *p)
{
return be32_to_cpu(get_unaligned((__be32 *)p));
}
static inline void put_unaligned_be32(uint32_t i, void *p)
{
put_unaligned(cpu_to_be32(i), (__be32 *)p);
}
static inline uint64_t get_unaligned_be64(const void *p)
{
return be64_to_cpu(get_unaligned((__be64 *)p));
}
static inline void put_unaligned_be64(uint64_t i, void *p)
{
put_unaligned(cpu_to_be64(i), (__be64 *)p);
}
#endif
/* Only use get_unaligned_be24() if reading p - 1 is allowed. */
static inline uint32_t get_unaligned_be24(const uint8_t *const p)
{

View File

@@ -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