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>
| 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):
;;
--datadir=*) datadir="$optarg"
;;
- --disable-systemd) disable_systemd=1
- ;;
--disable-uuid) disable_uuid=1
;;
--disable-json) disable_json=1
--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
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"
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
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',
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],
)
################################################################################
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')
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'],
)
deps = [
libuuid,
- libsystemd,
libjson,
]
#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>
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;
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) {