From: Daniel Wagner Date: Tue, 15 Mar 2022 18:25:22 +0000 (+0100) Subject: fabrics: Honor sysconfdir for hostnqn and hostid files X-Git-Tag: v2.0-rc7~14^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fea4931ee21719a456457d428f42e0122d45ff21;p=users%2Fsagi%2Fnvme-cli.git fabrics: Honor sysconfdir for hostnqn and hostid files When sysconfdir is set during build the hostnqn and hostid file should be installed under this path. Replace the hard coded path and also update the documentation. Signed-off-by: Daniel Wagner --- diff --git a/Documentation/meson.build b/Documentation/meson.build index cf19ba7c..e2101494 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -178,9 +178,13 @@ if want_docs != 'false' if xmlto.found() foreach adoc : adoc_sources input = adoc + '.txt' + subst = configure_file( + input: adoc + '.txt', + output: adoc + '.msubst', + configuration: substs) xml = custom_target( adoc.underscorify() + '_xml', - input: adoc + '.txt', + input: subst, output: '@BASENAME@.xml', command: [asciidoctor, '-f', files('asciidoc.conf'), @@ -209,9 +213,13 @@ if want_docs != 'false' if want_docs == 'all' or want_docs == 'html' foreach adoc : adoc_sources input = adoc + '.txt' + subst = configure_file( + input: adoc + '.txt', + output: adoc + '.hsubst', + configuration: substs) custom_target( adoc.underscorify() + '_html', - input: adoc + '.txt', + input: subst, output: '@BASENAME@.html', command: [asciidoctor, '-f', files('asciidoc.conf'), diff --git a/Documentation/nvme-connect-all.txt b/Documentation/nvme-connect-all.txt index 7ab8d35a..605d2459 100644 --- a/Documentation/nvme-connect-all.txt +++ b/Documentation/nvme-connect-all.txt @@ -38,9 +38,9 @@ Send one or more Discovery requests to a NVMe over Fabrics Discovery Controller, and create controllers for the returned discovery records. If no parameters are given, then 'nvme connect-all' will attempt to -find a /etc/nvme/discovery.conf file to use to supply a list of -connect-all commands to run. If no /etc/nvme/discovery.conf file exists, -the command will quit with an error. +find a @SYSCONFDIR@/nvme/discovery.conf file to use to supply a list of +connect-all commands to run. If no @SYSCONFDIR@/nvme/discovery.conf file +exists, the command will quit with an error. Otherwise a specific Discovery Controller should be specified using the --transport, --traddr and if necessary the --trsvcid and a Diѕcovery @@ -97,8 +97,8 @@ OPTIONS --hostnqn=:: Overrides the default Host NQN that identifies the NVMe Host. If this option is not specified, the default is read from - /etc/nvme/hostnqn first. If that does not exist, the autogenerated - NQN value from the NVMe Host kernel module is used next. + @SYSCONFDIR@/nvme/hostnqn first. If that does not exist, the + autogenerated NQN value from the NVMe Host kernel module is used next. The Host NQN uniquely identifies the NVMe Host, and may be used by the the Discovery Controller to control what NVMe Target resources are allocated to the NVMe Host for a connection. @@ -117,7 +117,7 @@ OPTIONS -C :: --config-file=:: Use the specified JSON configuration file instead of the - default /etc/nvme/config.json file or 'none' to not read in + default @SYSCONFDIR@/nvme/config.json file or 'none' to not read in an existing configuration file. The JSON configuration file format is documented in https://github.com/linux-nvme/libnvme/doc/config-schema.json @@ -190,7 +190,7 @@ the RDMA network. Port 4420 is used by default: --hostnqn=host1-rogue-nqn ------------ + -* Issue a 'nvme connect-all' command using a /etc/nvme/discovery.conf file: +* Issue a 'nvme connect-all' command using a @SYSCONFDIR@/nvme/discovery.conf file: + ----------- # Machine default 'nvme discover' commands. Query the diff --git a/Documentation/nvme-connect.txt b/Documentation/nvme-connect.txt index 300c7262..f57b34dd 100644 --- a/Documentation/nvme-connect.txt +++ b/Documentation/nvme-connect.txt @@ -88,7 +88,7 @@ OPTIONS --hostnqn=:: Overrides the default Host NQN that identifies the NVMe Host. If this option is not specified, the default is read from - /etc/nvme/hostnqn first. If that does not exist, the autogenerated + @SYSCONFDIR@/nvme/hostnqn first. If that does not exist, the autogenerated NQN value from the NVMe Host kernel module is used next. The Host NQN uniquely identifies the NVMe Host. @@ -100,7 +100,7 @@ OPTIONS -J :: --config-file=:: Use the specified JSON configuration file instead of the - default /etc/nvme/config.json file or 'none' to not read in + default @SYSCONFDIR@/nvme/config.json file or 'none' to not read in an existing configuration file. The JSON configuration file format is documented in https://github.com/linux-nvme/libnvme/doc/config-schema.json @@ -110,7 +110,7 @@ OPTIONS NVMe In-band authentication secret; needs to be in ASCII format as specified in NVMe 2.0 section 8.13.5.8 'Secret representation'. If this option is not specified, the default is read from - /etc/nvme/hostkey. If that does not exist no in-band authentication + @SYSCONFDIR@/nvme/hostkey. If that does not exist no in-band authentication is attempted. -C :: diff --git a/Documentation/nvme-discover.txt b/Documentation/nvme-discover.txt index b7311aa9..a6321232 100644 --- a/Documentation/nvme-discover.txt +++ b/Documentation/nvme-discover.txt @@ -40,8 +40,8 @@ Send one or more Get Log Page requests to a NVMe-over-Fabrics Discovery Controller. If no parameters are given, then 'nvme discover' will attempt to -find a /etc/nvme/discovery.conf file to use to supply a list of -Discovery commands to run. If no /etc/nvme/discovery.conf file +find a @SYSCONFDIR@/nvme/discovery.conf file to use to supply a list of +Discovery commands to run. If no @SYSCONFDIR@/nvme/discovery.conf file exists, the command will quit with an error. Otherwise, a specific Discovery Controller should be specified using the @@ -120,8 +120,8 @@ OPTIONS --hostnqn=:: Overrides the default host NQN that identifies the NVMe Host. If this option is not specified, the default is read from - /etc/nvme/hostnqn first. If that does not exist, the autogenerated - NQN value from the NVMe Host kernel module is used next. + @SYSCONFDIR@/nvme/hostnqn first. If that does not exist, the + autogenerated NQN value from the NVMe Host kernel module is used next. -I :: --hostid=:: @@ -142,7 +142,7 @@ OPTIONS -C :: --config-file=:: Use the specified JSON configuration file instead of the - default /etc/nvme/config.json file or 'none' to not read in + default @SYSCONFDIR@/nvme/config.json file or 'none' to not read in an existing configuration file. The JSON configuration file format is documented in https://github.com/linux-nvme/libnvme/doc/config-schema.json @@ -219,7 +219,7 @@ Port 4420 is used by default: --hostnqn=host1-rogue-nqn ------------ + -* Issue a 'nvme discover' command using a /etc/nvme/discovery.conf file: +* Issue a 'nvme discover' command using a @SYSCONFDIR@/nvme/discovery.conf file: + ----------- # Machine default 'nvme discover' commands. Query the diff --git a/Documentation/nvme-show-hostnqn.txt b/Documentation/nvme-show-hostnqn.txt index 044346ca..58263d86 100644 --- a/Documentation/nvme-show-hostnqn.txt +++ b/Documentation/nvme-show-hostnqn.txt @@ -12,7 +12,7 @@ SYNOPSIS DESCRIPTION ----------- -Show the host NQN configured for the system. If /etc/nvme/hostnqn is +Show the host NQN configured for the system. If @SYSCONFDIR@/nvme/hostnqn is not present and systemd application-specific machine IDs are available, this will show the systemd-generated host NQN for the system. diff --git a/fabrics.c b/fabrics.c index e08ffd65..73c887a4 100644 --- a/fabrics.c +++ b/fabrics.c @@ -42,8 +42,8 @@ #include "libnvme.h" #include "nvme-print.h" -#define PATH_NVMF_DISC "/etc/nvme/discovery.conf" -#define PATH_NVMF_CONFIG "/etc/nvme/config.json" +#define PATH_NVMF_DISC "SYSCONFDIR/nvme/discovery.conf" +#define PATH_NVMF_CONFIG "SYSCONFDIR/nvme/config.json" #define MAX_DISC_ARGS 32 #define MAX_DISC_RETRIES 10 diff --git a/meson.build b/meson.build index bd963f27..b18eedb5 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,7 @@ includedir = join_paths(prefixdir, get_option('includedir')) datadir = join_paths(prefixdir, get_option('datadir')) mandir = join_paths(prefixdir, get_option('mandir')) bindir = join_paths(prefixdir, get_option('bindir')) +sbindir = join_paths(prefixdir, get_option('sbindir')) sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) udevrulesdir = join_paths(prefixdir, get_option('udevrulesdir')) @@ -31,6 +32,8 @@ systemddir = join_paths(prefixdir, get_option('systemddir')) conf = configuration_data() requires = '' +conf.set('SYSCONFDIR', sysconfdir) + libnvme_dep = dependency('libnvme', fallback : ['libnvme', 'libnvme_dep']) # Check for libuuid availability