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