[LTP] [PATCH v2 4/5] libswap: Remove now unused tst_max_swapfiles()
Petr Vorel
pvorel@suse.cz
Thu Nov 6 17:34:59 CET 2025
The only use in swapon03 was removed in the previous commit.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
The same as in v1.
include/libswap.h | 7 -----
libs/swap/libswap.c | 64 ---------------------------------------------
2 files changed, 71 deletions(-)
diff --git a/include/libswap.h b/include/libswap.h
index 6904e8f45b..b22b992eeb 100644
--- a/include/libswap.h
+++ b/include/libswap.h
@@ -109,13 +109,6 @@ int make_swapfile(const char *file, const int lineno,
*/
bool is_swap_supported(const char *filename);
-/**
- * tst_max_swapfiles() - Get kernel constant MAX_SWAPFILES value.
- *
- * Return: MAX_SWAPFILES value.
- */
-int tst_max_swapfiles(void);
-
/**
* tst_count_swaps() - Get the used swapfiles number.
*
diff --git a/libs/swap/libswap.c b/libs/swap/libswap.c
index 734cd2612d..3eb589cdd7 100644
--- a/libs/swap/libswap.c
+++ b/libs/swap/libswap.c
@@ -239,70 +239,6 @@ bool is_swap_supported(const char *filename)
return true;
}
-int tst_max_swapfiles(void)
-{
- unsigned int swp_migration_num = 0, swp_hwpoison_num = 0,
- swp_device_num = 0, swp_pte_marker_num = 0,
- swp_swapin_error_num = 0;
- struct tst_kconfig_var migration = TST_KCONFIG_INIT("CONFIG_MIGRATION");
- struct tst_kconfig_var memory = TST_KCONFIG_INIT("CONFIG_MEMORY_FAILURE");
- struct tst_kconfig_var device = TST_KCONFIG_INIT("CONFIG_DEVICE_PRIVATE");
- struct tst_kconfig_var marker = TST_KCONFIG_INIT("CONFIG_PTE_MARKER");
- struct tst_kern_exv kvers_marker_migration[] = {
- /* RHEL9 kernel has patch 6c287605f and 679d10331 since 5.14.0-179 */
- { "RHEL9", "5.14.0-179" },
- { NULL, NULL},
- };
-
- struct tst_kern_exv kvers_marker_migration2[] = {
- /* RHEL9 kernel has patch ca92ea3dc5a since 5.14.0-441 */
- { "RHEL9", "5.14.0-441" },
- { NULL, NULL},
- };
-
- struct tst_kern_exv kvers_device[] = {
- /* SLES12-SP4 has patch 5042db43cc26 since 4.12.14-5.5 */
- { "SLES", "4.12.14-5.5" },
- { NULL, NULL},
- };
-
- tst_kconfig_read(&migration, 1);
- tst_kconfig_read(&memory, 1);
- tst_kconfig_read(&device, 1);
- tst_kconfig_read(&marker, 1);
-
- if (migration.choice == 'y') {
- if (tst_kvercmp2(5, 19, 0, kvers_marker_migration) < 0)
- swp_migration_num = 2;
- else
- swp_migration_num = 3;
- }
-
- if (memory.choice == 'y')
- swp_hwpoison_num = 1;
-
- if (device.choice == 'y') {
- if (tst_kvercmp2(4, 14, 0, kvers_device) >= 0)
- swp_device_num = 2;
- if (tst_kvercmp(5, 14, 0) >= 0)
- swp_device_num = 4;
- if (tst_kvercmp(6, 15, 0) >= 0)
- swp_device_num = 3;
- }
-
- if ((marker.choice == 'y' &&
- tst_kvercmp2(5, 19, 0, kvers_marker_migration) >= 0)
- || tst_kvercmp2(6, 2, 0, kvers_marker_migration2) >= 0) {
- swp_pte_marker_num = 1;
- }
-
- if ((tst_kvercmp(5, 19, 0) >= 0) && (tst_kvercmp(6, 2, 0) < 0))
- swp_swapin_error_num = 1;
-
- return DEFAULT_MAX_SWAPFILE - swp_migration_num - swp_hwpoison_num
- - swp_device_num - swp_pte_marker_num - swp_swapin_error_num;
-}
-
int tst_count_swaps(void)
{
FILE *fp;
--
2.51.0
More information about the ltp
mailing list