chiark / gitweb /
syslog: add minimal syslog/kmsg bridge syslogd
[elogind.git] / src / swap.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #ifndef fooswaphfoo
4 #define fooswaphfoo
5
6 /***
7   This file is part of systemd.
8
9   Copyright 2010 Lennart Poettering
10   Copyright 2010 Maarten Lankhorst
11
12   systemd is free software; you can redistribute it and/or modify it
13   under the terms of the GNU General Public License as published by
14   the Free Software Foundation; either version 2 of the License, or
15   (at your option) any later version.
16
17   systemd is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20   General Public License for more details.
21
22   You should have received a copy of the GNU General Public License
23   along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 ***/
25
26 typedef struct Swap Swap;
27
28 #include "unit.h"
29
30 typedef enum SwapState {
31         SWAP_DEAD,
32         SWAP_ACTIVE,
33         SWAP_MAINTENANCE,
34         _SWAP_STATE_MAX,
35         _SWAP_STATE_INVALID = -1
36 } SwapState;
37
38 typedef struct SwapParameters {
39         char *what;
40         int priority;
41         bool noauto:1;
42         bool handle:1;
43 } SwapParameters;
44
45 struct Swap {
46         Meta meta;
47
48         SwapParameters parameters_etc_fstab;
49         SwapParameters parameters_proc_swaps;
50         SwapParameters parameters_fragment;
51
52         char *what;
53
54         SwapState state, deserialized_state;
55
56         bool from_etc_fstab:1;
57         bool from_proc_swaps:1;
58         bool from_fragment:1;
59 };
60
61 extern const UnitVTable swap_vtable;
62
63 int swap_add_one(Manager *m, const char *what, int prio, bool no_auto, bool handle, bool from_proc_swap);
64
65 int swap_add_one_mount_link(Swap *s, Mount *m);
66
67 const char* swap_state_to_string(SwapState i);
68 SwapState swap_state_from_string(const char *s);
69
70
71 #endif