From: Hannes Reinecke <hare@suse.de>
To: mwilck@suse.com, Keith Busch <kbusch@kernel.org>,
linux-nvme@lists.infradead.org
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Subject: Re: [PATCH 10/35] fabrics: export do_discover(), build_options() and config
Date: Thu, 4 Feb 2021 08:09:21 +0100 [thread overview]
Message-ID: <5572e869-cd25-15ca-e95b-b4304e19d83b@suse.de> (raw)
In-Reply-To: <20210126203324.23610-11-mwilck@suse.com>
On 1/26/21 9:32 PM, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
>
> These functions will be called by the monitor code.
> Also export BUF_SIZE as the size of argstr.
>
> Being able to access struct config and the "cfg" variable
> from fabrics.c is essential for the monitor to leverage the existing,
> well tested code as much as possible.
>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
> fabrics.c | 33 ++++-----------------------------
> fabrics.h | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 38 insertions(+), 29 deletions(-)
>
> diff --git a/fabrics.c b/fabrics.c
> index 555b6b4..c1a4bb5 100644
> --- a/fabrics.c
> +++ b/fabrics.c
> @@ -69,31 +69,7 @@ const char *conarg_traddr = "traddr";
> 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;
> - int nr_io_queues;
> - int nr_write_queues;
> - int nr_poll_queues;
> - int queue_size;
> - int keep_alive_tmo;
> - int reconnect_delay;
> - int ctrl_loss_tmo;
> - int tos;
> - char *raw;
> - char *device;
> - int duplicate_connect;
> - int disable_sqflow;
> - int hdr_digest;
> - int data_digest;
> - bool persistent;
> - bool matching_only;
> -} cfg = { .ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO };
> +struct config cfg = { .ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO };
>
> struct connect_args {
> char *subsysnqn;
> @@ -107,7 +83,6 @@ struct connect_args {
>
> struct connect_args *tracked_ctrls;
>
> -#define BUF_SIZE 4096
> #define PATH_NVME_FABRICS "/dev/nvme-fabrics"
> #define PATH_NVMF_DISC "/etc/nvme/discovery.conf"
> #define PATH_NVMF_HOSTNQN "/etc/nvme/hostnqn"
> @@ -226,7 +201,7 @@ static const char *cms_str(__u8 cm)
> return arg_str(cms, ARRAY_SIZE(cms), cm);
> }
>
> -static int do_discover(char *argstr, bool connect);
> +int do_discover(char *argstr, bool connect);
>
> /*
> * parse strings with connect arguments to find a particular field.
> @@ -855,7 +830,7 @@ add_argument(char **argstr, int *max_len, char *arg_str, char *arg)
> return 0;
> }
>
> -static int build_options(char *argstr, int max_len, bool discover)
> +int build_options(char *argstr, int max_len, bool discover)
> {
> int len;
>
> @@ -1264,7 +1239,7 @@ static void nvmf_get_host_identifiers(int ctrl_instance)
> cfg.hostid = nvme_get_ctrl_attr(path, "hostid");
> }
>
> -static int do_discover(char *argstr, bool connect)
> +int do_discover(char *argstr, bool connect)
> {
> struct nvmf_disc_rsp_page_hdr *log = NULL;
> char *dev_name;
> diff --git a/fabrics.h b/fabrics.h
> index f5b8eaf..ce965a3 100644
> --- a/fabrics.h
> +++ b/fabrics.h
> @@ -10,4 +10,38 @@ extern int fabrics_connect(const char *desc, int argc, char **argv);
> extern int fabrics_disconnect(const char *desc, int argc, char **argv);
> extern int fabrics_disconnect_all(const char *desc, int argc, char **argv);
>
> +/* Symbols used by monitor.c */
> +
> +struct config {
> + char *nqn;
> + char *transport;
> + char *traddr;
> + char *trsvcid;
> + char *host_traddr;
> + char *hostnqn;
> + char *hostid;
> + int nr_io_queues;
> + int nr_write_queues;
> + int nr_poll_queues;
> + int queue_size;
> + int keep_alive_tmo;
> + int reconnect_delay;
> + int ctrl_loss_tmo;
> + int tos;
> + char *raw;
> + char *device;
> + int duplicate_connect;
> + int disable_sqflow;
> + int hdr_digest;
> + int data_digest;
> + bool persistent;
> + bool matching_only;
> +};
> +extern struct config cfg;
> +
> +#define BUF_SIZE 4096
> +
> +int build_options(char *argstr, int max_len, bool discover);
> +int do_discover(char *argstr, bool connect);
> +
> #endif
>
Please name is 'struct config fabrics_cfg'. 'cfg' is used as a generic
name throughout the code, and using the same name in a header might lead
to an accidental name clash.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-02-04 7:09 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 20:32 [PATCH 00/35] RFC: add "nvme monitor" subcommand mwilck
2021-01-26 20:32 ` [PATCH 01/35] nvme-monitor: add new stub mwilck
2021-01-26 20:32 ` [PATCH 02/35] monitor: create udev socket mwilck
2021-01-26 20:32 ` [PATCH 03/35] monitor: initialize signal handling mwilck
2021-01-26 20:32 ` [PATCH 04/35] monitor: add main loop for uevent monitoring mwilck
2021-01-26 20:32 ` [PATCH 05/35] monitor: add uevent filters mwilck
2021-02-04 6:58 ` Hannes Reinecke
2021-01-26 20:32 ` [PATCH 06/35] monitor: Create a log() macro mwilck
2021-02-04 7:01 ` Hannes Reinecke
2021-02-04 9:14 ` Martin Wilck
2021-01-26 20:32 ` [PATCH 07/35] fabrics: use " mwilck
2021-02-04 7:02 ` Hannes Reinecke
2021-01-26 20:32 ` [PATCH 08/35] monitor: add command line options to control logging mwilck
2021-02-04 7:04 ` Hannes Reinecke
2021-02-04 9:18 ` Martin Wilck
2021-01-26 20:32 ` [PATCH 09/35] nvme_get_ctrl_attr(): constify "path" argument mwilck
2021-02-04 7:05 ` Hannes Reinecke
2021-01-26 20:32 ` [PATCH 10/35] fabrics: export do_discover(), build_options() and config mwilck
2021-02-04 7:09 ` Hannes Reinecke [this message]
2021-02-04 9:21 ` Martin Wilck
2021-01-26 20:33 ` [PATCH 11/35] monitor: add option -A / --autoconnect mwilck
2021-01-29 18:59 ` Sagi Grimberg
2021-01-29 19:33 ` Martin Wilck
2021-01-29 20:09 ` Sagi Grimberg
2021-02-04 7:13 ` Hannes Reinecke
2021-01-26 20:33 ` [PATCH 12/35] monitor: add helpers for __attribute__((cleanup)) mwilck
2021-02-04 7:14 ` Hannes Reinecke
2021-01-26 20:33 ` [PATCH 13/35] monitor: disable nvmf-autoconnect udev rules in autoconnect mode mwilck
2021-01-29 1:52 ` Sagi Grimberg
2021-01-29 14:16 ` Martin Wilck
2021-01-29 18:54 ` Sagi Grimberg
2021-02-04 7:16 ` Hannes Reinecke
2021-02-04 9:37 ` Martin Wilck
2021-01-26 20:33 ` [PATCH 14/35] monitor: implement handling of fc_udev_device mwilck
2021-01-26 20:33 ` [PATCH 15/35] monitor: implement handling of nvme AEN events mwilck
2021-01-26 20:33 ` [PATCH 16/35] monitor: reset children's signal disposition mwilck
2021-01-29 1:54 ` Sagi Grimberg
2021-01-29 14:18 ` Martin Wilck
2021-01-26 20:33 ` [PATCH 17/35] monitor: handle SIGCHLD for terminated child processes mwilck
2021-01-29 1:54 ` Sagi Grimberg
2021-01-26 20:33 ` [PATCH 18/35] monitor: add "--persistent/-p" flag mwilck
2021-01-29 19:02 ` Sagi Grimberg
2021-01-29 19:45 ` Martin Wilck
2021-01-26 20:33 ` [PATCH 19/35] fabrics: use "const char *" in struct config mwilck
2021-02-04 7:20 ` Hannes Reinecke
2021-01-26 20:33 ` [PATCH 20/35] fabrics: export arg_str(), parse_conn_arg(), and remove_ctrl() mwilck
2021-01-26 20:33 ` [PATCH 21/35] nvme-cli: add "list.h" mwilck
2021-01-26 20:33 ` [PATCH 22/35] conn-db: add simple connection registry mwilck
2021-01-29 1:59 ` Sagi Grimberg
2021-01-29 14:18 ` Martin Wilck
2021-01-26 20:33 ` [PATCH 23/35] monitor: handle restart of pending discoveries mwilck
2021-01-26 20:33 ` [PATCH 24/35] monitor: monitor_discovery(): try to reuse existing controllers mwilck
2021-01-26 20:33 ` [PATCH 25/35] monitor: read existing connections on startup mwilck
2021-01-26 20:33 ` [PATCH 26/35] monitor: implement starting discovery controllers " mwilck
2021-01-29 21:06 ` Sagi Grimberg
2021-01-29 21:13 ` Martin Wilck
2021-01-29 21:18 ` Sagi Grimberg
2021-01-26 20:33 ` [PATCH 27/35] monitor: implement cleanup of created discovery controllers mwilck
2021-01-26 20:33 ` [PATCH 28/35] monitor: basic handling of add/remove uevents for nvme controllers mwilck
2021-01-26 20:33 ` [PATCH 29/35] monitor: kill running discovery tasks on exit mwilck
2021-01-26 20:33 ` [PATCH 30/35] monitor: add connection property options from connect-all mwilck
2021-01-26 20:33 ` [PATCH 31/35] completions: add completions for nvme monitor mwilck
2021-01-26 20:33 ` [PATCH 32/35] nvmf-autoconnect: add unit file for nvme-monitor.service mwilck
2021-01-29 19:08 ` Sagi Grimberg
2021-01-29 19:50 ` Martin Wilck
2021-01-26 20:33 ` [PATCH 33/35] nvme-connect-all(1): fix documentation for --quiet/-S mwilck
2021-01-29 19:09 ` Sagi Grimberg
2021-01-26 20:33 ` [PATCH 34/35] nvme-monitor(1): add man page for nvme-monitor mwilck
2021-01-26 20:33 ` [PATCH 35/35] monitor: add option --keep/-K mwilck
2021-01-29 19:10 ` Sagi Grimberg
2021-01-29 19:53 ` Martin Wilck
2021-01-29 20:16 ` Sagi Grimberg
2021-01-29 20:30 ` Martin Wilck
2021-01-29 20:45 ` Sagi Grimberg
2021-01-29 20:51 ` Martin Wilck
2021-01-29 20:57 ` Sagi Grimberg
2021-01-29 21:05 ` Martin Wilck
2021-01-29 21:11 ` Sagi Grimberg
2021-01-29 21:15 ` Martin Wilck
2021-01-29 21:21 ` Sagi Grimberg
2021-02-04 7:34 ` Hannes Reinecke
2021-02-04 9:41 ` Martin Wilck
2021-01-29 1:14 ` [PATCH 00/35] RFC: add "nvme monitor" subcommand Sagi Grimberg
2021-01-29 11:18 ` Martin Wilck
2021-01-29 20:08 ` Sagi Grimberg
2021-01-29 20:27 ` Martin Wilck
2021-02-04 7:52 ` Hannes Reinecke
2021-02-22 19:02 ` Enzo Matsumiya
2021-02-22 21:05 ` Martin Wilck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5572e869-cd25-15ca-e95b-b4304e19d83b@suse.de \
--to=hare@suse.de \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mwilck@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox