nvmf: Rename some uses of virtual to virt for C++ compat

'virtual' is a keyword in C++, so avoid using it in variable
and structure names in case any files are eventually
included from a C++ project.

Change-Id: I2122750445def63038af68a3000758e33b937f9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-10-06 15:20:24 -07:00
parent 882b790bfa
commit 8c5a2b0823
6 changed files with 27 additions and 27 deletions

View File

@ -582,8 +582,8 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
return -1;
}
subsystem->dev.virtual.ns_count = 0;
snprintf(subsystem->dev.virtual.sn, MAX_SN_LEN, "%s", sn);
subsystem->dev.virt.ns_count = 0;
snprintf(subsystem->dev.virt.sn, MAX_SN_LEN, "%s", sn);
subsystem->ops = &spdk_nvmf_virtual_ctrlr_ops;
for (i = 0; i < MAX_VIRTUAL_NAMESPACE; i++) {
@ -778,8 +778,8 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
return -1;
}
subsystem->dev.virtual.ns_count = 0;
snprintf(subsystem->dev.virtual.sn, MAX_SN_LEN, "%s", sn);
subsystem->dev.virt.ns_count = 0;
snprintf(subsystem->dev.virt.sn, MAX_SN_LEN, "%s", sn);
subsystem->ops = &spdk_nvmf_virtual_ctrlr_ops;
for (i = 0; i < num_devs; i++) {

View File

@ -117,15 +117,15 @@ dump_nvmf_subsystem(struct spdk_json_write_ctx *w, struct spdk_nvmf_subsystem *s
} else {
int i;
spdk_json_write_name(w, "serial_number");
spdk_json_write_string(w, subsystem->dev.virtual.sn);
spdk_json_write_string(w, subsystem->dev.virt.sn);
spdk_json_write_name(w, "namespaces");
spdk_json_write_array_begin(w);
for (i = 0; i < subsystem->dev.virtual.ns_count; i++) {
for (i = 0; i < subsystem->dev.virt.ns_count; i++) {
spdk_json_write_object_begin(w);
spdk_json_write_name(w, "nsid");
spdk_json_write_int32(w, i + 1);
spdk_json_write_name(w, "name");
spdk_json_write_string(w, subsystem->dev.virtual.ns_list[i]->name);
spdk_json_write_string(w, subsystem->dev.virt.ns_list[i]->name);
spdk_json_write_object_end(w);
}
spdk_json_write_array_end(w);

View File

@ -95,9 +95,9 @@ nvmf_tgt_delete_subsystem(struct nvmf_tgt_subsystem *app_subsys)
if (subsystem->subtype == SPDK_NVMF_SUBTYPE_NVME &&
subsystem->mode == NVMF_SUBSYSTEM_MODE_VIRTUAL) {
for (i = 0; i < subsystem->dev.virtual.ns_count; i++) {
spdk_put_io_channel(subsystem->dev.virtual.ch[i]);
subsystem->dev.virtual.ch[i] = NULL;
for (i = 0; i < subsystem->dev.virt.ns_count; i++) {
spdk_put_io_channel(subsystem->dev.virt.ch[i]);
subsystem->dev.virt.ch[i] = NULL;
}
}
@ -200,11 +200,11 @@ nvmf_tgt_start_subsystem(struct spdk_event *event)
if (subsystem->subtype == SPDK_NVMF_SUBTYPE_NVME &&
subsystem->mode == NVMF_SUBSYSTEM_MODE_VIRTUAL) {
for (i = 0; i < subsystem->dev.virtual.ns_count; i++) {
bdev = subsystem->dev.virtual.ns_list[i];
for (i = 0; i < subsystem->dev.virt.ns_count; i++) {
bdev = subsystem->dev.virt.ns_list[i];
ch = spdk_bdev_get_io_channel(bdev, SPDK_IO_PRIORITY_DEFAULT);
assert(ch != NULL);
subsystem->dev.virtual.ch[i] = ch;
subsystem->dev.virt.ch[i] = ch;
}
}

View File

@ -307,14 +307,14 @@ spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bd
int i = 0;
assert(subsystem->mode == NVMF_SUBSYSTEM_MODE_VIRTUAL);
while (i < MAX_VIRTUAL_NAMESPACE && subsystem->dev.virtual.ns_list[i]) {
while (i < MAX_VIRTUAL_NAMESPACE && subsystem->dev.virt.ns_list[i]) {
i++;
}
if (i == MAX_VIRTUAL_NAMESPACE) {
SPDK_ERRLOG("spdk_nvmf_subsystem_add_ns() failed\n");
return -1;
}
subsystem->dev.virtual.ns_list[i] = bdev;
subsystem->dev.virtual.ns_count++;
subsystem->dev.virt.ns_list[i] = bdev;
subsystem->dev.virt.ns_count++;
return 0;
}

View File

@ -119,7 +119,7 @@ struct spdk_nvmf_subsystem {
struct spdk_bdev *ns_list[MAX_VIRTUAL_NAMESPACE];
struct spdk_io_channel *ch[MAX_VIRTUAL_NAMESPACE];
uint16_t ns_count;
} virtual;
} virt;
} dev;
const struct spdk_nvmf_ctrlr_ops *ops;

View File

@ -62,8 +62,8 @@ static void nvmf_virtual_set_dsm(struct spdk_nvmf_session *session)
{
int i;
for (i = 0; i < session->subsys->dev.virtual.ns_count; i++) {
struct spdk_bdev *bdev = session->subsys->dev.virtual.ns_list[i];
for (i = 0; i < session->subsys->dev.virt.ns_count; i++) {
struct spdk_bdev *bdev = session->subsys->dev.virt.ns_list[i];
if (!spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
SPDK_TRACELOG(SPDK_TRACE_NVMF,
@ -88,7 +88,7 @@ nvmf_virtual_ctrlr_get_data(struct spdk_nvmf_session *session)
spdk_strcpy_pad(session->vcdata.mn, MODEL_NUMBER, sizeof(session->vcdata.mn), ' ');
session->vcdata.vid = 0x8086;
session->vcdata.ssvid = 0x8086;
spdk_strcpy_pad(session->vcdata.sn, subsys->dev.virtual.sn, sizeof(session->vcdata.sn), ' ');
spdk_strcpy_pad(session->vcdata.sn, subsys->dev.virt.sn, sizeof(session->vcdata.sn), ' ');
session->vcdata.rab = 6;
session->vcdata.ver.bits.mjr = 1;
session->vcdata.ver.bits.mnr = 2;
@ -104,7 +104,7 @@ nvmf_virtual_ctrlr_get_data(struct spdk_nvmf_session *session)
session->vcdata.cqes.min = 0x04;
session->vcdata.cqes.max = 0x04;
session->vcdata.maxcmd = 1024;
session->vcdata.nn = subsys->dev.virtual.ns_count;
session->vcdata.nn = subsys->dev.virt.ns_count;
session->vcdata.vwc.present = 1;
session->vcdata.sgls.supported = 1;
strncpy(session->vcdata.subnqn, session->subsys->subnqn, sizeof(session->vcdata.subnqn));
@ -173,13 +173,13 @@ identify_ns(struct spdk_nvmf_subsystem *subsystem,
{
struct spdk_bdev *bdev;
if (cmd->nsid > subsystem->dev.virtual.ns_count || cmd->nsid == 0) {
if (cmd->nsid > subsystem->dev.virt.ns_count || cmd->nsid == 0) {
SPDK_ERRLOG("Identify Namespace for invalid NSID %u\n", cmd->nsid);
rsp->status.sc = SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
bdev = subsystem->dev.virtual.ns_list[cmd->nsid - 1];
bdev = subsystem->dev.virt.ns_list[cmd->nsid - 1];
nsdata->nsze = bdev->blockcnt;
nsdata->ncap = bdev->blockcnt;
@ -212,7 +212,7 @@ identify_active_ns_list(struct spdk_nvmf_subsystem *subsystem,
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
num_ns = subsystem->dev.virtual.ns_count;
num_ns = subsystem->dev.virt.ns_count;
for (i = 1; i <= num_ns; i++) {
if (i <= cmd->nsid) {
@ -508,14 +508,14 @@ nvmf_virtual_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
response->status.sc = SPDK_NVME_SC_SUCCESS;
nsid = cmd->nsid;
if (nsid > subsystem->dev.virtual.ns_count || nsid == 0) {
if (nsid > subsystem->dev.virt.ns_count || nsid == 0) {
SPDK_ERRLOG("Unsuccessful query for nsid %u\n", cmd->nsid);
response->status.sc = SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
bdev = subsystem->dev.virtual.ns_list[nsid - 1];
ch = subsystem->dev.virtual.ch[nsid - 1];
bdev = subsystem->dev.virt.ns_list[nsid - 1];
ch = subsystem->dev.virt.ch[nsid - 1];
switch (cmd->opc) {
case SPDK_NVME_OPC_READ:
case SPDK_NVME_OPC_WRITE: