diff options
Diffstat (limited to 'src/core/dbus-mount.c')
-rw-r--r-- | src/core/dbus-mount.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c index d59aa06a11..855300d025 100644 --- a/src/core/dbus-mount.c +++ b/src/core/dbus-mount.c @@ -75,6 +75,7 @@ const sd_bus_vtable bus_mount_vtable[] = { SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Mount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("UID", "u", bus_property_get_uid, offsetof(Unit, ref_uid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("GID", "u", bus_property_get_gid, offsetof(Unit, ref_gid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("GracefulOptions", "as", NULL, offsetof(Mount, graceful_options), SD_BUS_VTABLE_PROPERTY_CONST), BUS_EXEC_COMMAND_VTABLE("ExecMount", offsetof(Mount, exec_command[MOUNT_EXEC_MOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), BUS_EXEC_COMMAND_VTABLE("ExecUnmount", offsetof(Mount, exec_command[MOUNT_EXEC_UNMOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), BUS_EXEC_COMMAND_VTABLE("ExecRemount", offsetof(Mount, exec_command[MOUNT_EXEC_REMOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), @@ -150,6 +151,30 @@ static int bus_mount_set_transient_property( if (streq(name, "ReadWriteOnly")) return bus_set_transient_bool(u, name, &m->read_write_only, message, flags, error); + if (streq(name, "GracefulOptions")) { + _cleanup_strv_free_ char **add = NULL; + r = sd_bus_message_read_strv(message, &add); + if (r < 0) + return r; + + if (!UNIT_WRITE_FLAGS_NOOP(flags)) { + + if (strv_isempty(add)) { + m->graceful_options = strv_free(m->graceful_options); + unit_write_settingf(u, flags, name, "GracefulOptions="); + } else { + r = strv_extend_strv(&m->graceful_options, add, /* filter_duplicates= */ false); + if (r < 0) + return r; + + STRV_FOREACH(a, add) + unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "GracefulOptions=%s", *a); + } + } + + return 1; + } + return 0; } |