Commit 187e2dfb authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

nvmf: use spdk_uuid_copy() API instead of memcpy.



For NVMeoF, extened host identifer is used which is exactly
the same size as uuid, while here, use uuid data structure
makes sense.  For NVMeoF reservation features, host identifier
need to be used with each registrant, using spdk_uuid_compare
becomes straightforward.

Change-Id: Ib6ffaa92fab5e0ae5037682be14fcc415f9714d7
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/436302


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarJim Harris <james.r.harris@intel.com>
parent 31e8fb40
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ spdk_nvmf_ctrlr_create(struct spdk_nvmf_subsystem *subsystem,
	ctrlr->feat.number_of_queues.bits.nsqr = transport->opts.max_qpairs_per_ctrlr - 1 -
			1;

	memcpy(ctrlr->hostid, connect_data->hostid, sizeof(ctrlr->hostid));
	spdk_uuid_copy(&ctrlr->hostid, (struct spdk_uuid *)connect_data->hostid);

	ctrlr->vcprop.cap.raw = 0;
	ctrlr->vcprop.cap.bits.cqr = 1; /* NVMe-oF specification required */
@@ -855,7 +855,7 @@ spdk_nvmf_ctrlr_get_features_host_identifier(struct spdk_nvmf_request *req)
		return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
	}

	memcpy(req->data, ctrlr->hostid, sizeof(ctrlr->hostid));
	spdk_uuid_copy((struct spdk_uuid *)req->data, &ctrlr->hostid);
	return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}

+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ struct spdk_nvmf_ctrlr {

	struct spdk_nvmf_request *aer_req;
	union spdk_nvme_async_event_completion notice_event;
	uint8_t hostid[16];
	struct spdk_uuid  hostid;

	uint16_t changed_ns_list_count;
	struct spdk_nvme_ns_list changed_ns_list;