]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: Honor sysconfdir for hostnqn and hostid files
authorDaniel Wagner <dwagner@suse.de>
Tue, 15 Mar 2022 18:25:22 +0000 (19:25 +0100)
committerDaniel Wagner <dwagner@suse.de>
Tue, 15 Mar 2022 18:25:22 +0000 (19:25 +0100)
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 <dwagner@suse.de>
Documentation/meson.build
Documentation/nvme-connect-all.txt
Documentation/nvme-connect.txt
Documentation/nvme-discover.txt
Documentation/nvme-show-hostnqn.txt
fabrics.c
meson.build

index cf19ba7c49de20fb869662f8441611d0b33e777e..e210149465d9ac809b8d2337a895831712ee2db9 100644 (file)
@@ -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'),
index 7ab8d35ade70a94b038ee09c51ea934fbef25ed9..605d2459bf32fd1840e9342506911fd5e2a12979 100644 (file)
@@ -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=<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 <cfg>::
 --config-file=<cfg>::
        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
index 300c72620ad8814bd5dd9d14bd907e1f3f2e79f5..f57b34dd68a19b2de0efffab9d7785ef5da27ed9 100644 (file)
@@ -88,7 +88,7 @@ OPTIONS
 --hostnqn=<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 <cfg>::
 --config-file=<cfg>::
        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 <secret>::
index b7311aa9214ae09427fcfb4899ccdd23e1db6b7f..a63212329a47ff406045d380225912c9970dbbce 100644 (file)
@@ -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=<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>::
 --hostid=<hostid>::
@@ -142,7 +142,7 @@ OPTIONS
 -C <cfg>::
 --config-file=<cfg>::
        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
index 044346caf3732263d2bb1ee7498e37a1747de3b3..58263d86092676396b812277374e690979156a2a 100644 (file)
@@ -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.
 
index e08ffd6536414b68e3d5c4f7f182b397f213ef31..73c887a4945c95b9ccab7fbc7ebe1e0c19c8a685 100644 (file)
--- 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
 
index bd963f2782f11d923b638b9548d809bced5c9dc0..b18eedb58288d11078923ec9ff90814b3aed95c6 100644 (file)
@@ -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