mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
swap: Move two functions to swap.h
This commit is contained in:
@@ -11,27 +11,6 @@
|
||||
#include "swap.h"
|
||||
#include "unit.h"
|
||||
|
||||
static int swap_get_priority(Swap *s) {
|
||||
assert(s);
|
||||
|
||||
if (s->from_proc_swaps && s->parameters_proc_swaps.priority_set)
|
||||
return s->parameters_proc_swaps.priority;
|
||||
|
||||
if (s->from_fragment && s->parameters_fragment.priority_set)
|
||||
return s->parameters_fragment.priority;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char *swap_get_options(Swap *s) {
|
||||
assert(s);
|
||||
|
||||
if (s->from_fragment)
|
||||
return s->parameters_fragment.options;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static BUS_DEFINE_PROPERTY_GET(property_get_priority, "i", Swap, swap_get_priority);
|
||||
static BUS_DEFINE_PROPERTY_GET(property_get_options, "s", Swap, swap_get_options);
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, swap_result, SwapResult);
|
||||
|
||||
@@ -1559,6 +1559,27 @@ static int swap_can_start(Unit *u) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int swap_get_priority(const Swap *s) {
|
||||
assert(s);
|
||||
|
||||
if (s->from_proc_swaps && s->parameters_proc_swaps.priority_set)
|
||||
return s->parameters_proc_swaps.priority;
|
||||
|
||||
if (s->from_fragment && s->parameters_fragment.priority_set)
|
||||
return s->parameters_fragment.priority;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* swap_get_options(const Swap *s) {
|
||||
assert(s);
|
||||
|
||||
if (s->from_fragment)
|
||||
return s->parameters_fragment.options;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* const swap_exec_command_table[_SWAP_EXEC_COMMAND_MAX] = {
|
||||
[SWAP_EXEC_ACTIVATE] = "ExecActivate",
|
||||
[SWAP_EXEC_DEACTIVATE] = "ExecDeactivate",
|
||||
|
||||
@@ -91,6 +91,9 @@ extern const UnitVTable swap_vtable;
|
||||
int swap_process_device_new(Manager *m, sd_device *dev);
|
||||
int swap_process_device_remove(Manager *m, sd_device *dev);
|
||||
|
||||
int swap_get_priority(const Swap *s);
|
||||
const char* swap_get_options(const Swap *s);
|
||||
|
||||
const char* swap_exec_command_to_string(SwapExecCommand i) _const_;
|
||||
SwapExecCommand swap_exec_command_from_string(const char *s) _pure_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user