From 1a9c19a954504af2187db7c61258333d21b75a55 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Thu, 14 May 2020 20:50:18 -0700 Subject: [PATCH] lib/nvme: remove spdk prefix from internal headers. Signed-off-by: Seth Howell Change-Id: Iccde5860b83217163428ff504cba87a1cf209720 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2444 Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Darek Stojaczyk --- lib/nvme/nvme.c | 18 +++---- lib/nvme/nvme_ctrlr.c | 50 +++++++++---------- lib/nvme/nvme_fabric.c | 10 ++-- lib/nvme/nvme_internal.h | 12 ++--- lib/nvme/nvme_ns.c | 8 +-- lib/nvme/nvme_pcie.c | 22 ++++---- lib/nvme/nvme_rdma.c | 2 +- lib/nvme/nvme_tcp.c | 2 +- lib/nvme/nvme_uevent.c | 8 +-- lib/nvme/nvme_uevent.h | 4 +- test/common/lib/nvme/common_stubs.h | 2 +- test/unit/lib/nvme/nvme.c/nvme_ut.c | 16 +++--- .../lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut.c | 18 +++---- test/unit/lib/nvme/nvme_ns.c/nvme_ns_ut.c | 2 +- test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c | 8 +-- 15 files changed, 91 insertions(+), 91 deletions(-) diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c index 35cef1ac7c..885513b1d1 100644 --- a/lib/nvme/nvme.c +++ b/lib/nvme/nvme.c @@ -120,7 +120,7 @@ nvme_completion_poll_cb(void *arg, const struct spdk_nvme_cpl *cpl) * and status as the callback argument. */ int -spdk_nvme_wait_for_completion_robust_lock( +nvme_wait_for_completion_robust_lock( struct spdk_nvme_qpair *qpair, struct nvme_completion_poll_status *status, pthread_mutex_t *robust_mutex) @@ -152,10 +152,10 @@ spdk_nvme_wait_for_completion_robust_lock( } int -spdk_nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, - struct nvme_completion_poll_status *status) +nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, + struct nvme_completion_poll_status *status) { - return spdk_nvme_wait_for_completion_robust_lock(qpair, status, NULL); + return nvme_wait_for_completion_robust_lock(qpair, status, NULL); } /** @@ -174,9 +174,9 @@ spdk_nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, * and status as the callback argument. */ int -spdk_nvme_wait_for_completion_timeout(struct spdk_nvme_qpair *qpair, - struct nvme_completion_poll_status *status, - uint64_t timeout_in_secs) +nvme_wait_for_completion_timeout(struct spdk_nvme_qpair *qpair, + struct nvme_completion_poll_status *status, + uint64_t timeout_in_secs) { uint64_t timeout_tsc = 0; int rc = 0; @@ -439,7 +439,7 @@ nvme_driver_init(void) nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock); g_spdk_nvme_driver->initialized = false; - g_spdk_nvme_driver->hotplug_fd = spdk_uevent_connect(); + g_spdk_nvme_driver->hotplug_fd = nvme_uevent_connect(); if (g_spdk_nvme_driver->hotplug_fd < 0) { SPDK_DEBUGLOG(SPDK_LOG_NVME, "Failed to open uevent netlink socket\n"); } @@ -648,7 +648,7 @@ nvme_probe_internal(struct spdk_nvme_probe_ctx *probe_ctx, } /* Do not attach if we failed to initialize it in this process */ - if (spdk_nvme_ctrlr_get_current_process(ctrlr) == NULL) { + if (nvme_ctrlr_get_current_process(ctrlr) == NULL) { continue; } diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 513f8b3d43..375538eaa7 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -199,7 +199,7 @@ nvme_ctrlr_proc_add_io_qpair(struct spdk_nvme_qpair *qpair) struct spdk_nvme_ctrlr_process *active_proc; struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr; - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc) { TAILQ_INSERT_TAIL(&active_proc->allocated_io_qpairs, qpair, per_process_tailq); qpair->active_proc = active_proc; @@ -217,7 +217,7 @@ nvme_ctrlr_proc_remove_io_qpair(struct spdk_nvme_qpair *qpair) struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr; struct spdk_nvme_qpair *active_qpair, *tmp_qpair; - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (!active_proc) { return; } @@ -621,8 +621,8 @@ static int nvme_ctrlr_set_intel_support_log_pages(struct spdk_nvme_ctrlr *ctrlr) return rc; } - if (spdk_nvme_wait_for_completion_timeout(ctrlr->adminq, status, - ctrlr->opts.admin_timeout_ms / 1000)) { + if (nvme_wait_for_completion_timeout(ctrlr->adminq, status, + ctrlr->opts.admin_timeout_ms / 1000)) { spdk_free(log_page_directory); SPDK_WARNLOG("Intel log pages not supported on Intel drive!\n"); if (!status->timed_out) { @@ -706,8 +706,8 @@ nvme_ctrlr_set_arbitration_feature(struct spdk_nvme_ctrlr *ctrlr) return; } - if (spdk_nvme_wait_for_completion_timeout(ctrlr->adminq, status, - ctrlr->opts.admin_timeout_ms / 1000)) { + if (nvme_wait_for_completion_timeout(ctrlr->adminq, status, + ctrlr->opts.admin_timeout_ms / 1000)) { SPDK_ERRLOG("Timeout to set arbitration feature\n"); } @@ -2068,7 +2068,7 @@ nvme_ctrlr_async_event_cb(void *arg, const struct spdk_nvme_cpl *cpl) nvme_ctrlr_update_namespaces(ctrlr); } - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc && active_proc->aer_cb_fn) { active_proc->aer_cb_fn(active_proc->aer_cb_arg, cpl); } @@ -2179,7 +2179,7 @@ nvme_ctrlr_configure_aer(struct spdk_nvme_ctrlr *ctrlr) } struct spdk_nvme_ctrlr_process * -spdk_nvme_ctrlr_get_process(struct spdk_nvme_ctrlr *ctrlr, pid_t pid) +nvme_ctrlr_get_process(struct spdk_nvme_ctrlr *ctrlr, pid_t pid) { struct spdk_nvme_ctrlr_process *active_proc; @@ -2193,9 +2193,9 @@ spdk_nvme_ctrlr_get_process(struct spdk_nvme_ctrlr *ctrlr, pid_t pid) } struct spdk_nvme_ctrlr_process * -spdk_nvme_ctrlr_get_current_process(struct spdk_nvme_ctrlr *ctrlr) +nvme_ctrlr_get_current_process(struct spdk_nvme_ctrlr *ctrlr) { - return spdk_nvme_ctrlr_get_process(ctrlr, getpid()); + return nvme_ctrlr_get_process(ctrlr, getpid()); } /** @@ -2211,7 +2211,7 @@ nvme_ctrlr_add_process(struct spdk_nvme_ctrlr *ctrlr, void *devhandle) pid_t pid = getpid(); /* Check whether the process is already added or not */ - if (spdk_nvme_ctrlr_get_process(ctrlr, pid)) { + if (nvme_ctrlr_get_process(ctrlr, pid)) { return 0; } @@ -2355,7 +2355,7 @@ nvme_ctrlr_proc_get_ref(struct spdk_nvme_ctrlr *ctrlr) nvme_ctrlr_remove_inactive_proc(ctrlr); - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc) { active_proc->ref++; } @@ -2373,7 +2373,7 @@ nvme_ctrlr_proc_put_ref(struct spdk_nvme_ctrlr *ctrlr) proc_count = nvme_ctrlr_remove_inactive_proc(ctrlr); - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc) { active_proc->ref--; assert(active_proc->ref >= 0); @@ -2420,7 +2420,7 @@ nvme_ctrlr_proc_get_devhandle(struct spdk_nvme_ctrlr *ctrlr) nvme_robust_mutex_lock(&ctrlr->ctrlr_lock); - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc) { devhandle = active_proc->devhandle; } @@ -3037,7 +3037,7 @@ spdk_nvme_ctrlr_register_aer_callback(struct spdk_nvme_ctrlr *ctrlr, nvme_robust_mutex_lock(&ctrlr->ctrlr_lock); - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc) { active_proc->aer_cb_fn = aer_cb_fn; active_proc->aer_cb_arg = aer_cb_arg; @@ -3054,7 +3054,7 @@ spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr *ctrlr, nvme_robust_mutex_lock(&ctrlr->ctrlr_lock); - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); if (active_proc) { active_proc->timeout_ticks = timeout_us * spdk_get_ticks_hz() / 1000000ULL; active_proc->timeout_cb_fn = cb_fn; @@ -3102,7 +3102,7 @@ spdk_nvme_ctrlr_attach_ns(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid, free(status); return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_attach_ns failed!\n"); if (!status->timed_out) { free(status); @@ -3140,7 +3140,7 @@ spdk_nvme_ctrlr_detach_ns(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid, free(status); return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_detach_ns failed!\n"); if (!status->timed_out) { free(status); @@ -3180,7 +3180,7 @@ spdk_nvme_ctrlr_create_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns_dat free(status); return 0; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_create_ns failed!\n"); if (!status->timed_out) { free(status); @@ -3219,7 +3219,7 @@ spdk_nvme_ctrlr_delete_ns(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid) free(status); return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_delete_ns failed!\n"); if (!status->timed_out) { free(status); @@ -3258,7 +3258,7 @@ spdk_nvme_ctrlr_format(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid, free(status); return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_format failed!\n"); if (!status->timed_out) { free(status); @@ -3323,7 +3323,7 @@ spdk_nvme_ctrlr_update_firmware(struct spdk_nvme_ctrlr *ctrlr, void *payload, ui return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_fw_image_download failed!\n"); if (!status->timed_out) { free(status); @@ -3348,7 +3348,7 @@ spdk_nvme_ctrlr_update_firmware(struct spdk_nvme_ctrlr *ctrlr, void *payload, ui return res; } - res = spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock); + res = nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock); memcpy(completion_status, &status->cpl.status, sizeof(struct spdk_nvme_status)); @@ -3445,7 +3445,7 @@ spdk_nvme_ctrlr_security_receive(struct spdk_nvme_ctrlr *ctrlr, uint8_t secp, free(status); return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_cmd_security_receive failed!\n"); if (!status->timed_out) { free(status); @@ -3477,7 +3477,7 @@ spdk_nvme_ctrlr_security_send(struct spdk_nvme_ctrlr *ctrlr, uint8_t secp, free(status); return res; } - if (spdk_nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { + if (nvme_wait_for_completion_robust_lock(ctrlr->adminq, status, &ctrlr->ctrlr_lock)) { SPDK_ERRLOG("spdk_nvme_ctrlr_cmd_security_send failed!\n"); if (!status->timed_out) { free(status); diff --git a/lib/nvme/nvme_fabric.c b/lib/nvme/nvme_fabric.c index 61b0c9caef..9fff20873d 100644 --- a/lib/nvme/nvme_fabric.c +++ b/lib/nvme/nvme_fabric.c @@ -70,7 +70,7 @@ nvme_fabric_prop_set_cmd(struct spdk_nvme_ctrlr *ctrlr, return rc; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } @@ -112,7 +112,7 @@ nvme_fabric_prop_get_cmd(struct spdk_nvme_ctrlr *ctrlr, return rc; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } @@ -248,7 +248,7 @@ nvme_fabric_get_discovery_log_page(struct spdk_nvme_ctrlr *ctrlr, return -1; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } @@ -316,7 +316,7 @@ nvme_fabric_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx, return rc; } - if (spdk_nvme_wait_for_completion(discovery_ctrlr->adminq, status)) { + if (nvme_wait_for_completion(discovery_ctrlr->adminq, status)) { SPDK_ERRLOG("nvme_identify_controller failed!\n"); nvme_ctrlr_destruct(discovery_ctrlr); if (!status->timed_out) { @@ -454,7 +454,7 @@ nvme_fabric_qpair_connect(struct spdk_nvme_qpair *qpair, uint32_t num_entries) return rc; } - if (spdk_nvme_wait_for_completion(qpair, status)) { + if (nvme_wait_for_completion(qpair, status)) { SPDK_ERRLOG("Connect command failed\n"); spdk_free(nvmf_data); if (!status->timed_out) { diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index b14f4d1733..f4c0f98892 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -883,18 +883,18 @@ int nvme_ctrlr_cmd_sanitize(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid, struct spdk_nvme_sanitize *sanitize, uint32_t cdw11, spdk_nvme_cmd_cb cb_fn, void *cb_arg); void nvme_completion_poll_cb(void *arg, const struct spdk_nvme_cpl *cpl); -int spdk_nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, - struct nvme_completion_poll_status *status); -int spdk_nvme_wait_for_completion_robust_lock(struct spdk_nvme_qpair *qpair, +int nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, + struct nvme_completion_poll_status *status); +int nvme_wait_for_completion_robust_lock(struct spdk_nvme_qpair *qpair, struct nvme_completion_poll_status *status, pthread_mutex_t *robust_mutex); -int spdk_nvme_wait_for_completion_timeout(struct spdk_nvme_qpair *qpair, +int nvme_wait_for_completion_timeout(struct spdk_nvme_qpair *qpair, struct nvme_completion_poll_status *status, uint64_t timeout_in_secs); -struct spdk_nvme_ctrlr_process *spdk_nvme_ctrlr_get_process(struct spdk_nvme_ctrlr *ctrlr, +struct spdk_nvme_ctrlr_process *nvme_ctrlr_get_process(struct spdk_nvme_ctrlr *ctrlr, pid_t pid); -struct spdk_nvme_ctrlr_process *spdk_nvme_ctrlr_get_current_process(struct spdk_nvme_ctrlr *ctrlr); +struct spdk_nvme_ctrlr_process *nvme_ctrlr_get_current_process(struct spdk_nvme_ctrlr *ctrlr); int nvme_ctrlr_add_process(struct spdk_nvme_ctrlr *ctrlr, void *devhandle); void nvme_ctrlr_free_processes(struct spdk_nvme_ctrlr *ctrlr); struct spdk_pci_device *nvme_ctrlr_proc_get_devhandle(struct spdk_nvme_ctrlr *ctrlr); diff --git a/lib/nvme/nvme_ns.c b/lib/nvme/nvme_ns.c index 183929e4a4..5d424e5c73 100644 --- a/lib/nvme/nvme_ns.c +++ b/lib/nvme/nvme_ns.c @@ -132,7 +132,7 @@ nvme_ctrlr_identify_ns(struct spdk_nvme_ns *ns) return rc; } - if (spdk_nvme_wait_for_completion_robust_lock(ns->ctrlr->adminq, status, + if (nvme_wait_for_completion_robust_lock(ns->ctrlr->adminq, status, &ns->ctrlr->ctrlr_lock)) { if (!status->timed_out) { free(status); @@ -178,7 +178,7 @@ nvme_ctrlr_identify_id_desc(struct spdk_nvme_ns *ns) return rc; } - rc = spdk_nvme_wait_for_completion_robust_lock(ns->ctrlr->adminq, status, &ns->ctrlr->ctrlr_lock); + rc = nvme_wait_for_completion_robust_lock(ns->ctrlr->adminq, status, &ns->ctrlr->ctrlr_lock); if (rc != 0) { SPDK_WARNLOG("Failed to retrieve NS ID Descriptor List\n"); memset(ns->id_desc_list, 0, sizeof(ns->id_desc_list)); @@ -310,7 +310,7 @@ spdk_nvme_ns_get_optimal_io_boundary(struct spdk_nvme_ns *ns) } static const void * -_spdk_nvme_ns_find_id_desc(const struct spdk_nvme_ns *ns, enum spdk_nvme_nidt type, size_t *length) +nvme_ns_find_id_desc(const struct spdk_nvme_ns *ns, enum spdk_nvme_nidt type, size_t *length) { const struct spdk_nvme_ns_id_desc *desc; size_t offset; @@ -350,7 +350,7 @@ spdk_nvme_ns_get_uuid(const struct spdk_nvme_ns *ns) const struct spdk_uuid *uuid; size_t uuid_size; - uuid = _spdk_nvme_ns_find_id_desc(ns, SPDK_NVME_NIDT_UUID, &uuid_size); + uuid = nvme_ns_find_id_desc(ns, SPDK_NVME_NIDT_UUID, &uuid_size); if (uuid == NULL || uuid_size != sizeof(*uuid)) { return NULL; } diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 194dd87dc6..fd3e9b823d 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -276,7 +276,7 @@ _nvme_pcie_hotplug_monitor(struct spdk_nvme_probe_ctx *probe_ctx) return 0; } - while (spdk_get_uevent(g_spdk_nvme_driver->hotplug_fd, &event) > 0) { + while (nvme_get_uevent(g_spdk_nvme_driver->hotplug_fd, &event) > 0) { if (event.subsystem == SPDK_NVME_UEVENT_SUBSYSTEM_UIO || event.subsystem == SPDK_NVME_UEVENT_SUBSYSTEM_VFIO) { if (event.action == SPDK_NVME_UEVENT_ADD) { @@ -326,7 +326,7 @@ _nvme_pcie_hotplug_monitor(struct spdk_nvme_probe_ctx *probe_ctx) } /* NVMe controller BAR must be mapped in the current process before any access. */ - proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + proc = nvme_ctrlr_get_current_process(ctrlr); if (proc) { csts = spdk_nvme_ctrlr_get_regs_csts(ctrlr); if (csts.raw == 0xffffffffU) { @@ -1187,7 +1187,7 @@ nvme_pcie_qpair_insert_pending_admin_request(struct spdk_nvme_qpair *qpair, assert(nvme_qpair_is_admin_queue(qpair)); assert(active_req->pid != getpid()); - active_proc = spdk_nvme_ctrlr_get_process(ctrlr, active_req->pid); + active_proc = nvme_ctrlr_get_process(ctrlr, active_req->pid); if (active_proc) { /* Save the original completion information */ memcpy(&active_req->cpl, cpl, sizeof(*cpl)); @@ -1217,7 +1217,7 @@ nvme_pcie_qpair_complete_pending_admin_request(struct spdk_nvme_qpair *qpair) */ assert(nvme_qpair_is_admin_queue(qpair)); - proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + proc = nvme_ctrlr_get_current_process(ctrlr); if (!proc) { SPDK_ERRLOG("the active process (pid %d) is not found for this controller.\n", pid); assert(proc); @@ -1613,7 +1613,7 @@ _nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme return rc; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { SPDK_ERRLOG("nvme_create_io_cq failed!\n"); if (!status->timed_out) { free(status); @@ -1628,7 +1628,7 @@ _nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme return rc; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { SPDK_ERRLOG("nvme_create_io_sq failed!\n"); if (status->timed_out) { /* Request is still queued, the memory will be freed in a completion callback. @@ -1649,9 +1649,9 @@ _nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme free(status); return -1; } - spdk_nvme_wait_for_completion(ctrlr->adminq, status); + nvme_wait_for_completion(ctrlr->adminq, status); if (!status->timed_out) { - /* status can be freed regardless of spdk_nvme_wait_for_completion return value */ + /* status can be freed regardless of nvme_wait_for_completion return value */ free(status); } return -1; @@ -1753,7 +1753,7 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ free(status); return rc; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } @@ -1768,7 +1768,7 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ free(status); return rc; } - if (spdk_nvme_wait_for_completion(ctrlr->adminq, status)) { + if (nvme_wait_for_completion(ctrlr->adminq, status)) { if (!status->timed_out) { free(status); } @@ -2304,7 +2304,7 @@ nvme_pcie_qpair_check_timeout(struct spdk_nvme_qpair *qpair) } if (nvme_qpair_is_admin_queue(qpair)) { - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); } else { active_proc = qpair->active_proc; } diff --git a/lib/nvme/nvme_rdma.c b/lib/nvme/nvme_rdma.c index 53c120945d..3db8de2380 100644 --- a/lib/nvme/nvme_rdma.c +++ b/lib/nvme/nvme_rdma.c @@ -2045,7 +2045,7 @@ nvme_rdma_qpair_check_timeout(struct spdk_nvme_qpair *qpair) } if (nvme_qpair_is_admin_queue(qpair)) { - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); } else { active_proc = qpair->active_proc; } diff --git a/lib/nvme/nvme_tcp.c b/lib/nvme/nvme_tcp.c index 3f010f686a..b8128ffffd 100644 --- a/lib/nvme/nvme_tcp.c +++ b/lib/nvme/nvme_tcp.c @@ -1374,7 +1374,7 @@ nvme_tcp_qpair_check_timeout(struct spdk_nvme_qpair *qpair) } if (nvme_qpair_is_admin_queue(qpair)) { - active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr); + active_proc = nvme_ctrlr_get_current_process(ctrlr); } else { active_proc = qpair->active_proc; } diff --git a/lib/nvme/nvme_uevent.c b/lib/nvme/nvme_uevent.c index 81bb596163..1bcfff1cbd 100644 --- a/lib/nvme/nvme_uevent.c +++ b/lib/nvme/nvme_uevent.c @@ -45,7 +45,7 @@ #define SPDK_UEVENT_MSG_LEN 4096 int -spdk_uevent_connect(void) +nvme_uevent_connect(void) { struct sockaddr_nl addr; int netlink_fd; @@ -168,7 +168,7 @@ parse_event(const char *buf, struct spdk_uevent *event) } int -spdk_get_uevent(int fd, struct spdk_uevent *uevent) +nvme_get_uevent(int fd, struct spdk_uevent *uevent) { int ret; char buf[SPDK_UEVENT_MSG_LEN]; @@ -200,13 +200,13 @@ spdk_get_uevent(int fd, struct spdk_uevent *uevent) #else /* Not Linux */ int -spdk_uevent_connect(void) +nvme_uevent_connect(void) { return -1; } int -spdk_get_uevent(int fd, struct spdk_uevent *uevent) +nvme_get_uevent(int fd, struct spdk_uevent *uevent) { return -1; } diff --git a/lib/nvme/nvme_uevent.h b/lib/nvme/nvme_uevent.h index 7fe0ab7a6a..778d73c2a2 100644 --- a/lib/nvme/nvme_uevent.h +++ b/lib/nvme/nvme_uevent.h @@ -55,7 +55,7 @@ struct spdk_uevent { char traddr[SPDK_NVMF_TRADDR_MAX_LEN + 1]; }; -int spdk_uevent_connect(void); -int spdk_get_uevent(int fd, struct spdk_uevent *uevent); +int nvme_uevent_connect(void); +int nvme_get_uevent(int fd, struct spdk_uevent *uevent); #endif /* SPDK_UEVENT_H_ */ diff --git a/test/common/lib/nvme/common_stubs.h b/test/common/lib/nvme/common_stubs.h index a11b731a8d..1dc22a1623 100644 --- a/test/common/lib/nvme/common_stubs.h +++ b/test/common/lib/nvme/common_stubs.h @@ -88,7 +88,7 @@ DEFINE_STUB_V(nvme_qpair_deinit, (struct spdk_nvme_qpair *qpair)); DEFINE_STUB_V(spdk_nvme_transport_register, (const struct spdk_nvme_transport_ops *ops)); DEFINE_STUB(nvme_transport_ctrlr_connect_qpair, int, (struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair), 0); -DEFINE_STUB(spdk_nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *, +DEFINE_STUB(nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *, (struct spdk_nvme_ctrlr *ctrlr), (struct spdk_nvme_ctrlr_process *)(uintptr_t)0x1); DEFINE_STUB(nvme_ctrlr_add_process, int, (struct spdk_nvme_ctrlr *ctrlr, void *devhandle), 0); DEFINE_STUB_V(spdk_nvme_trid_populate_transport, (struct spdk_nvme_transport_id *trid, diff --git a/test/unit/lib/nvme/nvme.c/nvme_ut.c b/test/unit/lib/nvme/nvme.c/nvme_ut.c index f6a74ee62e..e96e9a6145 100644 --- a/test/unit/lib/nvme/nvme.c/nvme_ut.c +++ b/test/unit/lib/nvme/nvme.c/nvme_ut.c @@ -47,7 +47,7 @@ DEFINE_STUB_V(nvme_ctrlr_fail, (struct spdk_nvme_ctrlr *ctrlr, bool hotremove)); DEFINE_STUB(spdk_nvme_transport_available_by_name, bool, (const char *transport_name), true); /* return anything non-NULL, this won't be deferenced anywhere in this test */ -DEFINE_STUB(spdk_nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *, +DEFINE_STUB(nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *, (struct spdk_nvme_ctrlr *ctrlr), (struct spdk_nvme_ctrlr_process *)(uintptr_t)0x1); DEFINE_STUB(nvme_ctrlr_process_init, int, (struct spdk_nvme_ctrlr *ctrlr), 0); @@ -63,7 +63,7 @@ DEFINE_STUB(nvme_transport_ctrlr_construct, struct spdk_nvme_ctrlr *, DEFINE_STUB_V(nvme_io_msg_ctrlr_detach, (struct spdk_nvme_ctrlr *ctrlr)); DEFINE_STUB(spdk_nvme_transport_available, bool, (enum spdk_nvme_transport_type trtype), true); -DEFINE_STUB(spdk_uevent_connect, int, (void), 1); +DEFINE_STUB(nvme_uevent_connect, int, (void), 1); static bool ut_destruct_called = false; @@ -1248,7 +1248,7 @@ test_nvme_wait_for_completion(void) memset(&g_status, 0, sizeof(g_status)); completion_delay = 2; timeout_in_secs = 1; - rc = spdk_nvme_wait_for_completion_timeout(&qpair, &g_status, timeout_in_secs); + rc = nvme_wait_for_completion_timeout(&qpair, &g_status, timeout_in_secs); CU_ASSERT(g_status.timed_out == true); CU_ASSERT(g_status.done == false); CU_ASSERT(rc == -ECANCELED); @@ -1258,7 +1258,7 @@ test_nvme_wait_for_completion(void) g_process_comp_result = -1; completion_delay = 1; timeout_in_secs = 2; - rc = spdk_nvme_wait_for_completion_timeout(&qpair, &g_status, timeout_in_secs); + rc = nvme_wait_for_completion_timeout(&qpair, &g_status, timeout_in_secs); CU_ASSERT(rc == -ECANCELED); CU_ASSERT(g_status.timed_out == true); CU_ASSERT(g_status.done == false); @@ -1271,16 +1271,16 @@ test_nvme_wait_for_completion(void) memset(&g_status, 0, sizeof(g_status)); completion_delay = 1; timeout_in_secs = 2; - rc = spdk_nvme_wait_for_completion_timeout(&qpair, &g_status, timeout_in_secs); + rc = nvme_wait_for_completion_timeout(&qpair, &g_status, timeout_in_secs); CU_ASSERT(g_status.timed_out == false); CU_ASSERT(g_status.done == true); CU_ASSERT(rc == 0); - /* spdk_nvme_wait_for_completion */ + /* nvme_wait_for_completion */ /* spdk_nvme_qpair_process_completions returns error */ memset(&g_status, 0, sizeof(g_status)); g_process_comp_result = -1; - rc = spdk_nvme_wait_for_completion(&qpair, &g_status); + rc = nvme_wait_for_completion(&qpair, &g_status); CU_ASSERT(rc == -ECANCELED); CU_ASSERT(g_status.timed_out == true); CU_ASSERT(g_status.done == false); @@ -1290,7 +1290,7 @@ test_nvme_wait_for_completion(void) /* successful completion */ memset(&g_status, 0, sizeof(g_status)); g_process_comp_result = 0; - rc = spdk_nvme_wait_for_completion(&qpair, &g_status); + rc = nvme_wait_for_completion(&qpair, &g_status); CU_ASSERT(rc == 0); CU_ASSERT(g_status.timed_out == false); CU_ASSERT(g_status.done == true); diff --git a/test/unit/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut.c b/test/unit/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut.c index adebc4bfbb..36e03a2929 100644 --- a/test/unit/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut.c +++ b/test/unit/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut.c @@ -289,7 +289,7 @@ nvme_completion_poll_cb(void *arg, const struct spdk_nvme_cpl *cpl) static struct nvme_completion_poll_status *g_failed_status; int -spdk_nvme_wait_for_completion_robust_lock( +nvme_wait_for_completion_robust_lock( struct spdk_nvme_qpair *qpair, struct nvme_completion_poll_status *status, pthread_mutex_t *robust_mutex) @@ -308,18 +308,18 @@ spdk_nvme_wait_for_completion_robust_lock( } int -spdk_nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, - struct nvme_completion_poll_status *status) +nvme_wait_for_completion(struct spdk_nvme_qpair *qpair, + struct nvme_completion_poll_status *status) { - return spdk_nvme_wait_for_completion_robust_lock(qpair, status, NULL); + return nvme_wait_for_completion_robust_lock(qpair, status, NULL); } int -spdk_nvme_wait_for_completion_timeout(struct spdk_nvme_qpair *qpair, - struct nvme_completion_poll_status *status, - uint64_t timeout_in_secs) +nvme_wait_for_completion_timeout(struct spdk_nvme_qpair *qpair, + struct nvme_completion_poll_status *status, + uint64_t timeout_in_secs) { - return spdk_nvme_wait_for_completion_robust_lock(qpair, status, NULL); + return nvme_wait_for_completion_robust_lock(qpair, status, NULL); } int @@ -1745,7 +1745,7 @@ test_spdk_nvme_ctrlr_update_firmware(void) ret = spdk_nvme_ctrlr_update_firmware(&ctrlr, payload, set_size, slot, commit_action, &status); CU_ASSERT(ret == 0); - /* spdk_nvme_wait_for_completion returns an error */ + /* nvme_wait_for_completion returns an error */ g_wait_for_completion_return_val = -1; ret = spdk_nvme_ctrlr_update_firmware(&ctrlr, payload, set_size, slot, commit_action, &status); CU_ASSERT(ret == -ENXIO); diff --git a/test/unit/lib/nvme/nvme_ns.c/nvme_ns_ut.c b/test/unit/lib/nvme/nvme_ns.c/nvme_ns_ut.c index 5f3cf6b983..22c59e06c4 100644 --- a/test/unit/lib/nvme/nvme_ns.c/nvme_ns_ut.c +++ b/test/unit/lib/nvme/nvme_ns.c/nvme_ns_ut.c @@ -41,7 +41,7 @@ SPDK_LOG_REGISTER_COMPONENT("nvme", SPDK_LOG_NVME) -DEFINE_STUB(spdk_nvme_wait_for_completion_robust_lock, int, +DEFINE_STUB(nvme_wait_for_completion_robust_lock, int, (struct spdk_nvme_qpair *qpair, struct nvme_completion_poll_status *status, pthread_mutex_t *robust_mutex), 0); diff --git a/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c b/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c index 87ab81dfc1..ccc59b4daf 100644 --- a/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c +++ b/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c @@ -46,7 +46,7 @@ DEFINE_STUB(spdk_mem_unregister, int, (void *vaddr, size_t len), 0); DEFINE_STUB(nvme_get_quirks, uint64_t, (const struct spdk_pci_id *id), 0); -DEFINE_STUB(spdk_nvme_wait_for_completion, int, +DEFINE_STUB(nvme_wait_for_completion, int, (struct spdk_nvme_qpair *qpair, struct nvme_completion_poll_status *status), 0); DEFINE_STUB_V(nvme_completion_poll_cb, (void *arg, const struct spdk_nvme_cpl *cpl)); @@ -72,7 +72,7 @@ DEFINE_STUB(spdk_pci_device_cfg_read16, int, (struct spdk_pci_device *dev, uint1 uint32_t offset), 0); DEFINE_STUB(spdk_pci_device_get_id, struct spdk_pci_id, (struct spdk_pci_device *dev), {0}) -DEFINE_STUB(spdk_uevent_connect, int, (void), 0); +DEFINE_STUB(nvme_uevent_connect, int, (void), 0); struct spdk_log_flag SPDK_LOG_NVME = { .name = "nvme", @@ -102,7 +102,7 @@ struct spdk_uevent_entry { static STAILQ_HEAD(, spdk_uevent_entry) g_uevents = STAILQ_HEAD_INITIALIZER(g_uevents); int -spdk_get_uevent(int fd, struct spdk_uevent *uevent) +nvme_get_uevent(int fd, struct spdk_uevent *uevent) { struct spdk_uevent_entry *entry; @@ -149,7 +149,7 @@ DEFINE_STUB(nvme_get_ctrlr_by_trid_unsafe, struct spdk_nvme_ctrlr *, (const struct spdk_nvme_transport_id *trid), NULL); DEFINE_STUB(spdk_nvme_ctrlr_get_regs_csts, union spdk_nvme_csts_register, (struct spdk_nvme_ctrlr *ctrlr), {}); -DEFINE_STUB(spdk_nvme_ctrlr_get_process, struct spdk_nvme_ctrlr_process *, +DEFINE_STUB(nvme_ctrlr_get_process, struct spdk_nvme_ctrlr_process *, (struct spdk_nvme_ctrlr *ctrlr, pid_t pid), NULL); DEFINE_STUB(nvme_completion_is_retry, bool, (const struct spdk_nvme_cpl *cpl), false); DEFINE_STUB_V(spdk_nvme_qpair_print_command, (struct spdk_nvme_qpair *qpair,