2016-08-16 21:42:15 +00:00
|
|
|
#include "iscsi/task.h"
|
|
|
|
#include "iscsi/iscsi.h"
|
|
|
|
#include "iscsi/conn.h"
|
2016-11-07 22:10:28 +00:00
|
|
|
|
2017-03-27 19:59:40 +00:00
|
|
|
#include "spdk/env.h"
|
2016-08-16 21:42:15 +00:00
|
|
|
#include "spdk/event.h"
|
|
|
|
|
2016-11-07 22:10:28 +00:00
|
|
|
#include "spdk_internal/log.h"
|
|
|
|
|
2017-05-03 19:41:55 +00:00
|
|
|
#include "scsi/scsi_internal.h"
|
|
|
|
|
2017-08-30 18:06:33 +00:00
|
|
|
SPDK_LOG_REGISTER_COMPONENT("iscsi", SPDK_LOG_ISCSI)
|
2016-08-16 21:42:15 +00:00
|
|
|
|
|
|
|
struct spdk_iscsi_task *
|
2017-06-08 20:45:41 +00:00
|
|
|
spdk_iscsi_task_get(struct spdk_iscsi_conn *conn,
|
|
|
|
struct spdk_iscsi_task *parent,
|
|
|
|
spdk_scsi_task_cpl cpl_fn)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
struct spdk_iscsi_task *task;
|
|
|
|
|
|
|
|
task = calloc(1, sizeof(*task));
|
|
|
|
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-28 06:49:06 +00:00
|
|
|
spdk_scsi_task_put(struct spdk_scsi_task *task)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
free(task);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
|
|
|
|
{
|
|
|
|
if (!pdu)
|
|
|
|
return;
|
|
|
|
|
2017-06-08 05:11:02 +00:00
|
|
|
pdu->ref--;
|
2016-08-16 21:42:15 +00:00
|
|
|
if (pdu->ref < 0) {
|
|
|
|
CU_FAIL("negative ref count");
|
|
|
|
pdu->ref = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pdu->ref == 0) {
|
2016-10-09 04:31:06 +00:00
|
|
|
if (pdu->data && !pdu->data_from_mempool) {
|
2016-08-16 21:42:15 +00:00
|
|
|
free(pdu->data);
|
|
|
|
}
|
|
|
|
free(pdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct spdk_iscsi_pdu *
|
|
|
|
spdk_get_pdu(void)
|
|
|
|
{
|
|
|
|
struct spdk_iscsi_pdu *pdu;
|
|
|
|
|
|
|
|
pdu = malloc(sizeof(*pdu));
|
|
|
|
if (!pdu) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-07-13 00:50:19 +00:00
|
|
|
memset(pdu, 0, offsetof(struct spdk_iscsi_pdu, ahs));
|
2016-08-16 21:42:15 +00:00
|
|
|
pdu->ref = 1;
|
|
|
|
|
|
|
|
return pdu;
|
|
|
|
}
|
|
|
|
|
2017-02-26 12:41:06 +00:00
|
|
|
void
|
|
|
|
spdk_scsi_task_process_null_lun(struct spdk_scsi_task *task)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-16 21:42:15 +00:00
|
|
|
void
|
|
|
|
spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
|
|
|
|
struct spdk_scsi_task *task)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
struct spdk_scsi_port *
|
|
|
|
spdk_scsi_dev_find_port_by_id(struct spdk_scsi_dev *dev, uint64_t id)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
spdk_scsi_dev_queue_mgmt_task(struct spdk_scsi_dev *dev,
|
2017-05-13 01:23:54 +00:00
|
|
|
struct spdk_scsi_task *task,
|
|
|
|
enum spdk_scsi_task_func func)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-12-05 06:42:37 +00:00
|
|
|
const char *
|
|
|
|
spdk_scsi_dev_get_name(const struct spdk_scsi_dev *dev)
|
|
|
|
{
|
|
|
|
if (dev != NULL) {
|
|
|
|
return dev->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-08-16 21:42:15 +00:00
|
|
|
uint32_t
|
2017-03-27 19:59:40 +00:00
|
|
|
spdk_env_get_current_core(void)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-05 01:24:18 +00:00
|
|
|
struct spdk_event *
|
2017-01-05 01:40:14 +00:00
|
|
|
spdk_event_allocate(uint32_t core, spdk_event_fn fn, void *arg1, void *arg2)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct spdk_scsi_dev *
|
|
|
|
spdk_scsi_dev_construct(const char *name, char **lun_name_list,
|
2017-06-28 10:21:21 +00:00
|
|
|
int *lun_id_list, int num_luns, uint8_t protocol_id,
|
|
|
|
void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
|
|
|
|
void *hotremove_ctx)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
spdk_scsi_dev_destruct(struct spdk_scsi_dev *dev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
spdk_scsi_dev_add_port(struct spdk_scsi_dev *dev, uint64_t id, const char *name)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match,
|
|
|
|
int drop_all)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-05 06:42:37 +00:00
|
|
|
int
|
|
|
|
spdk_scsi_dev_delete_port(struct spdk_scsi_dev *dev, uint64_t id)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-08-16 21:42:15 +00:00
|
|
|
void
|
|
|
|
spdk_shutdown_iscsi_conns(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-06-08 20:45:41 +00:00
|
|
|
spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
2017-06-08 20:45:41 +00:00
|
|
|
|
2016-08-16 21:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-06-08 20:45:41 +00:00
|
|
|
spdk_iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
2017-06-08 20:45:41 +00:00
|
|
|
|
2016-08-16 21:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
|
|
|
|
void *buf)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
spdk_scsi_dev_print(struct spdk_scsi_dev *dev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-10-28 19:56:36 +00:00
|
|
|
spdk_scsi_task_set_status(struct spdk_scsi_task *task, int sc, int sk, int asc, int ascq)
|
2016-08-16 21:42:15 +00:00
|
|
|
{
|
|
|
|
}
|
2016-11-22 19:47:04 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
spdk_scsi_task_set_data(struct spdk_scsi_task *task, void *data, uint32_t len)
|
|
|
|
{
|
|
|
|
task->iovs[0].iov_base = data;
|
|
|
|
task->iovs[0].iov_len = len;
|
|
|
|
}
|