mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-20 14:16:31 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -8,6 +8,3 @@ obj-$(CONFIG_TCM_QLA2XXX) += tcm_qla2xxx.o
|
||||
|
||||
ccflags-y += -I$(src)/../../../include/scst/
|
||||
ccflags-y += $(call cc-option,-Wno-format-truncation)
|
||||
|
||||
qla2x00tgt-objs := qla_tgt.o scst_qla2xxx.o
|
||||
obj-$(CONFIG_SCST_QLA_TGT_ADDON) += qla2x00tgt.o
|
||||
|
||||
@@ -43,13 +43,13 @@
|
||||
#include <scsi/scsi_tcq.h>
|
||||
|
||||
#include "qla_def.h"
|
||||
#include "scst_qla2xxx.h"
|
||||
|
||||
extern struct mutex qla_tgt_mutex;
|
||||
extern struct list_head qla_tgt_glist;
|
||||
|
||||
|
||||
static size_t
|
||||
qlt_add_vtarget(u64 port_name, u64 node_name, u64 parent_host)
|
||||
size_t qlt_add_vtarget(u64 port_name, u64 node_name, u64 parent_host)
|
||||
{
|
||||
struct Scsi_Host *shost = NULL;
|
||||
struct qla_tgt *tgt;
|
||||
@@ -89,7 +89,7 @@ qlt_add_vtarget(u64 port_name, u64 node_name, u64 parent_host)
|
||||
}
|
||||
EXPORT_SYMBOL(qlt_add_vtarget);
|
||||
|
||||
static size_t qlt_del_vtarget(u64 port_name)
|
||||
size_t qlt_del_vtarget(u64 port_name)
|
||||
{
|
||||
struct qla_tgt *tgt, *t;
|
||||
scsi_qla_host_t *vha = NULL;
|
||||
|
||||
@@ -309,8 +309,8 @@ static const int qla_tgt_supported_dif_block_size[]= {
|
||||
|
||||
static inline void qla_tgt_set_cmd_prot_op(struct qla_tgt_cmd *cmd, uint8_t xmit_rsp)
|
||||
{
|
||||
struct scst_cmd *scst_cmd = (struct scst_cmd *) cmd->se_cmd.priv;
|
||||
int dir = scst_cmd_get_data_direction(cmd->se_cmd.priv);
|
||||
struct scst_cmd *scst_cmd = cmd->scst_cmd;
|
||||
int dir = scst_cmd_get_data_direction(scst_cmd);
|
||||
int action = scst_get_dif_action(
|
||||
scst_get_tgt_dif_actions(scst_cmd->cmd_dif_actions));
|
||||
|
||||
@@ -481,6 +481,8 @@ static struct qla_tgt_cmd *sqa_qla2xxx_get_cmd(struct fc_port *sess)
|
||||
memset(cmd, 0, sizeof(struct qla_tgt_cmd));
|
||||
#if QLT_USE_PERCPU_IDA || QLT_USE_SBITMAP
|
||||
cmd->se_cmd.map_tag = tag;
|
||||
#else
|
||||
cmd->map_tag = tag;
|
||||
#endif
|
||||
#if QLT_USE_SBITMAP
|
||||
cmd->se_cmd.map_cpu = cpu;
|
||||
@@ -545,10 +547,10 @@ static int sqa_qla2xxx_handle_cmd(scsi_qla_host_t *vha,
|
||||
vha->host_no, vha->vp_idx, data_length, task_codes,
|
||||
data_dir, bidi, cmd->unpacked_lun,
|
||||
atio->u.isp24.fcp_cmnd.cdb[0],
|
||||
atio->u.isp24.exchange_addr, cmd, cmd->se_cmd.priv);
|
||||
atio->u.isp24.exchange_addr, cmd, cmd->scst_cmd);
|
||||
|
||||
|
||||
cmd->se_cmd.priv = scst_rx_cmd(scst_sess,
|
||||
cmd->scst_cmd = scst_rx_cmd(scst_sess,
|
||||
(uint8_t *)&atio->u.isp24.fcp_cmnd.lun,
|
||||
sizeof(atio->u.isp24.fcp_cmnd.lun),
|
||||
atio->u.isp24.fcp_cmnd.cdb,
|
||||
@@ -556,15 +558,15 @@ static int sqa_qla2xxx_handle_cmd(scsi_qla_host_t *vha,
|
||||
(atio->u.isp24.fcp_cmnd.add_cdb_len *4),
|
||||
SCST_ATOMIC);
|
||||
|
||||
if (cmd->se_cmd.priv == NULL) {
|
||||
if (cmd->scst_cmd == NULL) {
|
||||
PRINT_ERROR("sqatgt(%ld/%d): scst_rx_cmd function failed.",
|
||||
vha->host_no, vha->vp_idx);
|
||||
res = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
scst_cmd_set_tag(cmd->se_cmd.priv, atio->u.isp24.exchange_addr);
|
||||
scst_cmd_set_tgt_priv(cmd->se_cmd.priv, cmd);
|
||||
scst_cmd_set_tag(cmd->scst_cmd, atio->u.isp24.exchange_addr);
|
||||
scst_cmd_set_tgt_priv(cmd->scst_cmd, cmd);
|
||||
|
||||
if (atio->u.isp24.fcp_cmnd.rddata && atio->u.isp24.fcp_cmnd.wrdata)
|
||||
dir = SCST_DATA_BIDI;
|
||||
@@ -574,35 +576,34 @@ static int sqa_qla2xxx_handle_cmd(scsi_qla_host_t *vha,
|
||||
dir = SCST_DATA_WRITE;
|
||||
else
|
||||
dir = SCST_DATA_NONE;
|
||||
scst_cmd_set_expected(cmd->se_cmd.priv, dir, data_length);
|
||||
scst_cmd_set_expected(cmd->scst_cmd, dir, data_length);
|
||||
|
||||
/* task_code fr arg list is based on TCM #define. */
|
||||
switch (atio->u.isp24.fcp_cmnd.task_attr) {
|
||||
case ATIO_SIMPLE_QUEUE:
|
||||
scst_cmd_set_queue_type(cmd->se_cmd.priv,
|
||||
SCST_CMD_QUEUE_SIMPLE);
|
||||
scst_cmd_set_queue_type(cmd->scst_cmd, SCST_CMD_QUEUE_SIMPLE);
|
||||
break;
|
||||
case ATIO_HEAD_OF_QUEUE:
|
||||
scst_cmd_set_queue_type(cmd->se_cmd.priv,
|
||||
scst_cmd_set_queue_type(cmd->scst_cmd,
|
||||
SCST_CMD_QUEUE_HEAD_OF_QUEUE);
|
||||
break;
|
||||
case ATIO_ORDERED_QUEUE:
|
||||
scst_cmd_set_queue_type(cmd->se_cmd.priv,
|
||||
scst_cmd_set_queue_type(cmd->scst_cmd,
|
||||
SCST_CMD_QUEUE_ORDERED);
|
||||
break;
|
||||
case ATIO_ACA_QUEUE:
|
||||
scst_cmd_set_queue_type(cmd->se_cmd.priv,
|
||||
scst_cmd_set_queue_type(cmd->scst_cmd,
|
||||
SCST_CMD_QUEUE_ACA);
|
||||
break;
|
||||
case ATIO_UNTAGGED:
|
||||
scst_cmd_set_queue_type(cmd->se_cmd.priv,
|
||||
scst_cmd_set_queue_type(cmd->scst_cmd,
|
||||
SCST_CMD_QUEUE_UNTAGGED);
|
||||
break;
|
||||
default:
|
||||
PRINT_ERROR("sqatgt(%ld/%d): unknown task code %x, use "
|
||||
"ORDERED instead.", vha->host_no, vha->vp_idx,
|
||||
atio->u.isp24.fcp_cmnd.task_attr);
|
||||
scst_cmd_set_queue_type(cmd->se_cmd.priv,
|
||||
scst_cmd_set_queue_type(cmd->scst_cmd,
|
||||
SCST_CMD_QUEUE_ORDERED);
|
||||
break;
|
||||
}
|
||||
@@ -610,10 +611,10 @@ static int sqa_qla2xxx_handle_cmd(scsi_qla_host_t *vha,
|
||||
TRACE(TRACE_SCSI, "sqatgt(%ld/%d): START Command=%p tag=%d, "
|
||||
"queue type=%x", vha->host_no, vha->vp_idx, cmd,
|
||||
cmd->atio.u.isp24.exchange_addr,
|
||||
scst_cmd_get_queue_type(cmd->se_cmd.priv));
|
||||
scst_cmd_get_queue_type(cmd->scst_cmd));
|
||||
|
||||
/* we're being call by wq, so do direct */
|
||||
scst_cmd_init_done(cmd->se_cmd.priv, SCST_CONTEXT_DIRECT);
|
||||
scst_cmd_init_done(cmd->scst_cmd, SCST_CONTEXT_DIRECT);
|
||||
|
||||
out:
|
||||
TRACE_EXIT_RES(res);
|
||||
@@ -622,7 +623,7 @@ static int sqa_qla2xxx_handle_cmd(scsi_qla_host_t *vha,
|
||||
|
||||
static void sqa_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
|
||||
{
|
||||
struct scst_cmd *scst_cmd = (struct scst_cmd *)cmd->se_cmd.priv;
|
||||
struct scst_cmd *scst_cmd = cmd->scst_cmd;
|
||||
int rx_status;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -800,7 +801,7 @@ static int sqa_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, u64 lun,
|
||||
|
||||
static void sqa_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
|
||||
{
|
||||
struct scst_cmd *scst_cmd = cmd->se_cmd.priv;
|
||||
struct scst_cmd *scst_cmd = cmd->scst_cmd;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -920,24 +921,12 @@ static void sqa_scst_session_cb(struct scst_session *scst_sess,
|
||||
static struct se_session *sqa_alloc_sesess(scsi_qla_host_t *vha)
|
||||
{
|
||||
struct se_session *se_sess;
|
||||
|
||||
/*
|
||||
* The following is open coded from:
|
||||
*
|
||||
* target_core_transport:transport_init_session()
|
||||
*
|
||||
* For now we simply allocate a single page to hold the session
|
||||
* structure. This needs to be modified to use the slab cache.
|
||||
*/
|
||||
se_sess = kzalloc(sizeof(*se_sess), GFP_KERNEL);
|
||||
if (!se_sess)
|
||||
return NULL;
|
||||
|
||||
INIT_LIST_HEAD(&se_sess->sess_list);
|
||||
INIT_LIST_HEAD(&se_sess->sess_acl_list);
|
||||
INIT_LIST_HEAD(&se_sess->sess_cmd_list);
|
||||
spin_lock_init(&se_sess->sess_cmd_lock);
|
||||
|
||||
return se_sess;
|
||||
return kzalloc(sizeof(*se_sess), GFP_KERNEL);
|
||||
}
|
||||
|
||||
static void sqa_free_sesess(struct se_session *se_sess)
|
||||
@@ -1694,16 +1683,14 @@ static int sqa_xmit_response(struct scst_cmd *scst_cmd)
|
||||
EXTRACHECKS_BUG_ON(scst_cmd_atomic(scst_cmd));
|
||||
#endif
|
||||
if (is_send_status) {
|
||||
const u8* const sense_buf = scst_cmd_get_sense_buffer(scst_cmd);
|
||||
u16 len = scst_cmd_get_sense_buffer_len(scst_cmd);
|
||||
|
||||
xmit_type |= QLA_TGT_XMIT_STATUS;
|
||||
|
||||
if (QLA_TGT_SENSE_VALID(scst_cmd_get_sense_buffer(scst_cmd))) {
|
||||
if (len > TRANSPORT_SENSE_BUFFER ||
|
||||
len == 0)
|
||||
if (QLA_TGT_SENSE_VALID(sense_buf)) {
|
||||
if (len > TRANSPORT_SENSE_BUFFER || len == 0)
|
||||
len = TRANSPORT_SENSE_BUFFER;
|
||||
|
||||
memcpy(cmd->sense_buffer,
|
||||
scst_cmd_get_sense_buffer(scst_cmd), len);
|
||||
memcpy(cmd->sense_buffer, sense_buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1730,7 +1717,7 @@ static int sqa_xmit_response(struct scst_cmd *scst_cmd)
|
||||
|
||||
TRACE_DBG("cmd[%p] ulpcmd[%p] dif_actions=0x%x, cdb=0x%x, prot_sg[%p] "
|
||||
"prot_sg_cnt[%x], prot_type[%x] prot_op[%x]",
|
||||
cmd, cmd->se_cmd.priv, scst_cmd->cmd_dif_actions, scst_cmd->cdb_buf[0],
|
||||
cmd, cmd->scst_cmd, scst_cmd->cmd_dif_actions, scst_cmd->cdb_buf[0],
|
||||
cmd->prot_sg, cmd->prot_sg_cnt, cmd->se_cmd.prot_type,
|
||||
cmd->se_cmd.prot_op);
|
||||
|
||||
@@ -1817,7 +1804,7 @@ static int sqa_rdy_to_xfer(struct scst_cmd *scst_cmd)
|
||||
|
||||
TRACE_DBG("%s: cmd[%p] ulpcmd[%p] dif_actions=0x%x, cdb=0x%x, "
|
||||
"prot_sg_cnt[%x], prot_type[%x] prot_op[%x], bufflen[%x]",__func__,
|
||||
cmd, cmd->se_cmd.priv,
|
||||
cmd, cmd->scst_cmd,
|
||||
scst_cmd->cmd_dif_actions, scst_cmd->cdb_buf[0],
|
||||
cmd->prot_sg_cnt, cmd->se_cmd.prot_type, cmd->se_cmd.prot_op,
|
||||
cmd->bufflen);
|
||||
@@ -2342,7 +2329,7 @@ sqa_qla2xxx_chk_dif_tags(uint32_t tag)
|
||||
static int
|
||||
sqa_qla2xxx_dif_tags(struct qla_tgt_cmd *cmd, uint16_t *pfw_prot_opts)
|
||||
{
|
||||
struct scst_cmd *scst_cmd = (struct scst_cmd *)cmd->se_cmd.priv;
|
||||
struct scst_cmd *scst_cmd = cmd->scst_cmd;
|
||||
uint32_t t32=0;
|
||||
|
||||
t32 = scst_get_dif_checks(scst_cmd->cmd_dif_actions);
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/bsg-lib.h>
|
||||
|
||||
#ifndef NEW_LIBFC_API
|
||||
#ifdef NEW_LIBFC_API
|
||||
#include <linux/bsg-lib.h>
|
||||
#else
|
||||
static inline struct Scsi_Host *fc_bsg_to_shost(struct fc_bsg_job *job)
|
||||
{
|
||||
return job->shost;
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#define __QLA_FW_H
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(RHEL_MAJOR)
|
||||
#include <linux/nvme.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#include <linux/nvme-fc.h>
|
||||
#endif
|
||||
|
||||
@@ -293,8 +293,6 @@ extern int qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *, srb_t *,
|
||||
uint32_t *, uint16_t, struct qla_tgt_cmd *);
|
||||
extern int qla24xx_get_one_block_sg(uint32_t, struct qla2_sgx *, uint32_t *);
|
||||
extern int qla24xx_configure_prot_mode(srb_t *, uint16_t *);
|
||||
extern int qla24xx_build_scsi_crc_2_iocbs(srb_t *,
|
||||
struct cmd_type_crc_2 *, uint16_t, uint16_t, uint16_t);
|
||||
|
||||
/*
|
||||
* Global Function Prototypes in qla_mbx.c source file.
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <asm/prom.h>
|
||||
#endif
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include "qla_target.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -1396,6 +1396,8 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
|
||||
*cur_dsd++ = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* qla24xx_build_scsi_crc_2_iocbs() - Build IOCB command utilizing Command
|
||||
* Type 6 IOCB types.
|
||||
@@ -1406,7 +1408,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
|
||||
* @tot_prot_dsds: Total number of segments with protection information
|
||||
* @fw_prot_opts: Protection options to be passed to firmware
|
||||
*/
|
||||
inline int
|
||||
static inline int
|
||||
qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
|
||||
uint16_t tot_dsds, uint16_t tot_prot_dsds, uint16_t fw_prot_opts)
|
||||
{
|
||||
@@ -1590,12 +1592,16 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
|
||||
goto crc_queuing_error;
|
||||
|
||||
if (bundling && tot_prot_dsds) {
|
||||
#if QLA_ENABLE_PI
|
||||
/* Walks dif segments */
|
||||
cmd_pkt->control_flags |= cpu_to_le16(CF_DIF_SEG_DESCR_ENABLE);
|
||||
cur_dsd = (uint32_t *) &crc_ctx_pkt->u.bundling.dif_address;
|
||||
if (qla24xx_walk_and_build_prot_sglist(ha, sp, cur_dsd,
|
||||
tot_prot_dsds, NULL))
|
||||
goto crc_queuing_error;
|
||||
#else
|
||||
WARN_ON_ONCE(true);
|
||||
#endif
|
||||
}
|
||||
return QLA_SUCCESS;
|
||||
|
||||
@@ -1604,7 +1610,6 @@ crc_queuing_error:
|
||||
|
||||
return QLA_FUNCTION_FAILED;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* qla24xx_start_scsi() - Send a SCSI command to the ISP
|
||||
|
||||
@@ -3495,7 +3495,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL_MAJOR)
|
||||
ret = pci_enable_msix(ha->pdev, entries, ha->msix_count);
|
||||
if (ret) {
|
||||
if (ret < QLA_BASE_VECTORS)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/bsg-lib.h>
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <linux/utsname.h>
|
||||
|
||||
|
||||
@@ -924,9 +924,6 @@ qla2xxx_qpair_sp_compl(void *ptr, int res)
|
||||
cmd->scsi_done(cmd);
|
||||
}
|
||||
|
||||
/* If we are SP1 here, we need to still take and release the host_lock as SP1
|
||||
* does not have the changes necessary to avoid taking host->host_lock.
|
||||
*/
|
||||
static int
|
||||
qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
|
||||
{
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
|
||||
#include "qla_def.h"
|
||||
#include "qla_target.h"
|
||||
@@ -163,6 +161,7 @@ struct kmem_cache *qla_tgt_plogi_cachep;
|
||||
static mempool_t *qla_tgt_mgmt_cmd_mempool;
|
||||
static struct workqueue_struct *qla_tgt_wq;
|
||||
DEFINE_MUTEX(qla_tgt_mutex);
|
||||
EXPORT_SYMBOL(qla_tgt_mutex);
|
||||
LIST_HEAD(qla_tgt_glist);
|
||||
EXPORT_SYMBOL(qla_tgt_glist);
|
||||
|
||||
@@ -3528,6 +3527,7 @@ out_unlock_free_unmap:
|
||||
EXPORT_SYMBOL(qlt_rdy_to_xfer);
|
||||
|
||||
|
||||
#if QLA_ENABLE_PI
|
||||
/*
|
||||
* it is assumed either hardware_lock or qpair lock is held.
|
||||
*/
|
||||
@@ -3630,6 +3630,14 @@ out:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void
|
||||
qlt_handle_dif_error(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd,
|
||||
struct ctio_crc_from_fw *sts)
|
||||
{
|
||||
WARN_ON_ONCE(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If hardware_lock held on entry, might drop it, then reaquire */
|
||||
/* This function sends the appropriate CTIO to ISP 2xxx or 24xx */
|
||||
@@ -3885,10 +3893,8 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd)
|
||||
* 1) XFER Rdy completion + CMD_T_ABORT
|
||||
* 2) TCM TMR - drain_state_list
|
||||
*/
|
||||
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf016,
|
||||
"multiple abort. %p transport_state %x, t_state %x, "
|
||||
"se_cmd_flags %x\n", cmd, cmd->se_cmd.transport_state,
|
||||
cmd->se_cmd.t_state, cmd->se_cmd.se_cmd_flags);
|
||||
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf016, "multiple abort. %p\n",
|
||||
cmd);
|
||||
return EIO;
|
||||
}
|
||||
cmd->aborted = 1;
|
||||
|
||||
@@ -899,6 +899,7 @@ struct qla_tgt_cmd {
|
||||
uint8_t cmd_type;
|
||||
uint8_t pad[7];
|
||||
struct se_cmd se_cmd;
|
||||
struct scst_cmd *scst_cmd;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
|
||||
/*
|
||||
* Used if neither <linux/bitmap.h> nor <linux/percpu_ida.h> are
|
||||
|
||||
@@ -322,7 +322,7 @@ index d6d65537b0d9..6aad8308a0ac 100644
|
||||
EOF
|
||||
fi
|
||||
case "$1" in
|
||||
2.6.3[6-9]*|3.[0-9].*|3.1[01345].*|3.17.*|3.19.*|4.[023567].*)
|
||||
2.6.3[6-9]*|3.[0-9]|3.[0-9].*|3.1[01345]|3.1[01345].*|3.17|3.17.*|3.19|3.19.*|4.[023567]|4.[023567].*)
|
||||
patch -p1 <<'EOF'
|
||||
From c6a385539175ebc603da53aafb7753d39089f32e Mon Sep 17 00:00:00 2001
|
||||
From: Borislav Petkov <bp@suse.de>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <linux/stddef.h> /* sizeof_field() */
|
||||
#include <linux/timer.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/writeback.h> /* sync_page_range() */
|
||||
#include <rdma/ib_verbs.h>
|
||||
#include <scsi/scsi_cmnd.h> /* struct scsi_cmnd */
|
||||
@@ -531,6 +532,25 @@ static inline struct io_context *get_task_io_context(struct task_struct *task,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/kconfig.h> */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) && !defined(RHEL_MAJOR)
|
||||
/*
|
||||
* See also commit 2a11c8ea20bf ("kconfig: Introduce IS_ENABLED(), IS_BUILTIN()
|
||||
* and IS_MODULE()") # v3.1.
|
||||
*/
|
||||
#define __ARG_PLACEHOLDER_1 0,
|
||||
#define __take_second_arg(__ignored, val, ...) val
|
||||
#define __or(x, y) ___or(x, y)
|
||||
#define ___or(x, y) ____or(__ARG_PLACEHOLDER_##x, y)
|
||||
#define ____or(arg1_or_junk, y) __take_second_arg(arg1_or_junk 1, y)
|
||||
#define __is_defined(x) ___is_defined(x)
|
||||
#define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val)
|
||||
#define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0)
|
||||
#define IS_BUILTIN(option) __is_defined(option)
|
||||
#define IS_MODULE(option) __is_defined(option##_MODULE)
|
||||
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
|
||||
#endif
|
||||
|
||||
/* <linux/kernel.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
|
||||
@@ -1456,6 +1476,22 @@ static inline void *vzalloc(unsigned long size)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/workqueue.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
/*
|
||||
* See also commit d320c03830b1 ("workqueue: s/__create_workqueue()/
|
||||
* alloc_workqueue()/, and add system workqueues") # v2.6.36.
|
||||
*/
|
||||
static inline struct workqueue_struct *alloc_workqueue(const char *fmt,
|
||||
unsigned int flags,
|
||||
int max_active, ...)
|
||||
{
|
||||
WARN_ON_ONCE(flags | max_active);
|
||||
return create_workqueue(fmt);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <scsi/scsi_cmnd.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) || \
|
||||
|
||||
Reference in New Issue
Block a user