Commit 13d4f084 authored by GangCao's avatar GangCao Committed by Jim Harris
Browse files

nvme/example: add the call to spdk_nvme_connect()



In this identify example, added a call to the newly introduced
public spdk_nvme_connect() API so that other related change can
refer to this one as an example.

Change-Id: Iba97b6e52810a66d4c781bb563985e84ffb86708
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/382070


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent e46404f9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1070,6 +1070,7 @@ int main(int argc, char **argv)
{
	int				rc;
	struct spdk_env_opts		opts;
	struct spdk_nvme_ctrlr		*ctrlr;

	rc = parse_args(argc, argv);
	if (rc != 0) {
@@ -1088,7 +1089,18 @@ int main(int argc, char **argv)
	}
	spdk_env_init(&opts);

	if (spdk_nvme_probe(&g_trid, NULL, probe_cb, attach_cb, NULL) != 0) {
	/* A specific trid is required. */
	if (strlen(g_trid.traddr) != 0) {
		ctrlr = spdk_nvme_connect(&g_trid, NULL, 0);
		if (!ctrlr) {
			fprintf(stderr, "spdk_nvme_connect() failed\n");
			return 1;
		}

		g_controllers_found++;
		print_controller(ctrlr, &g_trid);
		spdk_nvme_detach(ctrlr);
	} else if (spdk_nvme_probe(&g_trid, NULL, probe_cb, attach_cb, NULL) != 0) {
		fprintf(stderr, "spdk_nvme_probe() failed\n");
		return 1;
	}