]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/dbus-automount.c
man: add an additional note about journalctl -u
[thirdparty/systemd.git] / src / core / dbus-automount.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 /***
3 This file is part of systemd.
4
5 Copyright 2010 Lennart Poettering
6
7 systemd is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version.
11
12 systemd is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with systemd; If not, see <http://www.gnu.org/licenses/>.
19 ***/
20
21 #include "automount.h"
22 #include "bus-util.h"
23 #include "dbus-automount.h"
24 #include "dbus-util.h"
25 #include "string-util.h"
26
27 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, automount_result, AutomountResult);
28
29 const sd_bus_vtable bus_automount_vtable[] = {
30 SD_BUS_VTABLE_START(0),
31 SD_BUS_PROPERTY("Where", "s", NULL, offsetof(Automount, where), SD_BUS_VTABLE_PROPERTY_CONST),
32 SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Automount, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
33 SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Automount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
34 SD_BUS_PROPERTY("TimeoutIdleUSec", "t", bus_property_get_usec, offsetof(Automount, timeout_idle_usec), SD_BUS_VTABLE_PROPERTY_CONST),
35 SD_BUS_VTABLE_END
36 };
37
38 static int bus_automount_set_transient_property(
39 Automount *a,
40 const char *name,
41 sd_bus_message *message,
42 UnitWriteFlags flags,
43 sd_bus_error *error) {
44
45 Unit *u = UNIT(a);
46
47 assert(a);
48 assert(name);
49 assert(message);
50
51 flags |= UNIT_PRIVATE;
52
53 if (streq(name, "Where"))
54 return bus_set_transient_path(u, name, &a->where, message, flags, error);
55
56 if (streq(name, "TimeoutIdleUSec"))
57 return bus_set_transient_usec_fix_0(u, name, &a->timeout_idle_usec, message, flags, error);
58
59 if (streq(name, "DirectoryMode"))
60 return bus_set_transient_mode_t(u, name, &a->directory_mode, message, flags, error);
61
62 return 0;
63 }
64
65 int bus_automount_set_property(
66 Unit *u,
67 const char *name,
68 sd_bus_message *message,
69 UnitWriteFlags flags,
70 sd_bus_error *error) {
71
72 Automount *a = AUTOMOUNT(u);
73
74 assert(a);
75 assert(name);
76 assert(message);
77
78 if (u->transient && u->load_state == UNIT_STUB) /* This is a transient unit? let's load a little more */
79 return bus_automount_set_transient_property(a, name, message, flags, error);
80
81 return 0;
82 }