]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/dbus-automount.c
Revert "core: add IgnoreOnSoftReboot= unit option"
[thirdparty/systemd.git] / src / core / dbus-automount.c
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
4139c1b2 2
718db961 3#include "automount.h"
40af3d02 4#include "bus-get-properties.h"
07630cea 5#include "dbus-automount.h"
8700fb85 6#include "dbus-util.h"
cf0fbc49 7#include "string-util.h"
4139c1b2 8
718db961 9static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, automount_result, AutomountResult);
81a5c6d0 10
718db961
LP
11const sd_bus_vtable bus_automount_vtable[] = {
12 SD_BUS_VTABLE_START(0),
556089dc 13 SD_BUS_PROPERTY("Where", "s", NULL, offsetof(Automount, where), SD_BUS_VTABLE_PROPERTY_CONST),
7c5cef22 14 SD_BUS_PROPERTY("ExtraOptions", "s", NULL, offsetof(Automount, extra_options), SD_BUS_VTABLE_PROPERTY_CONST),
556089dc 15 SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Automount, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
718db961 16 SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Automount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
deb0a77c 17 SD_BUS_PROPERTY("TimeoutIdleUSec", "t", bus_property_get_usec, offsetof(Automount, timeout_idle_usec), SD_BUS_VTABLE_PROPERTY_CONST),
718db961 18 SD_BUS_VTABLE_END
d200735e 19};
afb14803
MO
20
21static int bus_automount_set_transient_property(
22 Automount *a,
23 const char *name,
24 sd_bus_message *message,
2e59b241 25 UnitWriteFlags flags,
afb14803
MO
26 sd_bus_error *error) {
27
8700fb85 28 Unit *u = UNIT(a);
afb14803
MO
29
30 assert(a);
31 assert(name);
32 assert(message);
33
2e59b241
LP
34 flags |= UNIT_PRIVATE;
35
8700fb85
YW
36 if (streq(name, "Where"))
37 return bus_set_transient_path(u, name, &a->where, message, flags, error);
2e59b241 38
7c5cef22
AS
39 if (streq(name, "ExtraOptions"))
40 return bus_set_transient_string(u, name, &a->extra_options, message, flags, error);
41
8700fb85
YW
42 if (streq(name, "TimeoutIdleUSec"))
43 return bus_set_transient_usec_fix_0(u, name, &a->timeout_idle_usec, message, flags, error);
afb14803 44
8700fb85
YW
45 if (streq(name, "DirectoryMode"))
46 return bus_set_transient_mode_t(u, name, &a->directory_mode, message, flags, error);
afb14803 47
8700fb85 48 return 0;
afb14803
MO
49}
50
51int bus_automount_set_property(
52 Unit *u,
53 const char *name,
54 sd_bus_message *message,
2e59b241 55 UnitWriteFlags flags,
afb14803
MO
56 sd_bus_error *error) {
57
58 Automount *a = AUTOMOUNT(u);
afb14803
MO
59
60 assert(a);
61 assert(name);
62 assert(message);
63
2e59b241
LP
64 if (u->transient && u->load_state == UNIT_STUB) /* This is a transient unit? let's load a little more */
65 return bus_automount_set_transient_property(a, name, message, flags, error);
afb14803 66
2e59b241 67 return 0;
afb14803 68}