From d4f938aec1a094d5b071b7bec8ccaad56d392312 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 25 May 2025 19:43:45 +0200 Subject: [PATCH 1/8] env-util: rename 'n' -> 'length' --- src/basic/env-util.c | 8 ++++---- src/basic/env-util.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/basic/env-util.c b/src/basic/env-util.c index 7bdfdec851..bbb6d5829b 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -688,7 +688,7 @@ static int strv_env_get_n_validated( int replace_env_full( const char *format, - size_t n, + size_t length, char **env, ReplaceEnvFlags flags, char **ret, @@ -714,13 +714,13 @@ int replace_env_full( assert(format); - if (n == SIZE_MAX) - n = strlen(format); + if (length == SIZE_MAX) + length = strlen(format); pu = ret_unset_variables ? &unset_variables : NULL; pb = ret_bad_variables ? &bad_variables : NULL; - for (e = format, i = 0; *e && i < n; e++, i++) + for (e = format, i = 0; *e && i < length; e++, i++) switch (state) { case WORD: diff --git a/src/basic/env-util.h b/src/basic/env-util.h index 6c25ca3804..9f55a91fff 100644 --- a/src/basic/env-util.h +++ b/src/basic/env-util.h @@ -15,7 +15,7 @@ typedef enum ReplaceEnvFlags { REPLACE_ENV_ALLOW_EXTENDED = 1 << 2, } ReplaceEnvFlags; -int replace_env_full(const char *format, size_t n, char **env, ReplaceEnvFlags flags, char **ret, char ***ret_unset_variables, char ***ret_bad_variables); +int replace_env_full(const char *format, size_t length, char **env, ReplaceEnvFlags flags, char **ret, char ***ret_unset_variables, char ***ret_bad_variables); static inline int replace_env(const char *format, char **env, ReplaceEnvFlags flags, char **ret) { return replace_env_full(format, SIZE_MAX, env, flags, ret, NULL, NULL); } From 09958bbb983694888b98a7cbdda38bf4a0641a48 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 25 May 2025 19:45:37 +0200 Subject: [PATCH 2/8] nspawn: correct argument comments --- src/nspawn/nspawn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index c89f8723e6..f404e085a7 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3757,7 +3757,7 @@ static int setup_unix_export_dir_outside(char **ret) { * itself is writable, but not through the mount accessible from the host. */ r = mount_nofollow_verbose( LOG_ERR, - /* source= */ NULL, + /* what= */ NULL, w, /* fstype= */ NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_NODEV|MS_NOEXEC|MS_NOSUID|ms_nosymfollow_supported(), @@ -3802,7 +3802,7 @@ static int setup_unix_export_host_inside(const char *directory, const char *unix r = mount_nofollow_verbose( LOG_ERR, - /* source= */ NULL, + /* what= */ NULL, p, /* fstype= */ NULL, MS_BIND|MS_REMOUNT|MS_NODEV|MS_NOEXEC|MS_NOSUID|ms_nosymfollow_supported(), From 2377cbcd19df0ca5e1b829b4ff134d923f17bf86 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 25 May 2025 19:46:47 +0200 Subject: [PATCH 3/8] mount-util: correct argument comment --- src/shared/mount-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 958b4d7e18..71ee5cf734 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -1983,7 +1983,7 @@ int path_is_network_fs_harder_at(int dir_fd, const char *path) { return r; _cleanup_free_ char *fstype = NULL, *options = NULL; - r = path_get_mount_info_at(fd, /* path = */ NULL, &fstype, &options, /* source = */ NULL); + r = path_get_mount_info_at(fd, /* path = */ NULL, &fstype, &options, /* ret_source = */ NULL); if (r < 0) return r; From 2bfa3185aa2df9a5c576dac78566ad8489873b28 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 25 May 2025 19:53:24 +0200 Subject: [PATCH 4/8] sd-journal: rename sd_journal_get_monotonic_usec ret argument Rename ret to ret_monotonic to distinguish from ret_boot_id and according to existing argument comments. --- src/libsystemd/sd-journal/sd-journal.c | 6 +++--- src/systemd/sd-journal.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index 8ec1fe450c..840f6d684b 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -2706,7 +2706,7 @@ _public_ int sd_journal_get_realtime_usec(sd_journal *j, uint64_t *ret) { return 0; } -_public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id128_t *ret_boot_id) { +_public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret_monotonic, sd_id128_t *ret_boot_id) { JournalFile *f; Object *o; int r; @@ -2739,8 +2739,8 @@ _public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id12 if (!VALID_MONOTONIC(t)) return -EBADMSG; - if (ret) - *ret = t; + if (ret_monotonic) + *ret_monotonic = t; if (ret_boot_id) *ret_boot_id = o->entry.boot_id; diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h index ec1568904e..57dc8a8332 100644 --- a/src/systemd/sd-journal.h +++ b/src/systemd/sd-journal.h @@ -98,7 +98,7 @@ int sd_journal_previous_skip(sd_journal *j, uint64_t skip); int sd_journal_next_skip(sd_journal *j, uint64_t skip); int sd_journal_get_realtime_usec(sd_journal *j, uint64_t *ret); -int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id128_t *ret_boot_id); +int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret_monotonic, sd_id128_t *ret_boot_id); int sd_journal_get_seqnum(sd_journal *j, uint64_t *ret_seqnum, sd_id128_t *ret_seqnum_id); int sd_journal_set_data_threshold(sd_journal *j, size_t sz); From e58cf27aafa871e34ff68a4459e87eb770dded72 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Wed, 28 May 2025 20:57:33 +0200 Subject: [PATCH 5/8] sd-varlink: fix argument naming --- src/systemd/sd-varlink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemd/sd-varlink.h b/src/systemd/sd-varlink.h index d1f5087492..67d9cc3d94 100644 --- a/src/systemd/sd-varlink.h +++ b/src/systemd/sd-varlink.h @@ -239,7 +239,7 @@ int sd_varlink_server_listen_fd(sd_varlink_server *s, int fd); int sd_varlink_server_listen_auto(sd_varlink_server *s); int sd_varlink_server_listen_name(sd_varlink_server *s, const char *name); int sd_varlink_server_add_connection(sd_varlink_server *s, int fd, sd_varlink **ret); -int sd_varlink_server_add_connection_pair(sd_varlink_server *s, int input_fd, int output_fd, const struct ucred *ucred_override, sd_varlink **ret); +int sd_varlink_server_add_connection_pair(sd_varlink_server *s, int input_fd, int output_fd, const struct ucred *override_ucred, sd_varlink **ret); int sd_varlink_server_add_connection_stdio(sd_varlink_server *s, sd_varlink **ret); /* Bind callbacks */ From 8821a312a8a964880db6d680cdf808a50c760167 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 1 Jun 2025 10:18:38 +0200 Subject: [PATCH 6/8] uid-range: correct argument comment --- src/basic/uid-range.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/uid-range.c b/src/basic/uid-range.c index 109bef51cb..2f20f0e1f1 100644 --- a/src/basic/uid-range.c +++ b/src/basic/uid-range.c @@ -367,7 +367,7 @@ int uid_map_search_root(pid_t pid, UIDRangeUsernsMode mode, uid_t *ret) { for (;;) { uid_t uid_base = UID_INVALID, uid_shift = UID_INVALID; - r = uid_map_read_one(f, &uid_base, &uid_shift, /* ret_uid_range= */ NULL); + r = uid_map_read_one(f, &uid_base, &uid_shift, /* ret_range= */ NULL); if (r < 0) return r; From fa6f4484e8349efaeec07caf9d844b41edfabc7a Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 2 Jun 2025 17:42:08 +0200 Subject: [PATCH 7/8] io-util: rename 'nfds' -> 'n_fds' --- src/basic/io-util.c | 10 +++++----- src/basic/io-util.h | 6 +++--- src/basic/terminal-util.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/basic/io-util.c b/src/basic/io-util.c index 69c275ae17..82fad1303f 100644 --- a/src/basic/io-util.c +++ b/src/basic/io-util.c @@ -188,10 +188,10 @@ int pipe_eof(int fd) { return !!(r & POLLHUP); } -int ppoll_usec_full(struct pollfd *fds, size_t nfds, usec_t timeout, const sigset_t *ss) { +int ppoll_usec_full(struct pollfd *fds, size_t n_fds, usec_t timeout, const sigset_t *ss) { int r; - assert(fds || nfds == 0); + assert(fds || n_fds == 0); /* This is a wrapper around ppoll() that does primarily two things: * @@ -208,16 +208,16 @@ int ppoll_usec_full(struct pollfd *fds, size_t nfds, usec_t timeout, const sigse * to handle signals, such as signalfd() or signal handlers. ⚠️ ⚠️ ⚠️ */ - if (nfds == 0 && timeout == 0) + if (n_fds == 0 && timeout == 0) return 0; - r = ppoll(fds, nfds, timeout == USEC_INFINITY ? NULL : TIMESPEC_STORE(timeout), ss); + r = ppoll(fds, n_fds, timeout == USEC_INFINITY ? NULL : TIMESPEC_STORE(timeout), ss); if (r < 0) return -errno; if (r == 0) return 0; - for (size_t i = 0, n = r; i < nfds && n > 0; i++) { + for (size_t i = 0, n = r; i < n_fds && n > 0; i++) { if (fds[i].revents == 0) continue; if (fds[i].revents & POLLNVAL) diff --git a/src/basic/io-util.h b/src/basic/io-util.h index f560b706b4..237a9ff77f 100644 --- a/src/basic/io-util.h +++ b/src/basic/io-util.h @@ -15,9 +15,9 @@ static inline int loop_write(int fd, const void *buf, size_t nbytes) { int pipe_eof(int fd); -int ppoll_usec_full(struct pollfd *fds, size_t nfds, usec_t timeout, const sigset_t *ss) _nonnull_if_nonzero_(1, 2); -_nonnull_if_nonzero_(1, 2) static inline int ppoll_usec(struct pollfd *fds, size_t nfds, usec_t timeout) { - return ppoll_usec_full(fds, nfds, timeout, NULL); +int ppoll_usec_full(struct pollfd *fds, size_t n_fds, usec_t timeout, const sigset_t *ss) _nonnull_if_nonzero_(1, 2); +_nonnull_if_nonzero_(1, 2) static inline int ppoll_usec(struct pollfd *fds, size_t n_fds, usec_t timeout) { + return ppoll_usec_full(fds, n_fds, timeout, NULL); } int fd_wait_for_event(int fd, int event, usec_t timeout); diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index b2a1c5c615..5f7b670389 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -735,7 +735,7 @@ int acquire_terminal( .fd = notify, .events = POLLIN, }, - /* n_pollfds = */ 1, + /* n_fds = */ 1, left, &poll_ss); if (r < 0) From 4b7edce9163659f8272259d5edd4f108b3c7d419 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 2 Jun 2025 17:55:53 +0200 Subject: [PATCH 8/8] shared/install.h: rename 'flags' -> 'file_flags' Make it consistent with the implementation. --- src/shared/install.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/install.h b/src/shared/install.h index 0f9b0798aa..39bded38b8 100644 --- a/src/shared/install.h +++ b/src/shared/install.h @@ -112,7 +112,7 @@ int unit_file_reenable( size_t *n_changes); int unit_file_preset( RuntimeScope scope, - UnitFileFlags flags, + UnitFileFlags file_flags, const char *root_dir, char * const *names, UnitFilePresetMode mode, @@ -120,7 +120,7 @@ int unit_file_preset( size_t *n_changes); int unit_file_preset_all( RuntimeScope scope, - UnitFileFlags flags, + UnitFileFlags file_flags, const char *root_dir, UnitFilePresetMode mode, InstallChange **changes,