chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
socket: on ipv6 try to use IPV6_UNICAST_HOPS sockopt
[elogind.git]
/
src
/
swap.c
diff --git
a/src/swap.c
b/src/swap.c
index c35a8e785a6708099c1eb9f8974a60dd06438d26..2e3e995c3e6c6386185fedbea564b47dabf671ec 100644
(file)
--- a/
src/swap.c
+++ b/
src/swap.c
@@
-33,11
+33,12
@@
#include "load-dropin.h"
#include "unit-name.h"
#include "dbus-swap.h"
#include "load-dropin.h"
#include "unit-name.h"
#include "dbus-swap.h"
+#include "special.h"
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
[SWAP_ACTIVE] = UNIT_ACTIVE,
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
[SWAP_ACTIVE] = UNIT_ACTIVE,
- [SWAP_MAINT
AINANCE] = UNIT_INACTIV
E
+ [SWAP_MAINT
ENANCE] = UNIT_MAINTENANC
E
};
static void swap_init(Unit *u) {
};
static void swap_init(Unit *u) {
@@
-115,7
+116,7
@@
static int swap_add_target_links(Swap *s) {
if ((r = manager_load_unit(s->meta.manager, SPECIAL_SWAP_TARGET, NULL, &tu)) < 0)
return r;
if ((r = manager_load_unit(s->meta.manager, SPECIAL_SWAP_TARGET, NULL, &tu)) < 0)
return r;
- if (!p->noauto && p->handle && s->meta.manager->running_as
!= MANAGER_SESSION
)
+ if (!p->noauto && p->handle && s->meta.manager->running_as
== MANAGER_SYSTEM
)
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(s), true)) < 0)
return r;
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(s), true)) < 0)
return r;
@@
-126,7
+127,7
@@
static int swap_verify(Swap *s) {
bool b;
char *e;
bool b;
char *e;
- if (
UNIT(s)
->meta.load_state != UNIT_LOADED)
+ if (
s
->meta.load_state != UNIT_LOADED)
return 0;
if (!(e = unit_name_from_path(s->what, ".swap")))
return 0;
if (!(e = unit_name_from_path(s->what, ".swap")))
@@
-136,7
+137,7
@@
static int swap_verify(Swap *s) {
free(e);
if (!b) {
free(e);
if (!b) {
- log_error("%s: Value of \"What\" and unit name do not match, not loading.\n",
UNIT(s)
->meta.id);
+ log_error("%s: Value of \"What\" and unit name do not match, not loading.\n",
s
->meta.id);
return -EINVAL;
}
return -EINVAL;
}
@@
-179,9
+180,7
@@
static int swap_load(Unit *u) {
if ((r = unit_set_description(u, s->what)) < 0)
return r;
if ((r = unit_set_description(u, s->what)) < 0)
return r;
- if ((r = unit_add_node_link(u, s->what,
- (u->meta.manager->running_as == MANAGER_INIT ||
- u->meta.manager->running_as == MANAGER_SYSTEM))) < 0)
+ if ((r = unit_add_node_link(u, s->what, u->meta.manager->running_as == MANAGER_SYSTEM)) < 0)
return r;
if ((r = swap_add_mount_links(s)) < 0)
return r;
if ((r = swap_add_mount_links(s)) < 0)
@@
-321,7
+320,7
@@
static void swap_set_state(Swap *s, SwapState state) {
if (state != old_state)
log_debug("%s changed %s -> %s",
if (state != old_state)
log_debug("%s changed %s -> %s",
-
UNIT(s)
->meta.id,
+
s
->meta.id,
swap_state_to_string(old_state),
swap_state_to_string(state));
swap_state_to_string(old_state),
swap_state_to_string(state));
@@
-382,7
+381,7
@@
static void swap_dump(Unit *u, FILE *f, const char *prefix) {
static void swap_enter_dead(Swap *s, bool success) {
assert(s);
static void swap_enter_dead(Swap *s, bool success) {
assert(s);
- swap_set_state(s, success ? SWAP_MAINT
AI
NANCE : SWAP_DEAD);
+ swap_set_state(s, success ? SWAP_MAINT
E
NANCE : SWAP_DEAD);
}
static int swap_start(Unit *u) {
}
static int swap_start(Unit *u) {
@@
-391,7
+390,7
@@
static int swap_start(Unit *u) {
int r;
assert(s);
int r;
assert(s);
- assert(s->state == SWAP_DEAD || s->state == SWAP_MAINT
AI
NANCE);
+ assert(s->state == SWAP_DEAD || s->state == SWAP_MAINT
E
NANCE);
if (s->from_fragment)
priority = s->parameters_fragment.priority;
if (s->from_fragment)
priority = s->parameters_fragment.priority;
@@
-527,7
+526,7
@@
static void swap_shutdown(Manager *m) {
static const char* const swap_state_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = "dead",
[SWAP_ACTIVE] = "active",
static const char* const swap_state_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = "dead",
[SWAP_ACTIVE] = "active",
- [SWAP_MAINT
AINANCE] = "maintai
nance"
+ [SWAP_MAINT
ENANCE] = "mainte
nance"
};
DEFINE_STRING_TABLE_LOOKUP(swap_state, SwapState);
};
DEFINE_STRING_TABLE_LOOKUP(swap_state, SwapState);