daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
1abbee
From 510ba7ebe71c8e4e64ead26a44b330d2e4375d9c Mon Sep 17 00:00:00 2001
1abbee
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
1abbee
Date: Thu, 26 Nov 2015 16:32:41 -0500
1abbee
Subject: [PATCH] core: rename Random* to RandomizedDelay*
1abbee
1abbee
The name RandomSec is too generic: "Sec" just specifies the default
1abbee
unit type, and "Random" by itself is not enough. Rename to something
1abbee
that should give the user general idea what the setting does without
1abbee
looking at documentation.
1abbee
1abbee
Cherry-picked from: 6f5d79986a9c98b9cacc83f865fed957e4e6e4e6
1abbee
Resolves: #1305279
1abbee
---
1abbee
 man/systemd.timer.xml                 | 8 ++++----
1abbee
 src/core/dbus-timer.c                 | 6 +++---
1abbee
 src/core/load-fragment-gperf.gperf.m4 | 2 +-
1abbee
 src/libsystemd/sd-bus/bus-util.c      | 6 +++---
1abbee
 4 files changed, 11 insertions(+), 11 deletions(-)
1abbee
1abbee
diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml
c62b8e
index bdd14d8883..ab83b2c9cf 100644
1abbee
--- a/man/systemd.timer.xml
1abbee
+++ b/man/systemd.timer.xml
1abbee
@@ -195,7 +195,7 @@
1abbee
       </varlistentry>
1abbee
 
1abbee
       <varlistentry>
1abbee
-        <term><varname>RandomSec=</varname></term>
1abbee
+        <term><varname>RandomizedDelaySec=</varname></term>
1abbee
 
1abbee
         <listitem><para>Delay the timer by a randomly selected, evenly
1abbee
         distributed amount of time between 0 and the specified time
1abbee
@@ -212,16 +212,16 @@
1abbee
         time range in order to minimize wakeups, the former does the
1abbee
         opposite: it stretches timer events over a time range, to make
1abbee
         it unlikely that they fire simultaneously. If
1abbee
-        <varname>RandomSec=</varname> and
1abbee
+        <varname>RandomizedDelaySec=</varname> and
1abbee
         <varname>AccuracySec=</varname> are used in conjunction, first
1abbee
         the a randomized time is added, and the result is then
1abbee
         possibly shifted further to coalesce it with other timer
1abbee
         events possibly happening on the system. As mentioned above
1abbee
         <varname>AccuracySec=</varname> defaults to 1min and
1abbee
-        <varname>RandomSec=</varname> to 0, thus encouraging
1abbee
+        <varname>RandomizedDelaySec=</varname> to 0, thus encouraging
1abbee
         coalescing of timer events. In order to optimally stretch
1abbee
         timer events over a certain range of time, make sure to set
1abbee
-        <varname>RandomSec=</varname> to a higher value, and
1abbee
+        <varname>RandomizedDelaySec=</varname> to a higher value, and
1abbee
         <varname>AccuracySec=1us</varname>.</para></listitem>
1abbee
       </varlistentry>
1abbee
 
1abbee
diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c
c62b8e
index cd7bf44baa..478905accb 100644
1abbee
--- a/src/core/dbus-timer.c
1abbee
+++ b/src/core/dbus-timer.c
1abbee
@@ -181,7 +181,7 @@ const sd_bus_vtable bus_timer_vtable[] = {
1abbee
         BUS_PROPERTY_DUAL_TIMESTAMP("LastTriggerUSec", offsetof(Timer, last_trigger), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
1abbee
         SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Timer, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
1abbee
         SD_BUS_PROPERTY("AccuracyUSec", "t", bus_property_get_usec, offsetof(Timer, accuracy_usec), SD_BUS_VTABLE_PROPERTY_CONST),
1abbee
-        SD_BUS_PROPERTY("RandomUSec", "t", bus_property_get_usec, offsetof(Timer, random_usec), SD_BUS_VTABLE_PROPERTY_CONST),
1abbee
+        SD_BUS_PROPERTY("RandomizedDelayUSec", "t", bus_property_get_usec, offsetof(Timer, random_usec), SD_BUS_VTABLE_PROPERTY_CONST),
1abbee
         SD_BUS_PROPERTY("Persistent", "b", bus_property_get_bool, offsetof(Timer, persistent), SD_BUS_VTABLE_PROPERTY_CONST),
1abbee
         SD_BUS_PROPERTY("WakeSystem", "b", bus_property_get_bool, offsetof(Timer, wake_system), SD_BUS_VTABLE_PROPERTY_CONST),
1abbee
         SD_BUS_VTABLE_END
1abbee
@@ -285,7 +285,7 @@ static int bus_timer_set_transient_property(
1abbee
 
1abbee
                 return 1;
1abbee
 
1abbee
-        } else if (streq(name, "RandomUSec")) {
1abbee
+        } else if (streq(name, "RandomizedDelayUSec")) {
1abbee
                 usec_t u = 0;
1abbee
 
1abbee
                 r = sd_bus_message_read(message, "t", &u);
1abbee
@@ -296,7 +296,7 @@ static int bus_timer_set_transient_property(
1abbee
                         char time[FORMAT_TIMESPAN_MAX];
1abbee
 
1abbee
                         t->random_usec = u;
1abbee
-                        unit_write_drop_in_private_format(UNIT(t), mode, name, "RandomSec=%s\n", format_timespan(time, sizeof(time), u, USEC_PER_MSEC));
1abbee
+                        unit_write_drop_in_private_format(UNIT(t), mode, name, "RandomizedDelaySec=%s\n", format_timespan(time, sizeof(time), u, USEC_PER_MSEC));
1abbee
                 }
1abbee
 
1abbee
                 return 1;
1abbee
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
c62b8e
index 5106a98eec..85d9797514 100644
1abbee
--- a/src/core/load-fragment-gperf.gperf.m4
1abbee
+++ b/src/core/load-fragment-gperf.gperf.m4
1abbee
@@ -336,7 +336,7 @@ Timer.OnUnitInactiveSec,         config_parse_timer,                 0,
1abbee
 Timer.Persistent,                config_parse_bool,                  0,                             offsetof(Timer, persistent)
1abbee
 Timer.WakeSystem,                config_parse_bool,                  0,                             offsetof(Timer, wake_system)
1abbee
 Timer.AccuracySec,               config_parse_sec,                   0,                             offsetof(Timer, accuracy_usec)
1abbee
-Timer.RandomSec,                 config_parse_sec,                   0,                             offsetof(Timer, random_usec)
1abbee
+Timer.RandomizedDelaySec,        config_parse_sec,                   0,                             offsetof(Timer, random_usec)
1abbee
 Timer.Unit,                      config_parse_trigger_unit,          0,                             0
1abbee
 m4_dnl
1abbee
 Path.PathExists,                 config_parse_path_spec,             0,                             0
1abbee
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
c62b8e
index 5ecb3bea42..3a918361b5 100644
1abbee
--- a/src/libsystemd/sd-bus/bus-util.c
1abbee
+++ b/src/libsystemd/sd-bus/bus-util.c
1abbee
@@ -1364,14 +1364,14 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
1abbee
                         return bus_log_create_error(r);
1abbee
 
1abbee
                 return 0;
1abbee
-        } else if (streq(field, "RandomSec")) {
1abbee
+        } else if (streq(field, "RandomizedDelaySec")) {
1abbee
                 usec_t t;
1abbee
 
1abbee
                 r = parse_sec(eq, &t);
1abbee
                 if (r < 0)
1abbee
-                        return log_error_errno(r, "Failed to parse RandomSec= parameter: %s", eq);
1abbee
+                        return log_error_errno(r, "Failed to parse RandomizedDelaySec= parameter: %s", eq);
1abbee
 
1abbee
-                r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, "RandomUSec");
1abbee
+                r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, "RandomizedDelayUSec");
1abbee
                 if (r < 0)
1abbee
                         return bus_log_create_error(r);
1abbee