diff mbox series

[RFC,05/11] nvmet: Add function to print trtype

Message ID 20250313052222.178524-6-michael.christie@oracle.com (mailing list archive)
State New
Headers show
Series nvmet: Add NVMe target mdev/vfio driver | expand

Commit Message

Mike Christie March 13, 2025, 5:18 a.m. UTC
This adds a helper to print the trtype. It will be used by the
configs controller code.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/nvme/target/configfs.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index e44ef69dffc2..896ae65e4918 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -329,14 +329,12 @@  static ssize_t nvmet_param_pi_enable_store(struct config_item *item,
 CONFIGFS_ATTR(nvmet_, param_pi_enable);
 #endif
 
-static ssize_t nvmet_addr_trtype_show(struct config_item *item,
-		char *page)
+static ssize_t nvmet_trtype_show(int trtype, char *page)
 {
-	struct nvmet_port *port = to_nvmet_port(item);
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(nvmet_transport); i++) {
-		if (port->disc_addr.trtype == nvmet_transport[i].type)
+		if (trtype == nvmet_transport[i].type)
 			return snprintf(page, PAGE_SIZE,
 					"%s\n", nvmet_transport[i].name);
 	}
@@ -344,6 +342,14 @@  static ssize_t nvmet_addr_trtype_show(struct config_item *item,
 	return sprintf(page, "\n");
 }
 
+static ssize_t nvmet_addr_trtype_show(struct config_item *item,
+		char *page)
+{
+	struct nvmet_port *port = to_nvmet_port(item);
+
+	return nvmet_trtype_show(port->disc_addr.trtype, page);
+}
+
 static void nvmet_port_init_tsas_rdma(struct nvmet_port *port)
 {
 	port->disc_addr.tsas.rdma.qptype = NVMF_RDMA_QPTYPE_CONNECTED;