]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
fabrics: Remove 'UUID derived from machine-id' feature
authorDaniel Wagner <dwagner@suse.de>
Tue, 12 Oct 2021 12:26:57 +0000 (14:26 +0200)
committerDaniel Wagner <dwagner@suse.de>
Tue, 12 Oct 2021 12:26:57 +0000 (14:26 +0200)
Commit 3e0520ecad13 ("Read system UUID from DMI and merge hostnqn
generation functions") in nvme-cli introduced the feature to create
the UUID derived from machine-id using the systemd's
sd_id128_get_machine_app_specific function. This adds many library
dependencies to libnvme.

The feature is not really necessary as we have nvme-gen-hostnqn
already in place. So drop the feature entirely.

If the feature needs to be added back, it's probably better to
reimplement this function (e.g. move the hmac_sha256 function from
nvme-cli and use this to derive the UUID from machine-id).

Signed-off-by: Daniel Wagner <dwagner@suse.de>
README.md
configure
meson.build
meson_options.txt
pynvme/setup.py
src/meson.build
src/nvme/fabrics.c

index 2613a52848f4c87eacaaf83a8eb8013ee7844d71..70c13a212243f2004e518224370f5eab74ed3939 100644 (file)
--- a/README.md
+++ b/README.md
@@ -142,17 +142,9 @@ A few build options can be specified on the command line when invoking meson.
 
 | Option  | Values [default]    | Description                                                  |
 | ------- | ------------------- | ------------------------------------------------------------ |
-| systemd | [auto], true, false | Whether to link libsystemd to libnvme. When set to `auto`, the default, meson will check for the presence of library and will only link to it if it is found. When set to `true`, meson will make this library a mandatory dependency. When set to `false`, meson will not link the library to libnvme, even if the library is available. |
 
 ### Changing the build options from the command-line (i.e. w/o modifying any files)
 
-Here's an example where we tell meson that we do not want to link
-against the `systemd` library:
-
-```bash
-meson .build -Dsystemd=false
-```
-
 To configure a build for debugging purposes (i.e. optimization turned
 off and debug symbols enabled):
 
index 5e0e042051d642b1c52c163d0a6a46db6f1a61b0..b21a09823af28415bfc7ad2cbd7d13e68389e4b9 100755 (executable)
--- a/configure
+++ b/configure
@@ -27,8 +27,6 @@ for opt do
   ;;
   --datadir=*) datadir="$optarg"
   ;;
-  --disable-systemd) disable_systemd=1
-  ;;
   --disable-uuid) disable_uuid=1
   ;;
   --disable-json) disable_json=1
@@ -68,7 +66,6 @@ Options: [defaults in brackets after descriptions]
   --libdir=PATH            install libraries in PATH [$libdir]
   --mandir=PATH            install man pages in PATH [$mandir]
   --datadir=PATH           install shared data in PATH [$datadir]
-  --disable-systemd        do not link against libsystemd
   --disable-uuid           do not link against libuuid
   --disable-json           do not link against libjson-c
 EOF
@@ -197,17 +194,6 @@ if [ -z "$disable_uuid" ] ; then
 fi
 print_config "libuuid" "${libuuid}"
 
-##########################################
-# check for SystemD
-systemd="no"
-if [ -z "$disable_systemd" ] ; then
-    pkg-config --exists libsystemd --atleast-version=242
-    if [ $? -eq 0 ]; then
-       systemd="yes"
-    fi
-fi
-print_config "systemd" "${systemd}"
-
 ##########################################
 # check for libjson-c
 libjsonc="no"
@@ -234,10 +220,6 @@ if test "$libuuid" = "yes"; then
   echo "override LIBS += -luuid" >> $config_host_mak
   echo "override LIB_DEPENDS += uuid" >> $config_host_mak 
 fi
-if test "$systemd" = "yes"; then
-  output_sym "CONFIG_SYSTEMD"
-  echo "override LIBS += -lsystemd" >> $config_host_mak
-fi
 if test "$libjsonc" = "yes"; then
     output_sym "CONFIG_JSONC"
     echo "override LIBS += -ljson-c" >> $config_host_mak
index c4092cd64fb7831a7fd00d0ee27f0b23a01cbd61..16f950b9bf7c9623782f118d30c5086bb78fee4e 100644 (file)
@@ -95,17 +95,6 @@ if not libjson.found()
 endif
 conf.set('CONFIG_JSONC', libjson.found(), description: 'Is json-c required?')
 
-# Check for libsystemd availability
-want_systemd = get_option('systemd')
-if want_systemd != 'false'
-    libsystemd = dependency('libsystemd', required: want_systemd == 'true')
-    have = libsystemd.found()
-else
-    libsystemd = []
-    have = false
-endif
-conf.set('CONFIG_SYSTEMD', have, description: 'Is libsystemd required?')
-
 # local (cross-compilable) implementations of ccan configure steps
 conf.set10(
     'HAVE_BUILTIN_TYPES_COMPATIBLE_P',
@@ -210,7 +199,7 @@ pkg.generate(
     description: 'Manage "libnvme" subsystem devices (Non-volatile Memory Express)',
     url: 'http://github.com/linux-nvme/libnvme/',
     libraries: ['-L${libdir}', '-lnvme'],
-    requires: [libuuid, libjson, libsystemd],
+    requires: [libuuid, libjson],
 )
 
 ################################################################################
index f08b27fb3f3ea8e5943846b547ddd5a8f5a5d861..c83da2914d249b5736be99685ee698f97e3c170a 100644 (file)
@@ -3,5 +3,3 @@
 option('pkgconfiglibdir', type : 'string', value : '', description : 'directory for standard pkg-config files')
 
 option('man', type : 'boolean', value : false, description : 'build and install man pages (requires sphinx-build)')
-
-option('systemd', type : 'combo', choices : ['auto', 'true', 'false'], description : 'libsystemd support')
index 8db418aef437c7563c4d4c9d94f1c368d6c6a66e..b7994ea2d001f345d0c9e3244d9215ba8a6b8e81 100644 (file)
@@ -3,7 +3,7 @@ from distutils.core import setup, Extension
 libnvme_module = Extension(
     '_nvme',
     sources = ['nvme_wrap.c'],
-    libraries = ['nvme', 'json-c', 'uuid', 'systemd'],
+    libraries = ['nvme', 'json-c', 'uuid'],
     library_dirs = ['../src'],
     include_dirs = ['../ccan', '../src', '../src/nvme'],
 )
index db03e0414e88d435d26fb4e0cfa276e2020adf04..09da32bf0f556fcf745c0843193d53f01ce83ce1 100644 (file)
@@ -22,7 +22,6 @@ endif
 
 deps = [
     libuuid,
-    libsystemd,
     libjson,
 ]
 
index 3ab93210ed6b80d500fa912e3443138b9566cc3a..21dec686f407ad8dfec115d209d88be01266b5a2 100644 (file)
 #include <netdb.h>
 #include <net/if.h>
 
-#ifdef CONFIG_SYSTEMD
-#include <systemd/sd-id128.h>
-#define NVME_HOSTNQN_ID SD_ID128_MAKE(c7,f4,61,81,12,be,49,32,8c,83,10,6f,9d,dd,d8,6b)
-#endif
-
 #include <ccan/list/list.h>
 #include <ccan/array_size/array_size.h>
 
@@ -841,24 +836,6 @@ static int uuid_from_dmi(char *system_uuid)
        return strlen(system_uuid) ? 0 : -ENXIO;
 }
 
-#ifdef CONFIG_SYSTEMD
-#include <systemd/sd-id128.h>
-#define NVME_HOSTNQN_ID SD_ID128_MAKE(c7,f4,61,81,12,be,49,32,8c,83,10,6f,9d,dd,d8,6b)
-#endif
-
-static int uuid_from_systemd(char *system_uuid)
-{
-       int ret = -ENOTSUP;
-#ifdef CONFIG_SYSTEMD
-       sd_id128_t id;
-
-       ret = sd_id128_get_machine_app_specific(NVME_HOSTNQN_ID, &id);
-       if (!ret)
-               sd_id128_to_string(id, system_uuid);
-#endif
-       return ret;
-}
-
 char *nvmf_hostnqn_generate()
 {
        char *hostnqn;
@@ -871,8 +848,6 @@ char *nvmf_hostnqn_generate()
        ret = uuid_from_dmi(uuid_str);
        if (ret < 0) {
                ret = uuid_from_device_tree(uuid_str);
-               if (ret < 0)
-                       ret = uuid_from_systemd(uuid_str);
        }
 #ifdef CONFIG_LIBUUID
        if (ret < 0) {