valeriyvdovin / rpms / systemd

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