From d25c43c8cd6cc3a15529a367b68df21e25e61c26 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 13 May 2024 11:21:37 +0200 Subject: [PATCH] cleanup: remove unuable code path Eliminate some ancient unreachable code for historical version of libdm. --- device_mapper/ioctl/libdm-iface.c | 18 +----------------- libdm/ioctl/libdm-iface.c | 18 +----------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/device_mapper/ioctl/libdm-iface.c b/device_mapper/ioctl/libdm-iface.c index dc7abb389..5800154f3 100644 --- a/device_mapper/ioctl/libdm-iface.c +++ b/device_mapper/ioctl/libdm-iface.c @@ -87,8 +87,6 @@ static int _version_checked = 0; static int _version_ok = 1; static unsigned _ioctl_buffer_double_factor = 0; -const int _dm_compat = 0; - /* *INDENT-OFF* */ static const struct cmd_data _cmd_data_v4[] = { {"create", DM_DEV_CREATE, {4, 0, 0}}, @@ -597,23 +595,9 @@ int dm_check_version(void) _version_checked = 1; - if (_check_version(dmversion, sizeof(dmversion), _dm_compat)) + if (_check_version(dmversion, sizeof(dmversion), 0)) return 1; - if (!_dm_compat) - goto_bad; - - log_verbose("device-mapper ioctl protocol version %u failed. " - "Trying protocol version 1.", _dm_version); - _dm_version = 1; - if (_check_version(dmversion, sizeof(dmversion), 0)) { - log_verbose("Using device-mapper ioctl protocol version 1"); - return 1; - } - - compat = "(compat)"; - - bad: dm_get_library_version(libversion, sizeof(libversion)); log_error("Incompatible libdevmapper %s%s and kernel driver %s.", diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index 5bb385366..a579578c9 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -86,8 +86,6 @@ static int _version_checked = 0; static int _version_ok = 1; static unsigned _ioctl_buffer_double_factor = 0; -const int _dm_compat = 0; - /* *INDENT-OFF* */ static const struct cmd_data _cmd_data_v4[] = { {"create", DM_DEV_CREATE, {4, 0, 0}}, @@ -590,23 +588,9 @@ int dm_check_version(void) _version_checked = 1; - if (_check_version(dmversion, sizeof(dmversion), _dm_compat)) + if (_check_version(dmversion, sizeof(dmversion), 0)) return 1; - if (!_dm_compat) - goto_bad; - - log_verbose("device-mapper ioctl protocol version %u failed. " - "Trying protocol version 1.", _dm_version); - _dm_version = 1; - if (_check_version(dmversion, sizeof(dmversion), 0)) { - log_verbose("Using device-mapper ioctl protocol version 1"); - return 1; - } - - compat = "(compat)"; - - bad: dm_get_library_version(libversion, sizeof(libversion)); log_error("Incompatible libdevmapper %s%s and kernel driver %s.",