mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #29995 from keszybz/voidify-timestamp-getters
Rename and voidify timestamp getters
This commit is contained in:
@@ -1230,7 +1230,7 @@ libcryptsetup = get_option('libcryptsetup')
|
||||
libcryptsetup_plugins = get_option('libcryptsetup-plugins')
|
||||
if libcryptsetup_plugins.enabled()
|
||||
if libcryptsetup.disabled()
|
||||
error('libcryptsetup-plugins can not be requested without libcryptsetup')
|
||||
error('libcryptsetup-plugins cannot be requested without libcryptsetup')
|
||||
endif
|
||||
libcryptsetup = libcryptsetup_plugins
|
||||
endif
|
||||
|
||||
@@ -64,7 +64,7 @@ nsec_t now_nsec(clockid_t clock_id) {
|
||||
return timespec_load_nsec(&ts);
|
||||
}
|
||||
|
||||
dual_timestamp* dual_timestamp_get(dual_timestamp *ts) {
|
||||
dual_timestamp* dual_timestamp_now(dual_timestamp *ts) {
|
||||
assert(ts);
|
||||
|
||||
ts->realtime = now(CLOCK_REALTIME);
|
||||
@@ -73,7 +73,7 @@ dual_timestamp* dual_timestamp_get(dual_timestamp *ts) {
|
||||
return ts;
|
||||
}
|
||||
|
||||
triple_timestamp* triple_timestamp_get(triple_timestamp *ts) {
|
||||
triple_timestamp* triple_timestamp_now(triple_timestamp *ts) {
|
||||
assert(ts);
|
||||
|
||||
ts->realtime = now(CLOCK_REALTIME);
|
||||
|
||||
@@ -79,12 +79,12 @@ nsec_t now_nsec(clockid_t clock);
|
||||
|
||||
usec_t map_clock_usec(usec_t from, clockid_t from_clock, clockid_t to_clock);
|
||||
|
||||
dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
|
||||
dual_timestamp* dual_timestamp_now(dual_timestamp *ts);
|
||||
dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
|
||||
dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
|
||||
dual_timestamp* dual_timestamp_from_boottime(dual_timestamp *ts, usec_t u);
|
||||
|
||||
triple_timestamp* triple_timestamp_get(triple_timestamp *ts);
|
||||
triple_timestamp* triple_timestamp_now(triple_timestamp *ts);
|
||||
triple_timestamp* triple_timestamp_from_realtime(triple_timestamp *ts, usec_t u);
|
||||
triple_timestamp* triple_timestamp_from_boottime(triple_timestamp *ts, usec_t u);
|
||||
|
||||
|
||||
@@ -1797,7 +1797,7 @@ void exec_status_start(ExecStatus *s, pid_t pid) {
|
||||
.pid = pid,
|
||||
};
|
||||
|
||||
dual_timestamp_get(&s->start_timestamp);
|
||||
dual_timestamp_now(&s->start_timestamp);
|
||||
}
|
||||
|
||||
void exec_status_exit(ExecStatus *s, const ExecContext *context, pid_t pid, int code, int status) {
|
||||
@@ -1808,7 +1808,7 @@ void exec_status_exit(ExecStatus *s, const ExecContext *context, pid_t pid, int
|
||||
.pid = pid,
|
||||
};
|
||||
|
||||
dual_timestamp_get(&s->exit_timestamp);
|
||||
dual_timestamp_now(&s->exit_timestamp);
|
||||
|
||||
s->code = code;
|
||||
s->status = status;
|
||||
|
||||
@@ -2687,7 +2687,7 @@ static int initialize_security(
|
||||
assert(security_finish_timestamp);
|
||||
assert(ret_error_message);
|
||||
|
||||
dual_timestamp_get(security_start_timestamp);
|
||||
dual_timestamp_now(security_start_timestamp);
|
||||
|
||||
r = mac_selinux_setup(loaded_policy);
|
||||
if (r < 0) {
|
||||
@@ -2713,7 +2713,7 @@ static int initialize_security(
|
||||
return r;
|
||||
}
|
||||
|
||||
dual_timestamp_get(security_finish_timestamp);
|
||||
dual_timestamp_now(security_finish_timestamp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2819,7 +2819,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
/* Take timestamps early on */
|
||||
dual_timestamp_from_monotonic(&kernel_timestamp, 0);
|
||||
dual_timestamp_get(&userspace_timestamp);
|
||||
dual_timestamp_now(&userspace_timestamp);
|
||||
|
||||
/* Figure out whether we need to do initialize the system, or if we already did that because we are
|
||||
* reexecuting. */
|
||||
|
||||
@@ -1948,7 +1948,7 @@ static void manager_ready(Manager *m) {
|
||||
|
||||
Manager* manager_reloading_start(Manager *m) {
|
||||
m->n_reloading++;
|
||||
dual_timestamp_get(m->timestamps + MANAGER_TIMESTAMP_UNITS_LOAD);
|
||||
dual_timestamp_now(m->timestamps + MANAGER_TIMESTAMP_UNITS_LOAD);
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -1972,11 +1972,11 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *roo
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
dual_timestamp_get(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_GENERATORS_START));
|
||||
dual_timestamp_now(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_GENERATORS_START));
|
||||
r = manager_run_environment_generators(m);
|
||||
if (r >= 0)
|
||||
r = manager_run_generators(m);
|
||||
dual_timestamp_get(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_GENERATORS_FINISH));
|
||||
dual_timestamp_now(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_GENERATORS_FINISH));
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1998,10 +1998,10 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *roo
|
||||
reloading = manager_reloading_start(m);
|
||||
|
||||
/* First, enumerate what we can from all config files */
|
||||
dual_timestamp_get(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_UNITS_LOAD_START));
|
||||
dual_timestamp_now(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_UNITS_LOAD_START));
|
||||
manager_enumerate_perpetual(m);
|
||||
manager_enumerate(m);
|
||||
dual_timestamp_get(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_UNITS_LOAD_FINISH));
|
||||
dual_timestamp_now(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_UNITS_LOAD_FINISH));
|
||||
|
||||
/* Second, deserialize if there is something to deserialize */
|
||||
if (serialization) {
|
||||
@@ -3891,7 +3891,7 @@ void manager_check_finished(Manager *m) {
|
||||
/* This is no longer the first boot */
|
||||
manager_set_first_boot(m, false);
|
||||
|
||||
dual_timestamp_get(m->timestamps + MANAGER_TIMESTAMP_FINISH);
|
||||
dual_timestamp_now(m->timestamps + MANAGER_TIMESTAMP_FINISH);
|
||||
|
||||
manager_notify_finished(m);
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ static void service_extend_timeout(Service *s, usec_t extend_timeout_usec) {
|
||||
static void service_reset_watchdog(Service *s) {
|
||||
assert(s);
|
||||
|
||||
dual_timestamp_get(&s->watchdog_timestamp);
|
||||
dual_timestamp_now(&s->watchdog_timestamp);
|
||||
service_start_watchdog(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
triple_timestamp_get(&ts);
|
||||
triple_timestamp_now(&ts);
|
||||
t->next_elapse_monotonic_or_boottime = t->next_elapse_realtime = 0;
|
||||
|
||||
LIST_FOREACH(value, v, t->values) {
|
||||
@@ -618,7 +618,7 @@ static void timer_enter_running(Timer *t) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dual_timestamp_get(&t->last_trigger);
|
||||
dual_timestamp_now(&t->last_trigger);
|
||||
ACTIVATION_DETAILS_TIMER(details)->last_trigger = t->last_trigger;
|
||||
|
||||
job_set_activation_details(job, details);
|
||||
|
||||
@@ -526,7 +526,7 @@ int unit_deserialize_state(Unit *u, FILE *f, FDSet *fds) {
|
||||
* reboots. */
|
||||
|
||||
if (!dual_timestamp_is_set(&u->state_change_timestamp))
|
||||
dual_timestamp_get(&u->state_change_timestamp);
|
||||
dual_timestamp_now(&u->state_change_timestamp);
|
||||
|
||||
/* Let's make sure that everything that is deserialized also gets any potential new cgroup settings
|
||||
* applied after we are done. For that we invalidate anything already realized, so that we can
|
||||
|
||||
@@ -1779,7 +1779,7 @@ static bool unit_test_condition(Unit *u) {
|
||||
|
||||
assert(u);
|
||||
|
||||
dual_timestamp_get(&u->condition_timestamp);
|
||||
dual_timestamp_now(&u->condition_timestamp);
|
||||
|
||||
r = manager_get_effective_environment(u->manager, &env);
|
||||
if (r < 0) {
|
||||
@@ -1803,7 +1803,7 @@ static bool unit_test_assert(Unit *u) {
|
||||
|
||||
assert(u);
|
||||
|
||||
dual_timestamp_get(&u->assert_timestamp);
|
||||
dual_timestamp_now(&u->assert_timestamp);
|
||||
|
||||
r = manager_get_effective_environment(u->manager, &env);
|
||||
if (r < 0) {
|
||||
@@ -2740,7 +2740,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
|
||||
|
||||
/* Update timestamps for state changes */
|
||||
if (!MANAGER_IS_RELOADING(m)) {
|
||||
dual_timestamp_get(&u->state_change_timestamp);
|
||||
dual_timestamp_now(&u->state_change_timestamp);
|
||||
|
||||
if (UNIT_IS_INACTIVE_OR_FAILED(os) && !UNIT_IS_INACTIVE_OR_FAILED(ns))
|
||||
u->inactive_exit_timestamp = u->state_change_timestamp;
|
||||
@@ -5079,10 +5079,7 @@ bool unit_type_supported(UnitType t) {
|
||||
static int8_t cache[_UNIT_TYPE_MAX] = {}; /* -1: disabled, 1: enabled: 0: don't know */
|
||||
int r;
|
||||
|
||||
if (_unlikely_(t < 0))
|
||||
return false;
|
||||
if (_unlikely_(t >= _UNIT_TYPE_MAX))
|
||||
return false;
|
||||
assert(t >= 0 && t < _UNIT_TYPE_MAX);
|
||||
|
||||
if (cache[t] == 0) {
|
||||
char *e;
|
||||
|
||||
@@ -45,7 +45,7 @@ _public_ int cryptsetup_token_open_pin(
|
||||
|
||||
r = crypt_normalize_pin(pin, pin_size, &pin_string);
|
||||
if (r < 0)
|
||||
return crypt_log_debug_errno(cd, r, "Can not normalize PIN: %m");
|
||||
return crypt_log_debug_errno(cd, r, "Cannot normalize PIN: %m");
|
||||
|
||||
return acquire_luks2_key(cd, json, (const char *)usrptr, pin_string, password, password_len);
|
||||
}
|
||||
@@ -104,11 +104,11 @@ _public_ void cryptsetup_token_dump(
|
||||
|
||||
r = crypt_dump_buffer_to_hex_string(cid, cid_size, &cid_str);
|
||||
if (r < 0)
|
||||
return (void) crypt_log_debug_errno(cd, r, "Can not dump " TOKEN_NAME " content: %m");
|
||||
return (void) crypt_log_debug_errno(cd, r, "Cannot dump " TOKEN_NAME " content: %m");
|
||||
|
||||
r = crypt_dump_buffer_to_hex_string(salt, salt_size, &salt_str);
|
||||
if (r < 0)
|
||||
return (void) crypt_log_debug_errno(cd, r, "Can not dump " TOKEN_NAME " content: %m");
|
||||
return (void) crypt_log_debug_errno(cd, r, "Cannot dump " TOKEN_NAME " content: %m");
|
||||
|
||||
if (required & FIDO2ENROLL_PIN)
|
||||
client_pin_req_str = "true";
|
||||
|
||||
@@ -95,7 +95,7 @@ _public_ void cryptsetup_token_dump(
|
||||
|
||||
r = crypt_dump_buffer_to_hex_string(pkcs11_key, pkcs11_key_size, &key_str);
|
||||
if (r < 0)
|
||||
return (void) crypt_log_debug_errno(cd, r, "Can not dump " TOKEN_NAME " content: %m");
|
||||
return (void) crypt_log_debug_errno(cd, r, "Cannot dump " TOKEN_NAME " content: %m");
|
||||
|
||||
crypt_log(cd, "\tpkcs11-uri: %s\n", pkcs11_uri);
|
||||
crypt_log(cd, "\tpkcs11-key: %s\n", key_str);
|
||||
|
||||
@@ -68,7 +68,7 @@ _public_ int cryptsetup_token_open_pin(
|
||||
|
||||
r = crypt_normalize_pin(pin, pin_size, &pin_string);
|
||||
if (r < 0)
|
||||
return crypt_log_debug_errno(cd, r, "Can not normalize PIN: %m");
|
||||
return crypt_log_debug_errno(cd, r, "Cannot normalize PIN: %m");
|
||||
|
||||
if (usrptr)
|
||||
params = *(systemd_tpm2_plugin_params *)usrptr;
|
||||
@@ -222,15 +222,15 @@ _public_ void cryptsetup_token_dump(
|
||||
|
||||
r = crypt_dump_buffer_to_hex_string(blob, blob_size, &blob_str);
|
||||
if (r < 0)
|
||||
return (void) crypt_log_debug_errno(cd, r, "Can not dump " TOKEN_NAME " content: %m");
|
||||
return (void) crypt_log_debug_errno(cd, r, "Cannot dump " TOKEN_NAME " content: %m");
|
||||
|
||||
r = crypt_dump_buffer_to_hex_string(pubkey, pubkey_size, &pubkey_str);
|
||||
if (r < 0)
|
||||
return (void) crypt_log_debug_errno(cd, r, "Can not dump " TOKEN_NAME " content: %m");
|
||||
return (void) crypt_log_debug_errno(cd, r, "Cannot dump " TOKEN_NAME " content: %m");
|
||||
|
||||
r = crypt_dump_buffer_to_hex_string(policy_hash, policy_hash_size, &policy_hash_str);
|
||||
if (r < 0)
|
||||
return (void) crypt_log_debug_errno(cd, r, "Can not dump " TOKEN_NAME " content: %m");
|
||||
return (void) crypt_log_debug_errno(cd, r, "Cannot dump " TOKEN_NAME " content: %m");
|
||||
|
||||
crypt_log(cd, "\ttpm2-hash-pcrs: %s\n", strna(hash_pcrs_str));
|
||||
crypt_log(cd, "\ttpm2-pcr-bank: %s\n", strna(tpm2_hash_alg_to_string(pcr_bank)));
|
||||
|
||||
@@ -217,7 +217,7 @@ int acquire_luks2_key(
|
||||
|
||||
base64_encoded_size = base64mem(decrypted_key, decrypted_key_size, &base64_encoded);
|
||||
if (base64_encoded_size < 0)
|
||||
return crypt_log_error_errno(cd, (int) base64_encoded_size, "Can not base64 encode key: %m");
|
||||
return crypt_log_error_errno(cd, (int) base64_encoded_size, "Cannot base64 encode key: %m");
|
||||
|
||||
*ret_password = TAKE_PTR(base64_encoded);
|
||||
*ret_password_size = base64_encoded_size;
|
||||
|
||||
@@ -44,7 +44,7 @@ int icmp6_receive(
|
||||
assert_se(read (fd, iov_base, iov_len) == (ssize_t) iov_len);
|
||||
|
||||
if (ret_timestamp)
|
||||
triple_timestamp_get(ret_timestamp);
|
||||
triple_timestamp_now(ret_timestamp);
|
||||
|
||||
if (ret_sender)
|
||||
*ret_sender = dummy_link_local;
|
||||
|
||||
@@ -214,7 +214,7 @@ int icmp6_receive(
|
||||
if (triple_timestamp_is_set(&t))
|
||||
*ret_timestamp = t;
|
||||
else
|
||||
triple_timestamp_get(ret_timestamp);
|
||||
triple_timestamp_now(ret_timestamp);
|
||||
}
|
||||
|
||||
if (ret_sender)
|
||||
|
||||
@@ -39,7 +39,7 @@ void dhcp_lease_set_timestamp(sd_dhcp_lease *lease, const triple_timestamp *time
|
||||
if (timestamp && triple_timestamp_is_set(timestamp))
|
||||
lease->timestamp = *timestamp;
|
||||
else
|
||||
triple_timestamp_get(&lease->timestamp);
|
||||
triple_timestamp_now(&lease->timestamp);
|
||||
}
|
||||
|
||||
int sd_dhcp_lease_get_timestamp(sd_dhcp_lease *lease, clockid_t clock, uint64_t *ret) {
|
||||
|
||||
@@ -903,7 +903,7 @@ static void request_set_timestamp(DHCPRequest *req, const triple_timestamp *time
|
||||
if (timestamp && triple_timestamp_is_set(timestamp))
|
||||
req->timestamp = *timestamp;
|
||||
else
|
||||
triple_timestamp_get(&req->timestamp);
|
||||
triple_timestamp_now(&req->timestamp);
|
||||
}
|
||||
|
||||
static int request_get_lifetime_timestamp(DHCPRequest *req, clockid_t clock, usec_t *ret) {
|
||||
|
||||
@@ -20,7 +20,7 @@ static void dhcp6_lease_set_timestamp(sd_dhcp6_lease *lease, const triple_timest
|
||||
if (timestamp && triple_timestamp_is_set(timestamp))
|
||||
lease->timestamp = *timestamp;
|
||||
else
|
||||
triple_timestamp_get(&lease->timestamp);
|
||||
triple_timestamp_now(&lease->timestamp);
|
||||
}
|
||||
|
||||
int sd_dhcp6_lease_get_timestamp(sd_dhcp6_lease *lease, clockid_t clock, uint64_t *ret) {
|
||||
|
||||
@@ -229,7 +229,7 @@ static int lldp_rx_receive_datagram(sd_event_source *s, int fd, uint32_t revents
|
||||
if (ioctl(fd, SIOCGSTAMPNS, &ts) >= 0)
|
||||
triple_timestamp_from_realtime(&n->timestamp, timespec_load(&ts));
|
||||
else
|
||||
triple_timestamp_get(&n->timestamp);
|
||||
triple_timestamp_now(&n->timestamp);
|
||||
|
||||
(void) lldp_rx_handle_datagram(lldp_rx, n);
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user