File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
#include "swap.h"
2
2
3
3
#include <OS.h>
4
+ #include <driver_settings.h>
4
5
5
- const char * ffDetectSwap (FFSwapResult * swap )
6
+ const char * ffDetectSwap (FFlist * result )
6
7
{
7
8
system_info info ;
8
9
if (get_system_info (& info ) != B_OK )
9
10
return "Error getting system info" ;
10
11
11
12
uint32_t pageSize = instance .state .platform .sysinfo .pageSize ;
13
+ FFSwapResult * swap = ffListAdd (result );
14
+ ffStrbufInitStatic (& swap -> name , "System" );
15
+ void * kvms = load_driver_settings ("virtual_memory" ); // /boot/home/config/settings/kernel/drivers/virtual_memory
16
+ if (kvms )
17
+ {
18
+ const char * swapAuto = get_driver_parameter (kvms , "swap_auto" , NULL , NULL );
19
+ if (swapAuto )
20
+ ffStrbufSetStatic (& swap -> name , swapAuto [0 ] == 'y' ? "Auto" : "Manual" );
21
+ unload_driver_settings (kvms );
22
+ }
12
23
swap -> bytesTotal = pageSize * (uint64_t ) info .max_swap_pages ;
13
24
swap -> bytesUsed = pageSize * (uint64_t ) (info .max_swap_pages - info .free_swap_pages );
14
25
You can’t perform that action at this time.
0 commit comments