summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-09-19 17:49:14 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-09-20 16:05:53 +0200
commit5ac1530eca652cd16819853fe06e76e156f5cf5e (patch)
tree34b57a84fa54bb1a1963d07ab273cd094a430ad6 /src/journal
parent7bf081a1e59d2ac4941f24d27c6d7647c5ed703b (diff)
downloadsystemd-5ac1530eca652cd16819853fe06e76e156f5cf5e.tar.gz
systemd-5ac1530eca652cd16819853fe06e76e156f5cf5e.tar.bz2
systemd-5ac1530eca652cd16819853fe06e76e156f5cf5e.zip
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.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-context.c20
-rw-r--r--src/journal/journald-context.h4
-rw-r--r--src/journal/journald-gperf.gperf6
-rw-r--r--src/journal/journald-rate-limit.c26
-rw-r--r--src/journal/journald-rate-limit.h6
-rw-r--r--src/journal/journald-server.c20
-rw-r--r--src/journal/journald-server.h6
7 files changed, 44 insertions, 44 deletions
diff --git a/src/journal/journald-context.c b/src/journal/journald-context.c
index 46edf24cd6..342ed062d4 100644
--- a/src/journal/journald-context.c
+++ b/src/journal/journald-context.c
@@ -132,8 +132,8 @@ static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
c->timestamp = USEC_INFINITY;
c->extra_fields_mtime = NSEC_INFINITY;
c->log_level_max = -1;
- c->log_rate_limit_interval = s->rate_limit_interval;
- c->log_rate_limit_burst = s->rate_limit_burst;
+ c->log_ratelimit_interval = s->ratelimit_interval;
+ c->log_ratelimit_burst = s->ratelimit_burst;
r = hashmap_put(s->client_contexts, PID_TO_PTR(pid), c);
if (r < 0) {
@@ -182,8 +182,8 @@ static void client_context_reset(Server *s, ClientContext *c) {
c->log_level_max = -1;
- c->log_rate_limit_interval = s->rate_limit_interval;
- c->log_rate_limit_burst = s->rate_limit_burst;
+ c->log_ratelimit_interval = s->ratelimit_interval;
+ c->log_ratelimit_burst = s->ratelimit_burst;
}
static ClientContext* client_context_free(Server *s, ClientContext *c) {
@@ -459,7 +459,7 @@ static int client_context_read_extra_fields(
return 0;
}
-static int client_context_read_log_rate_limit_interval(ClientContext *c) {
+static int client_context_read_log_ratelimit_interval(ClientContext *c) {
_cleanup_free_ char *value = NULL;
const char *p;
int r;
@@ -474,10 +474,10 @@ static int client_context_read_log_rate_limit_interval(ClientContext *c) {
if (r < 0)
return r;
- return safe_atou64(value, &c->log_rate_limit_interval);
+ return safe_atou64(value, &c->log_ratelimit_interval);
}
-static int client_context_read_log_rate_limit_burst(ClientContext *c) {
+static int client_context_read_log_ratelimit_burst(ClientContext *c) {
_cleanup_free_ char *value = NULL;
const char *p;
int r;
@@ -492,7 +492,7 @@ static int client_context_read_log_rate_limit_burst(ClientContext *c) {
if (r < 0)
return r;
- return safe_atou(value, &c->log_rate_limit_burst);
+ return safe_atou(value, &c->log_ratelimit_burst);
}
static void client_context_really_refresh(
@@ -521,8 +521,8 @@ static void client_context_really_refresh(
(void) client_context_read_invocation_id(s, c);
(void) client_context_read_log_level_max(s, c);
(void) client_context_read_extra_fields(s, c);
- (void) client_context_read_log_rate_limit_interval(c);
- (void) client_context_read_log_rate_limit_burst(c);
+ (void) client_context_read_log_ratelimit_interval(c);
+ (void) client_context_read_log_ratelimit_burst(c);
c->timestamp = timestamp;
diff --git a/src/journal/journald-context.h b/src/journal/journald-context.h
index 46f79fb5f7..91f0302be4 100644
--- a/src/journal/journald-context.h
+++ b/src/journal/journald-context.h
@@ -53,8 +53,8 @@ struct ClientContext {
void *extra_fields_data;
nsec_t extra_fields_mtime;
- usec_t log_rate_limit_interval;
- unsigned log_rate_limit_burst;
+ usec_t log_ratelimit_interval;
+ unsigned log_ratelimit_burst;
};
int client_context_get(
diff --git a/src/journal/journald-gperf.gperf b/src/journal/journald-gperf.gperf
index 1adcb50b6d..0774444e8d 100644
--- a/src/journal/journald-gperf.gperf
+++ b/src/journal/journald-gperf.gperf
@@ -24,9 +24,9 @@ Journal.Seal, config_parse_bool, 0, offsetof(Server, seal)
Journal.ReadKMsg, config_parse_bool, 0, offsetof(Server, read_kmsg)
Journal.SyncIntervalSec, config_parse_sec, 0, offsetof(Server, sync_interval_usec)
# The following is a legacy name for compatibility
-Journal.RateLimitInterval, config_parse_sec, 0, offsetof(Server, rate_limit_interval)
-Journal.RateLimitIntervalSec,config_parse_sec, 0, offsetof(Server, rate_limit_interval)
-Journal.RateLimitBurst, config_parse_unsigned, 0, offsetof(Server, rate_limit_burst)
+Journal.RateLimitInterval, config_parse_sec, 0, offsetof(Server, ratelimit_interval)
+Journal.RateLimitIntervalSec,config_parse_sec, 0, offsetof(Server, ratelimit_interval)
+Journal.RateLimitBurst, config_parse_unsigned, 0, offsetof(Server, ratelimit_burst)
Journal.SystemMaxUse, config_parse_iec_uint64, 0, offsetof(Server, system_storage.metrics.max_use)
Journal.SystemMaxFileSize, config_parse_iec_uint64, 0, offsetof(Server, system_storage.metrics.max_size)
Journal.SystemKeepFree, config_parse_iec_uint64, 0, offsetof(Server, system_storage.metrics.keep_free)
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c
index 39e968bce3..30a3fa8720 100644
--- a/src/journal/journald-rate-limit.c
+++ b/src/journal/journald-rate-limit.c
@@ -60,7 +60,7 @@ struct JournalRateLimit {
uint8_t hash_key[16];
};
-JournalRateLimit *journal_rate_limit_new(void) {
+JournalRateLimit *journal_ratelimit_new(void) {
JournalRateLimit *r;
r = new0(JournalRateLimit, 1);
@@ -72,7 +72,7 @@ JournalRateLimit *journal_rate_limit_new(void) {
return r;
}
-static void journal_rate_limit_group_free(JournalRateLimitGroup *g) {
+static void journal_ratelimit_group_free(JournalRateLimitGroup *g) {
assert(g);
if (g->parent) {
@@ -91,16 +91,16 @@ static void journal_rate_limit_group_free(JournalRateLimitGroup *g) {
free(g);
}
-void journal_rate_limit_free(JournalRateLimit *r) {
+void journal_ratelimit_free(JournalRateLimit *r) {
assert(r);
while (r->lru)
- journal_rate_limit_group_free(r->lru);
+ journal_ratelimit_group_free(r->lru);
free(r);
}
-_pure_ static bool journal_rate_limit_group_expired(JournalRateLimitGroup *g, usec_t ts) {
+_pure_ static bool journal_ratelimit_group_expired(JournalRateLimitGroup *g, usec_t ts) {
unsigned i;
assert(g);
@@ -112,18 +112,18 @@ _pure_ static bool journal_rate_limit_group_expired(JournalRateLimitGroup *g, us
return true;
}
-static void journal_rate_limit_vacuum(JournalRateLimit *r, usec_t ts) {
+static void journal_ratelimit_vacuum(JournalRateLimit *r, usec_t ts) {
assert(r);
/* Makes room for at least one new item, but drop all
* expored items too. */
while (r->n_groups >= GROUPS_MAX ||
- (r->lru_tail && journal_rate_limit_group_expired(r->lru_tail, ts)))
- journal_rate_limit_group_free(r->lru_tail);
+ (r->lru_tail && journal_ratelimit_group_expired(r->lru_tail, ts)))
+ journal_ratelimit_group_free(r->lru_tail);
}
-static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r, const char *id, usec_t interval, usec_t ts) {
+static JournalRateLimitGroup* journal_ratelimit_group_new(JournalRateLimit *r, const char *id, usec_t interval, usec_t ts) {
JournalRateLimitGroup *g;
assert(r);
@@ -141,7 +141,7 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
g->interval = interval;
- journal_rate_limit_vacuum(r, ts);
+ journal_ratelimit_vacuum(r, ts);
LIST_PREPEND(bucket, r->buckets[g->hash % BUCKETS_MAX], g);
LIST_PREPEND(lru, r->lru, g);
@@ -153,7 +153,7 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
return g;
fail:
- journal_rate_limit_group_free(g);
+ journal_ratelimit_group_free(g);
return NULL;
}
@@ -185,7 +185,7 @@ static unsigned burst_modulate(unsigned burst, uint64_t available) {
return burst;
}
-int journal_rate_limit_test(JournalRateLimit *r, const char *id, usec_t rl_interval, unsigned rl_burst, int priority, uint64_t available) {
+int journal_ratelimit_test(JournalRateLimit *r, const char *id, usec_t rl_interval, unsigned rl_burst, int priority, uint64_t available) {
uint64_t h;
JournalRateLimitGroup *g;
JournalRateLimitPool *p;
@@ -214,7 +214,7 @@ int journal_rate_limit_test(JournalRateLimit *r, const char *id, usec_t rl_inter
break;
if (!g) {
- g = journal_rate_limit_group_new(r, id, rl_interval, ts);
+ g = journal_ratelimit_group_new(r, id, rl_interval, ts);
if (!g)
return -ENOMEM;
} else
diff --git a/src/journal/journald-rate-limit.h b/src/journal/journald-rate-limit.h
index 9dab51f7cc..0fff8767ac 100644
--- a/src/journal/journald-rate-limit.h
+++ b/src/journal/journald-rate-limit.h
@@ -5,6 +5,6 @@
typedef struct JournalRateLimit JournalRateLimit;
-JournalRateLimit *journal_rate_limit_new(void);
-void journal_rate_limit_free(JournalRateLimit *r);
-int journal_rate_limit_test(JournalRateLimit *r, const char *id, usec_t rl_interval, unsigned rl_burst, int priority, uint64_t available);
+JournalRateLimit *journal_ratelimit_new(void);
+void journal_ratelimit_free(JournalRateLimit *r);
+int journal_ratelimit_test(JournalRateLimit *r, const char *id, usec_t rl_interval, unsigned rl_burst, int priority, uint64_t available);
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index a0c2dcd2d0..ff0188378f 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1098,7 +1098,7 @@ void server_dispatch_message(
if (c && c->unit) {
(void) determine_space(s, &available, NULL);
- rl = journal_rate_limit_test(s->rate_limit, c->unit, c->log_rate_limit_interval, c->log_rate_limit_burst, priority & LOG_PRIMASK, available);
+ rl = journal_ratelimit_test(s->ratelimit, c->unit, c->log_ratelimit_interval, c->log_ratelimit_burst, priority & LOG_PRIMASK, available);
if (rl == 0)
return;
@@ -2020,8 +2020,8 @@ int server_init(Server *s) {
.sync_interval_usec = DEFAULT_SYNC_INTERVAL_USEC,
.sync_scheduled = false,
- .rate_limit_interval = DEFAULT_RATE_LIMIT_INTERVAL,
- .rate_limit_burst = DEFAULT_RATE_LIMIT_BURST,
+ .ratelimit_interval = DEFAULT_RATE_LIMIT_INTERVAL,
+ .ratelimit_burst = DEFAULT_RATE_LIMIT_BURST,
.forward_to_wall = true,
@@ -2048,10 +2048,10 @@ int server_init(Server *s) {
if (r < 0)
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
- if (!!s->rate_limit_interval ^ !!s->rate_limit_burst) {
+ if (!!s->ratelimit_interval ^ !!s->ratelimit_burst) {
log_debug("Setting both rate limit interval and burst from "USEC_FMT",%u to 0,0",
- s->rate_limit_interval, s->rate_limit_burst);
- s->rate_limit_interval = s->rate_limit_burst = 0;
+ s->ratelimit_interval, s->ratelimit_burst);
+ s->ratelimit_interval = s->ratelimit_burst = 0;
}
(void) mkdir_p("/run/systemd/journal", 0755);
@@ -2180,8 +2180,8 @@ int server_init(Server *s) {
if (r < 0)
return r;
- s->rate_limit = journal_rate_limit_new();
- if (!s->rate_limit)
+ s->ratelimit = journal_ratelimit_new();
+ if (!s->ratelimit)
return -ENOMEM;
r = cg_get_root_path(&s->cgroup_root);
@@ -2261,8 +2261,8 @@ void server_done(Server *s) {
safe_close(s->hostname_fd);
safe_close(s->notify_fd);
- if (s->rate_limit)
- journal_rate_limit_free(s->rate_limit);
+ if (s->ratelimit)
+ journal_ratelimit_free(s->ratelimit);
if (s->kernel_seqnum)
munmap(s->kernel_seqnum, sizeof(uint64_t));
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
index 6ce9f269ff..e16f64bb4b 100644
--- a/src/journal/journald-server.h
+++ b/src/journal/journald-server.h
@@ -94,10 +94,10 @@ struct Server {
char *buffer;
size_t buffer_size;
- JournalRateLimit *rate_limit;
+ JournalRateLimit *ratelimit;
usec_t sync_interval_usec;
- usec_t rate_limit_interval;
- unsigned rate_limit_burst;
+ usec_t ratelimit_interval;
+ unsigned ratelimit_burst;
JournalStorage runtime_storage;
JournalStorage system_storage;