]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2010 Lennart Poettering | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
60f067b4 JS |
22 | #include "selinux-access.h" |
23 | #include "unit.h" | |
24 | #include "snapshot.h" | |
663996b3 MS |
25 | #include "dbus-unit.h" |
26 | #include "dbus-snapshot.h" | |
663996b3 | 27 | |
60f067b4 JS |
28 | int bus_snapshot_method_remove(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { |
29 | Snapshot *s = userdata; | |
30 | int r; | |
663996b3 | 31 | |
60f067b4 JS |
32 | assert(bus); |
33 | assert(message); | |
34 | assert(s); | |
663996b3 | 35 | |
5eef597e | 36 | r = mac_selinux_unit_access_check(UNIT(s), message, "stop", error); |
60f067b4 JS |
37 | if (r < 0) |
38 | return r; | |
663996b3 | 39 | |
60f067b4 | 40 | snapshot_remove(s); |
663996b3 | 41 | |
60f067b4 | 42 | return sd_bus_reply_method_return(message, NULL); |
663996b3 | 43 | } |
60f067b4 JS |
44 | |
45 | const sd_bus_vtable bus_snapshot_vtable[] = { | |
46 | SD_BUS_VTABLE_START(0), | |
47 | SD_BUS_METHOD("Remove", NULL, NULL, bus_snapshot_method_remove, 0), | |
48 | SD_BUS_PROPERTY("Cleanup", "b", bus_property_get_bool, offsetof(Snapshot, cleanup), SD_BUS_VTABLE_PROPERTY_CONST), | |
49 | SD_BUS_VTABLE_END | |
50 | }; |