X Tutup
Skip to content

Commit 5ac1530

Browse files
committed
tree-wide: say "ratelimit" not "rate_limit"
"ratelimit" is a real word, so we don't need to use the other form anywhere. We had both forms in various places, let's standarize on the shorter and more correct one.
1 parent 7bf081a commit 5ac1530

17 files changed

+92
-92
lines changed

src/core/dbus-execute.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ const sd_bus_vtable bus_exec_vtable[] = {
764764
SD_BUS_PROPERTY("SyslogLevel", "i", property_get_syslog_level, offsetof(ExecContext, syslog_priority), SD_BUS_VTABLE_PROPERTY_CONST),
765765
SD_BUS_PROPERTY("SyslogFacility", "i", property_get_syslog_facility, offsetof(ExecContext, syslog_priority), SD_BUS_VTABLE_PROPERTY_CONST),
766766
SD_BUS_PROPERTY("LogLevelMax", "i", bus_property_get_int, offsetof(ExecContext, log_level_max), SD_BUS_VTABLE_PROPERTY_CONST),
767-
SD_BUS_PROPERTY("LogRateLimitIntervalUSec", "t", bus_property_get_usec, offsetof(ExecContext, log_rate_limit_interval_usec), SD_BUS_VTABLE_PROPERTY_CONST),
768-
SD_BUS_PROPERTY("LogRateLimitBurst", "u", bus_property_get_unsigned, offsetof(ExecContext, log_rate_limit_burst), SD_BUS_VTABLE_PROPERTY_CONST),
767+
SD_BUS_PROPERTY("LogRateLimitIntervalUSec", "t", bus_property_get_usec, offsetof(ExecContext, log_ratelimit_interval_usec), SD_BUS_VTABLE_PROPERTY_CONST),
768+
SD_BUS_PROPERTY("LogRateLimitBurst", "u", bus_property_get_unsigned, offsetof(ExecContext, log_ratelimit_burst), SD_BUS_VTABLE_PROPERTY_CONST),
769769
SD_BUS_PROPERTY("LogExtraFields", "aay", property_get_log_extra_fields, 0, SD_BUS_VTABLE_PROPERTY_CONST),
770770
SD_BUS_PROPERTY("SecureBits", "i", bus_property_get_int, offsetof(ExecContext, secure_bits), SD_BUS_VTABLE_PROPERTY_CONST),
771771
SD_BUS_PROPERTY("CapabilityBoundingSet", "t", NULL, offsetof(ExecContext, capability_bounding_set), SD_BUS_VTABLE_PROPERTY_CONST),
@@ -1204,10 +1204,10 @@ int bus_exec_context_set_transient_property(
12041204
return bus_set_transient_log_level(u, name, &c->log_level_max, message, flags, error);
12051205

12061206
if (streq(name, "LogRateLimitIntervalUSec"))
1207-
return bus_set_transient_usec(u, name, &c->log_rate_limit_interval_usec, message, flags, error);
1207+
return bus_set_transient_usec(u, name, &c->log_ratelimit_interval_usec, message, flags, error);
12081208

12091209
if (streq(name, "LogRateLimitBurst"))
1210-
return bus_set_transient_unsigned(u, name, &c->log_rate_limit_burst, message, flags, error);
1210+
return bus_set_transient_unsigned(u, name, &c->log_ratelimit_burst, message, flags, error);
12111211

12121212
if (streq(name, "Personality"))
12131213
return bus_set_transient_personality(u, name, &c->personality, message, flags, error);

src/core/execute.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4000,8 +4000,8 @@ void exec_context_done(ExecContext *c) {
40004000

40014001
exec_context_free_log_extra_fields(c);
40024002

4003-
c->log_rate_limit_interval_usec = 0;
4004-
c->log_rate_limit_burst = 0;
4003+
c->log_ratelimit_interval_usec = 0;
4004+
c->log_ratelimit_burst = 0;
40054005

40064006
c->stdin_data = mfree(c->stdin_data);
40074007
c->stdin_data_size = 0;
@@ -4515,16 +4515,16 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
45154515
fprintf(f, "%sLogLevelMax: %s\n", prefix, strna(t));
45164516
}
45174517

4518-
if (c->log_rate_limit_interval_usec > 0) {
4518+
if (c->log_ratelimit_interval_usec > 0) {
45194519
char buf_timespan[FORMAT_TIMESPAN_MAX];
45204520

45214521
fprintf(f,
45224522
"%sLogRateLimitIntervalSec: %s\n",
4523-
prefix, format_timespan(buf_timespan, sizeof(buf_timespan), c->log_rate_limit_interval_usec, USEC_PER_SEC));
4523+
prefix, format_timespan(buf_timespan, sizeof(buf_timespan), c->log_ratelimit_interval_usec, USEC_PER_SEC));
45244524
}
45254525

4526-
if (c->log_rate_limit_burst > 0)
4527-
fprintf(f, "%sLogRateLimitBurst: %u\n", prefix, c->log_rate_limit_burst);
4526+
if (c->log_ratelimit_burst > 0)
4527+
fprintf(f, "%sLogRateLimitBurst: %u\n", prefix, c->log_ratelimit_burst);
45284528

45294529
if (c->n_log_extra_fields > 0) {
45304530
size_t j;

src/core/execute.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ struct ExecContext {
245245
struct iovec* log_extra_fields;
246246
size_t n_log_extra_fields;
247247

248-
usec_t log_rate_limit_interval_usec;
249-
unsigned log_rate_limit_burst;
248+
usec_t log_ratelimit_interval_usec;
249+
unsigned log_ratelimit_burst;
250250

251251
int log_level_max;
252252

src/core/load-fragment-gperf.gperf.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ $1.SyslogFacility, config_parse_log_facility, 0,
5959
$1.SyslogLevel, config_parse_log_level, 0, offsetof($1, exec_context.syslog_priority)
6060
$1.SyslogLevelPrefix, config_parse_bool, 0, offsetof($1, exec_context.syslog_level_prefix)
6161
$1.LogLevelMax, config_parse_log_level, 0, offsetof($1, exec_context.log_level_max)
62-
$1.LogRateLimitIntervalSec, config_parse_sec, 0, offsetof($1, exec_context.log_rate_limit_interval_usec)
63-
$1.LogRateLimitBurst, config_parse_unsigned, 0, offsetof($1, exec_context.log_rate_limit_burst)
62+
$1.LogRateLimitIntervalSec, config_parse_sec, 0, offsetof($1, exec_context.log_ratelimit_interval_usec)
63+
$1.LogRateLimitBurst, config_parse_unsigned, 0, offsetof($1, exec_context.log_ratelimit_burst)
6464
$1.LogExtraFields, config_parse_log_extra_fields, 0, offsetof($1, exec_context)
6565
$1.Capabilities, config_parse_warn_compat, DISABLED_LEGACY, offsetof($1, exec_context)
6666
$1.SecureBits, config_parse_exec_secure_bits, 0, offsetof($1, exec_context.secure_bits)

src/core/unit.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,8 +3416,8 @@ int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
34163416
(void) serialize_bool(f, "exported-invocation-id", u->exported_invocation_id);
34173417
(void) serialize_bool(f, "exported-log-level-max", u->exported_log_level_max);
34183418
(void) serialize_bool(f, "exported-log-extra-fields", u->exported_log_extra_fields);
3419-
(void) serialize_bool(f, "exported-log-rate-limit-interval", u->exported_log_rate_limit_interval);
3420-
(void) serialize_bool(f, "exported-log-rate-limit-burst", u->exported_log_rate_limit_burst);
3419+
(void) serialize_bool(f, "exported-log-rate-limit-interval", u->exported_log_ratelimit_interval);
3420+
(void) serialize_bool(f, "exported-log-rate-limit-burst", u->exported_log_ratelimit_burst);
34213421

34223422
(void) serialize_item_format(f, "cpu-usage-base", "%" PRIu64, u->cpu_usage_base);
34233423
if (u->cpu_usage_last != NSEC_INFINITY)
@@ -3636,7 +3636,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
36363636
if (r < 0)
36373637
log_unit_debug(u, "Failed to parse exported log rate limit interval %s, ignoring.", v);
36383638
else
3639-
u->exported_log_rate_limit_interval = r;
3639+
u->exported_log_ratelimit_interval = r;
36403640

36413641
continue;
36423642

@@ -3646,7 +3646,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
36463646
if (r < 0)
36473647
log_unit_debug(u, "Failed to parse exported log rate limit burst %s, ignoring.", v);
36483648
else
3649-
u->exported_log_rate_limit_burst = r;
3649+
u->exported_log_ratelimit_burst = r;
36503650

36513651
continue;
36523652

@@ -5504,57 +5504,57 @@ static int unit_export_log_extra_fields(Unit *u, const ExecContext *c) {
55045504
return r;
55055505
}
55065506

5507-
static int unit_export_log_rate_limit_interval(Unit *u, const ExecContext *c) {
5507+
static int unit_export_log_ratelimit_interval(Unit *u, const ExecContext *c) {
55085508
_cleanup_free_ char *buf = NULL;
55095509
const char *p;
55105510
int r;
55115511

55125512
assert(u);
55135513
assert(c);
55145514

5515-
if (u->exported_log_rate_limit_interval)
5515+
if (u->exported_log_ratelimit_interval)
55165516
return 0;
55175517

5518-
if (c->log_rate_limit_interval_usec == 0)
5518+
if (c->log_ratelimit_interval_usec == 0)
55195519
return 0;
55205520

55215521
p = strjoina("/run/systemd/units/log-rate-limit-interval:", u->id);
55225522

5523-
if (asprintf(&buf, "%" PRIu64, c->log_rate_limit_interval_usec) < 0)
5523+
if (asprintf(&buf, "%" PRIu64, c->log_ratelimit_interval_usec) < 0)
55245524
return log_oom();
55255525

55265526
r = symlink_atomic(buf, p);
55275527
if (r < 0)
55285528
return log_unit_debug_errno(u, r, "Failed to create log rate limit interval symlink %s: %m", p);
55295529

5530-
u->exported_log_rate_limit_interval = true;
5530+
u->exported_log_ratelimit_interval = true;
55315531
return 0;
55325532
}
55335533

5534-
static int unit_export_log_rate_limit_burst(Unit *u, const ExecContext *c) {
5534+
static int unit_export_log_ratelimit_burst(Unit *u, const ExecContext *c) {
55355535
_cleanup_free_ char *buf = NULL;
55365536
const char *p;
55375537
int r;
55385538

55395539
assert(u);
55405540
assert(c);
55415541

5542-
if (u->exported_log_rate_limit_burst)
5542+
if (u->exported_log_ratelimit_burst)
55435543
return 0;
55445544

5545-
if (c->log_rate_limit_burst == 0)
5545+
if (c->log_ratelimit_burst == 0)
55465546
return 0;
55475547

55485548
p = strjoina("/run/systemd/units/log-rate-limit-burst:", u->id);
55495549

5550-
if (asprintf(&buf, "%u", c->log_rate_limit_burst) < 0)
5550+
if (asprintf(&buf, "%u", c->log_ratelimit_burst) < 0)
55515551
return log_oom();
55525552

55535553
r = symlink_atomic(buf, p);
55545554
if (r < 0)
55555555
return log_unit_debug_errno(u, r, "Failed to create log rate limit burst symlink %s: %m", p);
55565556

5557-
u->exported_log_rate_limit_burst = true;
5557+
u->exported_log_ratelimit_burst = true;
55585558
return 0;
55595559
}
55605560

@@ -5591,8 +5591,8 @@ void unit_export_state_files(Unit *u) {
55915591
if (c) {
55925592
(void) unit_export_log_level_max(u, c);
55935593
(void) unit_export_log_extra_fields(u, c);
5594-
(void) unit_export_log_rate_limit_interval(u, c);
5595-
(void) unit_export_log_rate_limit_burst(u, c);
5594+
(void) unit_export_log_ratelimit_interval(u, c);
5595+
(void) unit_export_log_ratelimit_burst(u, c);
55965596
}
55975597
}
55985598

@@ -5630,18 +5630,18 @@ void unit_unlink_state_files(Unit *u) {
56305630
u->exported_log_extra_fields = false;
56315631
}
56325632

5633-
if (u->exported_log_rate_limit_interval) {
5633+
if (u->exported_log_ratelimit_interval) {
56345634
p = strjoina("/run/systemd/units/log-rate-limit-interval:", u->id);
56355635
(void) unlink(p);
56365636

5637-
u->exported_log_rate_limit_interval = false;
5637+
u->exported_log_ratelimit_interval = false;
56385638
}
56395639

5640-
if (u->exported_log_rate_limit_burst) {
5640+
if (u->exported_log_ratelimit_burst) {
56415641
p = strjoina("/run/systemd/units/log-rate-limit-burst:", u->id);
56425642
(void) unlink(p);
56435643

5644-
u->exported_log_rate_limit_burst = false;
5644+
u->exported_log_ratelimit_burst = false;
56455645
}
56465646
}
56475647

src/core/unit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ typedef struct Unit {
365365
bool exported_invocation_id:1;
366366
bool exported_log_level_max:1;
367367
bool exported_log_extra_fields:1;
368-
bool exported_log_rate_limit_interval:1;
369-
bool exported_log_rate_limit_burst:1;
368+
bool exported_log_ratelimit_interval:1;
369+
bool exported_log_ratelimit_burst:1;
370370

371371
/* Whether we warned about clamping the CPU quota period */
372372
bool warned_clamping_cpu_quota_period:1;

src/import/export-raw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct RawExport {
4949
uint64_t written_uncompressed;
5050

5151
unsigned last_percent;
52-
RateLimit progress_rate_limit;
52+
RateLimit progress_ratelimit;
5353

5454
struct stat st;
5555

@@ -96,7 +96,7 @@ int raw_export_new(
9696
.on_finished = on_finished,
9797
.userdata = userdata,
9898
.last_percent = (unsigned) -1,
99-
.progress_rate_limit = { 100 * USEC_PER_MSEC, 1 },
99+
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
100100
};
101101

102102
if (event)
@@ -124,7 +124,7 @@ static void raw_export_report_progress(RawExport *e) {
124124
if (percent == e->last_percent)
125125
return;
126126

127-
if (!ratelimit_below(&e->progress_rate_limit))
127+
if (!ratelimit_below(&e->progress_ratelimit))
128128
return;
129129

130130
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);

src/import/export-tar.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct TarExport {
4444
uint64_t quota_referenced;
4545

4646
unsigned last_percent;
47-
RateLimit progress_rate_limit;
47+
RateLimit progress_ratelimit;
4848

4949
bool eof;
5050
bool tried_splice;
@@ -99,7 +99,7 @@ int tar_export_new(
9999
.userdata = userdata,
100100
.quota_referenced = (uint64_t) -1,
101101
.last_percent = (unsigned) -1,
102-
.progress_rate_limit = { 100 * USEC_PER_MSEC, 1 },
102+
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
103103
};
104104

105105
if (event)
@@ -131,7 +131,7 @@ static void tar_export_report_progress(TarExport *e) {
131131
if (percent == e->last_percent)
132132
return;
133133

134-
if (!ratelimit_below(&e->progress_rate_limit))
134+
if (!ratelimit_below(&e->progress_ratelimit))
135135
return;
136136

137137
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);

src/import/import-raw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct RawImport {
5757
struct stat st;
5858

5959
unsigned last_percent;
60-
RateLimit progress_rate_limit;
60+
RateLimit progress_ratelimit;
6161
};
6262

6363
RawImport* raw_import_unref(RawImport *i) {
@@ -111,7 +111,7 @@ int raw_import_new(
111111
.userdata = userdata,
112112
.last_percent = (unsigned) -1,
113113
.image_root = TAKE_PTR(root),
114-
.progress_rate_limit = { 100 * USEC_PER_MSEC, 1 },
114+
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
115115
};
116116

117117
if (event)
@@ -143,7 +143,7 @@ static void raw_import_report_progress(RawImport *i) {
143143
if (percent == i->last_percent)
144144
return;
145145

146-
if (!ratelimit_below(&i->progress_rate_limit))
146+
if (!ratelimit_below(&i->progress_ratelimit))
147147
return;
148148

149149
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);

src/import/import-tar.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct TarImport {
6060
pid_t tar_pid;
6161

6262
unsigned last_percent;
63-
RateLimit progress_rate_limit;
63+
RateLimit progress_ratelimit;
6464
};
6565

6666
TarImport* tar_import_unref(TarImport *i) {
@@ -119,7 +119,7 @@ int tar_import_new(
119119
.userdata = userdata,
120120
.last_percent = (unsigned) -1,
121121
.image_root = TAKE_PTR(root),
122-
.progress_rate_limit = { 100 * USEC_PER_MSEC, 1 },
122+
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
123123
};
124124

125125
if (event)
@@ -151,7 +151,7 @@ static void tar_import_report_progress(TarImport *i) {
151151
if (percent == i->last_percent)
152152
return;
153153

154-
if (!ratelimit_below(&i->progress_rate_limit))
154+
if (!ratelimit_below(&i->progress_ratelimit))
155155
return;
156156

157157
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);

0 commit comments

Comments
 (0)
X Tutup