From 04b13096ace95803995c5eeadcafc445ab7fb35b Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 4 Jun 2025 22:01:16 +0800 Subject: [PATCH] Swap (Haiku): detect detailed info --- src/detection/swap/swap_haiku.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/detection/swap/swap_haiku.c b/src/detection/swap/swap_haiku.c index 718f28387..b483668b3 100644 --- a/src/detection/swap/swap_haiku.c +++ b/src/detection/swap/swap_haiku.c @@ -1,14 +1,25 @@ #include "swap.h" #include +#include -const char* ffDetectSwap(FFSwapResult* swap) +const char* ffDetectSwap(FFlist* result) { system_info info; if (get_system_info(&info) != B_OK) return "Error getting system info"; uint32_t pageSize = instance.state.platform.sysinfo.pageSize; + FFSwapResult* swap = ffListAdd(result); + ffStrbufInitStatic(&swap->name, "System"); + void* kvms = load_driver_settings("virtual_memory"); // /boot/home/config/settings/kernel/drivers/virtual_memory + if (kvms) + { + const char* swapAuto = get_driver_parameter(kvms, "swap_auto", NULL, NULL); + if (swapAuto) + ffStrbufSetStatic(&swap->name, swapAuto[0] == 'y' ? "Auto" : "Manual"); + unload_driver_settings(kvms); + } swap->bytesTotal = pageSize * (uint64_t) info.max_swap_pages; swap->bytesUsed = pageSize * (uint64_t) (info.max_swap_pages - info.free_swap_pages);