[PATCH v2 7/9] fabrics: use "const char *" in struct config
From: <hidden>
Date: 2021-03-30 16:01:14
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Martin Wilck <redacted> This is easily done, and allows passing in some const char* pointers that would otherwise need to be strdup()d first. Do not use const char * for cfg->device, because we may need to free() it. Reviewed-by: Chaitanya Kulkarni <redacted> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Martin Wilck <redacted> --- fabrics.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fabrics.c b/fabrics.c
index 4a5c2f9..9a694bd 100644
--- a/fabrics.c
+++ b/fabrics.c@@ -67,13 +67,13 @@ const char *conarg_trsvcid = "trsvcid"; const char *conarg_host_traddr = "host_traddr"; static struct config { - char *nqn; - char *transport; - char *traddr; - char *trsvcid; - char *host_traddr; - char *hostnqn; - char *hostid; + const char *nqn; + const char *transport; + const char *traddr; + const char *trsvcid; + const char *host_traddr; + const char *hostnqn; + const char *hostid; int nr_io_queues; int nr_write_queues; int nr_poll_queues;
@@ -82,7 +82,7 @@ static struct config { int reconnect_delay; int ctrl_loss_tmo; int tos; - char *raw; + const char *raw; char *device; int duplicate_connect; int disable_sqflow;
@@ -90,7 +90,7 @@ static struct config { int data_digest; bool persistent; bool matching_only; - char *output_format; + const char *output_format; } cfg = { .ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO, .output_format = "normal",
--
2.30.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme