nvmf: change nvmf_session to spdk_nvmf_session

Make the structure definition consistent

Change-Id: If147066cee041a2a357bc7efcb1f882f914e5b42
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-09-26 15:11:07 +08:00 committed by Daniel Verkamp
parent 658faa3d25
commit b1e3279ae0
12 changed files with 61 additions and 61 deletions

View File

@ -40,7 +40,7 @@
#include "spdk/trace.h"
static void
nvmf_direct_ctrlr_get_data(struct nvmf_session *session)
nvmf_direct_ctrlr_get_data(struct spdk_nvmf_session *session)
{
const struct spdk_nvme_ctrlr_data *cdata;
@ -49,7 +49,7 @@ nvmf_direct_ctrlr_get_data(struct nvmf_session *session)
}
static void
nvmf_direct_ctrlr_poll_for_completions(struct nvmf_session *session)
nvmf_direct_ctrlr_poll_for_completions(struct spdk_nvmf_session *session)
{
spdk_nvme_ctrlr_process_admin_completions(session->subsys->dev.direct.ctrlr);
spdk_nvme_qpair_process_completions(session->subsys->dev.direct.io_qpair, 0);
@ -104,7 +104,7 @@ nvmf_direct_ctrlr_admin_identify_nslist(struct spdk_nvme_ctrlr *ctrlr,
static int
nvmf_direct_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req)
{
struct nvmf_session *session = req->conn->sess;
struct spdk_nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
struct spdk_nvmf_subsystem *subsystem = session->subsys;

View File

@ -737,7 +737,7 @@ static int
nvmf_rdma_disconnect(struct rdma_cm_event *evt)
{
struct spdk_nvmf_conn *conn;
struct nvmf_session *session;
struct spdk_nvmf_session *session;
struct spdk_nvmf_subsystem *subsystem;
struct spdk_nvmf_rdma_conn *rdma_conn;
@ -1056,7 +1056,7 @@ spdk_nvmf_rdma_acceptor_fini(void)
}
static int
spdk_nvmf_rdma_session_init(struct nvmf_session *session, struct spdk_nvmf_conn *conn)
spdk_nvmf_rdma_session_init(struct spdk_nvmf_session *session, struct spdk_nvmf_conn *conn)
{
struct spdk_nvmf_rdma_session *rdma_sess;
struct spdk_nvmf_rdma_conn *rdma_conn = get_rdma_conn(conn);
@ -1106,7 +1106,7 @@ spdk_nvmf_rdma_session_init(struct nvmf_session *session, struct spdk_nvmf_conn
}
static void
spdk_nvmf_rdma_session_fini(struct nvmf_session *session)
spdk_nvmf_rdma_session_fini(struct spdk_nvmf_session *session)
{
struct spdk_nvmf_rdma_session *rdma_sess = session->trctx;

View File

@ -69,7 +69,7 @@ spdk_nvmf_request_complete(struct spdk_nvmf_request *req)
static spdk_nvmf_request_exec_status
nvmf_process_discovery_cmd(struct spdk_nvmf_request *req)
{
struct nvmf_session *session = req->conn->sess;
struct spdk_nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
struct spdk_nvmf_discovery_log_page *log;
@ -317,7 +317,7 @@ nvmf_trace_command(union nvmf_h2c_msg *h2c_msg, enum conn_type conn_type)
int
spdk_nvmf_request_exec(struct spdk_nvmf_request *req)
{
struct nvmf_session *session = req->conn->sess;
struct spdk_nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
spdk_nvmf_request_exec_status status;

View File

@ -44,7 +44,7 @@
#include "spdk/nvme_spec.h"
static void
nvmf_init_discovery_session_properties(struct nvmf_session *session)
nvmf_init_discovery_session_properties(struct spdk_nvmf_session *session)
{
session->vcdata.maxcmd = g_nvmf_tgt.max_queue_depth;
/* extended data for get log page supportted */
@ -83,7 +83,7 @@ nvmf_init_discovery_session_properties(struct nvmf_session *session)
}
static void
nvmf_init_nvme_session_properties(struct nvmf_session *session)
nvmf_init_nvme_session_properties(struct spdk_nvmf_session *session)
{
assert((g_nvmf_tgt.max_io_size % 4096) == 0);
@ -156,7 +156,7 @@ nvmf_init_nvme_session_properties(struct nvmf_session *session)
session->vcprop.csts.raw);
}
static void session_destruct(struct nvmf_session *session)
static void session_destruct(struct spdk_nvmf_session *session)
{
session->subsys->session = NULL;
session->transport->session_fini(session);
@ -164,7 +164,7 @@ static void session_destruct(struct nvmf_session *session)
}
void
spdk_nvmf_session_destruct(struct nvmf_session *session)
spdk_nvmf_session_destruct(struct spdk_nvmf_session *session)
{
while (!TAILQ_EMPTY(&session->connections)) {
struct spdk_nvmf_conn *conn = TAILQ_FIRST(&session->connections);
@ -192,7 +192,7 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
struct spdk_nvmf_fabric_connect_data *data,
struct spdk_nvmf_fabric_connect_rsp *rsp)
{
struct nvmf_session *session;
struct spdk_nvmf_session *session;
struct spdk_nvmf_subsystem *subsystem;
#define INVALID_CONNECT_CMD(field) invalid_connect_response(rsp, 0, offsetof(struct spdk_nvmf_fabric_connect_cmd, field))
@ -253,7 +253,7 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
}
/* Establish a new session */
subsystem->session = session = calloc(1, sizeof(struct nvmf_session));
subsystem->session = session = calloc(1, sizeof(struct spdk_nvmf_session));
if (session == NULL) {
SPDK_ERRLOG("Memory allocation failure\n");
rsp->status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
@ -332,7 +332,7 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
void
spdk_nvmf_session_disconnect(struct spdk_nvmf_conn *conn)
{
struct nvmf_session *session = conn->sess;
struct spdk_nvmf_session *session = conn->sess;
assert(session != NULL);
session->num_connections--;
@ -345,25 +345,25 @@ spdk_nvmf_session_disconnect(struct spdk_nvmf_conn *conn)
}
static uint64_t
nvmf_prop_get_cap(struct nvmf_session *session)
nvmf_prop_get_cap(struct spdk_nvmf_session *session)
{
return session->vcprop.cap.raw;
}
static uint64_t
nvmf_prop_get_vs(struct nvmf_session *session)
nvmf_prop_get_vs(struct spdk_nvmf_session *session)
{
return session->vcprop.vs.raw;
}
static uint64_t
nvmf_prop_get_cc(struct nvmf_session *session)
nvmf_prop_get_cc(struct spdk_nvmf_session *session)
{
return session->vcprop.cc.raw;
}
static bool
nvmf_prop_set_cc(struct nvmf_session *session, uint64_t value)
nvmf_prop_set_cc(struct spdk_nvmf_session *session, uint64_t value)
{
union spdk_nvme_cc_register cc, diff;
@ -432,7 +432,7 @@ nvmf_prop_set_cc(struct nvmf_session *session, uint64_t value)
}
static uint64_t
nvmf_prop_get_csts(struct nvmf_session *session)
nvmf_prop_get_csts(struct spdk_nvmf_session *session)
{
return session->vcprop.csts.raw;
}
@ -441,8 +441,8 @@ struct nvmf_prop {
uint32_t ofst;
uint8_t size;
char name[11];
uint64_t (*get_cb)(struct nvmf_session *session);
bool (*set_cb)(struct nvmf_session *session, uint64_t value);
uint64_t (*get_cb)(struct spdk_nvmf_session *session);
bool (*set_cb)(struct spdk_nvmf_session *session, uint64_t value);
};
#define PROP(field, size, get_cb, set_cb) \
@ -477,7 +477,7 @@ find_prop(uint32_t ofst)
}
void
spdk_nvmf_property_get(struct nvmf_session *session,
spdk_nvmf_property_get(struct spdk_nvmf_session *session,
struct spdk_nvmf_fabric_prop_get_cmd *cmd,
struct spdk_nvmf_fabric_prop_get_rsp *response)
{
@ -515,7 +515,7 @@ spdk_nvmf_property_get(struct nvmf_session *session,
}
void
spdk_nvmf_property_set(struct nvmf_session *session,
spdk_nvmf_property_set(struct spdk_nvmf_session *session,
struct spdk_nvmf_fabric_prop_set_cmd *cmd,
struct spdk_nvme_cpl *response)
{
@ -553,7 +553,7 @@ spdk_nvmf_property_set(struct nvmf_session *session,
}
int
spdk_nvmf_session_poll(struct nvmf_session *session)
spdk_nvmf_session_poll(struct spdk_nvmf_session *session)
{
struct spdk_nvmf_conn *conn, *tmp;

View File

@ -52,7 +52,7 @@ enum conn_type {
struct spdk_nvmf_conn {
const struct spdk_nvmf_transport *transport;
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
enum conn_type type;
uint16_t sq_head;
@ -66,7 +66,7 @@ struct spdk_nvmf_conn {
* state. Each NVMf session permits some number of connections.
* At least one admin connection and additional IOQ connections.
*/
struct nvmf_session {
struct spdk_nvmf_session {
struct spdk_nvmf_subsystem *subsys;
struct {
@ -97,17 +97,17 @@ void
spdk_nvmf_session_disconnect(struct spdk_nvmf_conn *conn);
void
spdk_nvmf_property_get(struct nvmf_session *session,
spdk_nvmf_property_get(struct spdk_nvmf_session *session,
struct spdk_nvmf_fabric_prop_get_cmd *cmd,
struct spdk_nvmf_fabric_prop_get_rsp *response);
void
spdk_nvmf_property_set(struct nvmf_session *session,
spdk_nvmf_property_set(struct spdk_nvmf_session *session,
struct spdk_nvmf_fabric_prop_set_cmd *cmd,
struct spdk_nvme_cpl *rsp);
int spdk_nvmf_session_poll(struct nvmf_session *session);
int spdk_nvmf_session_poll(struct spdk_nvmf_session *session);
void spdk_nvmf_session_destruct(struct nvmf_session *session);
void spdk_nvmf_session_destruct(struct spdk_nvmf_session *session);
#endif

View File

@ -76,7 +76,7 @@ nvmf_find_subsystem(const char *subnqn, const char *hostnqn)
void
spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem)
{
struct nvmf_session *session = subsystem->session;
struct spdk_nvmf_session *session = subsystem->session;
if (!session) {
/* No active connections, so just return */

View File

@ -43,7 +43,7 @@
struct spdk_nvmf_conn;
struct spdk_nvmf_subsystem;
struct spdk_nvmf_request;
struct nvmf_session;
struct spdk_nvmf_session;
#define MAX_VIRTUAL_NAMESPACE 16
#define MAX_SN_LEN 20
@ -69,7 +69,7 @@ struct spdk_nvmf_ctrlr_ops {
/**
* Get NVMe identify controller data.
*/
void (*ctrlr_get_data)(struct nvmf_session *session);
void (*ctrlr_get_data)(struct spdk_nvmf_session *session);
/**
* Process admin command.
@ -84,7 +84,7 @@ struct spdk_nvmf_ctrlr_ops {
/**
* Poll for completions.
*/
void (*poll_for_completions)(struct nvmf_session *session);
void (*poll_for_completions)(struct spdk_nvmf_session *session);
/**
* Detach the controller.
@ -106,7 +106,7 @@ struct spdk_nvmf_subsystem {
char subnqn[SPDK_NVMF_NQN_MAX_LEN];
enum spdk_nvmf_subsystem_mode mode;
enum spdk_nvmf_subtype subtype;
struct nvmf_session *session;
struct spdk_nvmf_session *session;
union {
struct {

View File

@ -36,7 +36,7 @@
#include <stdint.h>
struct nvmf_session;
struct spdk_nvmf_session;
struct spdk_nvmf_conn;
struct spdk_nvmf_request;
struct spdk_nvmf_discovery_log_page_entry;
@ -90,12 +90,12 @@ struct spdk_nvmf_transport {
/**
* Initialize the transport for the given session
*/
int (*session_init)(struct nvmf_session *session, struct spdk_nvmf_conn *conn);
int (*session_init)(struct spdk_nvmf_session *session, struct spdk_nvmf_conn *conn);
/**
* Deinitiallize the transport for the given session
*/
void (*session_fini)(struct nvmf_session *session);
void (*session_fini)(struct spdk_nvmf_session *session);
/*
* Signal request completion, which sends a response

View File

@ -79,7 +79,7 @@ static void nvmf_virtual_set_dsm(struct spdk_nvmf_subsystem *subsys)
}
static void
nvmf_virtual_ctrlr_get_data(struct nvmf_session *session)
nvmf_virtual_ctrlr_get_data(struct spdk_nvmf_session *session)
{
struct spdk_nvmf_subsystem *subsys = session->subsys;
@ -112,7 +112,7 @@ nvmf_virtual_ctrlr_get_data(struct nvmf_session *session)
}
static void
nvmf_virtual_ctrlr_poll_for_completions(struct nvmf_session *session)
nvmf_virtual_ctrlr_poll_for_completions(struct spdk_nvmf_session *session)
{
return;
}
@ -192,7 +192,7 @@ identify_ns(struct spdk_nvmf_subsystem *subsystem,
}
static int
identify_ctrlr(struct nvmf_session *session, struct spdk_nvme_ctrlr_data *cdata)
identify_ctrlr(struct spdk_nvmf_session *session, struct spdk_nvme_ctrlr_data *cdata)
{
*cdata = session->vcdata;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
@ -231,7 +231,7 @@ static int
nvmf_virtual_ctrlr_identify(struct spdk_nvmf_request *req)
{
uint8_t cns;
struct nvmf_session *session = req->conn->sess;
struct spdk_nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
struct spdk_nvmf_subsystem *subsystem = session->subsys;
@ -264,7 +264,7 @@ nvmf_virtual_ctrlr_get_features(struct spdk_nvmf_request *req)
{
uint8_t feature;
uint32_t nr_io_queues;
struct nvmf_session *session = req->conn->sess;
struct spdk_nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
@ -295,7 +295,7 @@ nvmf_virtual_ctrlr_set_features(struct spdk_nvmf_request *req)
{
uint8_t feature;
uint32_t nr_io_queues = 0;
struct nvmf_session *session = req->conn->sess;
struct spdk_nvmf_session *session = req->conn->sess;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;

View File

@ -387,7 +387,7 @@ nvmf_test_create_session(void)
{
int fake_session_count = 5;
int i;
struct nvmf_session *session;
struct spdk_nvmf_session *session;
struct spdk_nvmf_subsystem *subsystem;
/* create session in non-exist subsystem */
@ -414,7 +414,7 @@ nvmf_test_create_session(void)
static void
nvmf_test_find_session_by_id(void)
{
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
sess = nvmf_find_session_by_id("subsystem1", SS_SC_CNTLID);
CU_ASSERT_EQUAL(sess->cntlid, SS_SC_CNTLID);
/* test non-exist conditions */
@ -427,7 +427,7 @@ nvmf_test_delete_session(void)
{
int i;
int fake_session_count = 5;
struct nvmf_session *session;
struct spdk_nvmf_session *session;
struct spdk_nvmf_subsystem *subsystem;
subsystem = nvmf_find_subsystem("subsystem1");
@ -447,7 +447,7 @@ nvmf_test_connect(void)
uint64_t fabric_conn = 0;
uint64_t fabric_conn_admin = 1;
uint64_t fabric_conn_IO = 2;
struct nvmf_session *sess, *io_sess;
struct spdk_nvmf_session *sess, *io_sess;
struct spdk_nvmf_fabric_connect_cmd connect = {};
struct spdk_nvmf_fabric_connect_data connect_data = {};
struct spdk_nvmf_fabric_connect_rsp response = {};
@ -517,7 +517,7 @@ static void
nvmf_test_process_io_cmd(void)
{
struct spdk_nvme_cmd nvmf_cmd = {};
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_request nvmf_req = {};
struct nvme_read_cdw12 *cdw12;
struct spdk_nvmf_subsystem *tmp;
@ -571,7 +571,7 @@ static void
nvmf_test_process_admin_cmd(void)
{
struct spdk_nvme_cmd nvmf_cmd = {};
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_request nvmf_req = {};
struct spdk_nvmf_subsystem *subsystem;
int buf_len = sizeof(struct spdk_nvme_ns_data);
@ -711,7 +711,7 @@ nvmf_test_process_admin_cmd(void)
static void
nvmf_test_property_get(void)
{
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_fabric_prop_get_cmd cmd;
struct spdk_nvmf_fabric_prop_get_rsp response;
union spdk_nvme_cap_lo_register *cap_lo;
@ -799,7 +799,7 @@ nvmf_test_property_get(void)
static void
nvmf_test_property_set(void)
{
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_fabric_prop_set_cmd cmd;
struct spdk_nvmf_fabric_prop_set_rsp response;
union spdk_nvme_cc_register *cc;
@ -864,7 +864,7 @@ nvmf_test_property_set(void)
static void
nvmf_test_check_admin_completions(void)
{
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_subsystem *subsystem;
struct spdk_nvme_ctrlr ctrlr1, ctrlr2;
int i;
@ -910,7 +910,7 @@ nvmf_test_check_admin_completions(void)
static void
nvmf_test_check_io_completions(void)
{
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_subsystem *subsystem;
struct spdk_nvme_ctrlr ctrlr1, ctrlr2;
int i;
@ -960,7 +960,7 @@ nvmf_test_disconnect(void)
{
uint64_t fabric_conn_admin = 1;
uint64_t fabric_conn_IO = 2;
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
struct spdk_nvmf_subsystem *subsystem;
sess = nvmf_find_session_by_id("subsystem1", SS_SC_CNTLID);
@ -977,7 +977,7 @@ static void
nvmf_test_delete_subsystem(void)
{
struct spdk_nvmf_subsystem *subsystem;
struct nvmf_session *sess;
struct spdk_nvmf_session *sess;
sess = nvmf_create_session("subsystem1");
SPDK_CU_ASSERT_FATAL(sess != NULL);

View File

@ -116,14 +116,14 @@ spdk_nvmf_session_disconnect(struct spdk_nvmf_conn *conn)
}
void
spdk_nvmf_property_get(struct nvmf_session *session,
spdk_nvmf_property_get(struct spdk_nvmf_session *session,
struct spdk_nvmf_fabric_prop_get_cmd *cmd,
struct spdk_nvmf_fabric_prop_get_rsp *response)
{
}
void
spdk_nvmf_property_set(struct nvmf_session *session,
spdk_nvmf_property_set(struct spdk_nvmf_session *session,
struct spdk_nvmf_fabric_prop_set_cmd *cmd,
struct spdk_nvme_cpl *rsp)
{

View File

@ -96,12 +96,12 @@ spdk_nvme_detach(struct spdk_nvme_ctrlr *ctrlr)
}
void
spdk_nvmf_session_destruct(struct nvmf_session *session)
spdk_nvmf_session_destruct(struct spdk_nvmf_session *session)
{
}
int
spdk_nvmf_session_poll(struct nvmf_session *session)
spdk_nvmf_session_poll(struct spdk_nvmf_session *session)
{
return -1;
}