tree-wide: normalize comment style

This commit is contained in:
Yu Watanabe
2025-12-15 08:50:13 +09:00
parent 8e20b9a79d
commit 93378148d4
431 changed files with 1894 additions and 1895 deletions
+3 -3
View File
@@ -322,7 +322,7 @@ static int clean_pool_done_internal(Operation *operation, FILE *file, int child_
assert(operation);
assert(operation->link);
r = clean_pool_read_first_entry(file, child_error, /* error = */ NULL);
r = clean_pool_read_first_entry(file, child_error, /* error= */ NULL);
if (r < 0)
return log_debug_errno(r, "Failed to read first entry from tmp file: %m");
@@ -340,7 +340,7 @@ static int clean_pool_done_internal(Operation *operation, FILE *file, int child_
break;
if (previous_name) {
r = clean_pool_list_one_image(operation->link, previous_name, previous_usage, /* more = */ true);
r = clean_pool_list_one_image(operation->link, previous_name, previous_usage, /* more= */ true);
if (r < 0)
return r;
/* freeing memory to avoid memleak at the following assignment */
@@ -352,7 +352,7 @@ static int clean_pool_done_internal(Operation *operation, FILE *file, int child_
}
if (previous_name)
return clean_pool_list_one_image(operation->link, previous_name, previous_usage, /* more = */ false);
return clean_pool_list_one_image(operation->link, previous_name, previous_usage, /* more= */ false);
return sd_varlink_error(operation->link, "io.systemd.MachineImage.NoSuchImage", NULL);
}
+1 -1
View File
@@ -120,7 +120,7 @@ int image_clean_pool_operation(Manager *manager, ImageCleanPoolMode mode, Operat
errno_pipe_fd[0] = safe_close(errno_pipe_fd[0]);
_cleanup_hashmap_free_ Hashmap *images = NULL;
r = image_discover(manager->runtime_scope, IMAGE_MACHINE, /* root = */ NULL, &images);
r = image_discover(manager->runtime_scope, IMAGE_MACHINE, /* root= */ NULL, &images);
if (r < 0) {
log_debug_errno(r, "Failed to discover images: %m");
report_errno_and_exit(errno_pipe_fd[1], r);
+2 -2
View File
@@ -579,7 +579,7 @@ int vl_method_open(sd_varlink *link, sd_json_variant *parameters, sd_varlink_met
break;
case MACHINE_OPEN_MODE_LOGIN:
r = machine_start_getty(machine, ptmx_name, /* error = */ NULL);
r = machine_start_getty(machine, ptmx_name, /* error= */ NULL);
if (r == -ENOENT)
return sd_varlink_error(link, VARLINK_ERROR_MACHINE_NO_IPC, NULL);
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
@@ -591,7 +591,7 @@ int vl_method_open(sd_varlink *link, sd_json_variant *parameters, sd_varlink_met
case MACHINE_OPEN_MODE_SHELL: {
assert(user && path && args); /* to avoid gcc complaining about possible uninitialized variables */
r = machine_start_shell(machine, ptmx_fd, ptmx_name, user, path, args, p.env, /* error = */ NULL);
r = machine_start_shell(machine, ptmx_fd, ptmx_name, user, path, args, p.env, /* error= */ NULL);
if (r == -ENOENT)
return sd_varlink_error(link, VARLINK_ERROR_MACHINE_NO_IPC, NULL);
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+23 -23
View File
@@ -509,7 +509,7 @@ static int machine_start_scope(
* doesn't support PIDFDs yet, let's try without. */
if (allow_pidfd &&
sd_bus_error_has_names(&e, SD_BUS_ERROR_UNKNOWN_PROPERTY, SD_BUS_ERROR_PROPERTY_READ_ONLY))
return machine_start_scope(machine, /* allow_pidfd = */ false, more_properties, error);
return machine_start_scope(machine, /* allow_pidfd= */ false, more_properties, error);
return sd_bus_error_move(error, &e);
}
@@ -532,7 +532,7 @@ static int machine_ensure_scope(Machine *m, sd_bus_message *properties, sd_bus_e
assert(m->class != MACHINE_HOST);
if (!m->unit) {
r = machine_start_scope(m, /* allow_pidfd = */ true, properties, error);
r = machine_start_scope(m, /* allow_pidfd= */ true, properties, error);
if (r < 0)
return log_error_errno(r, "Failed to start machine scope: %s", bus_error_message(error, r));
}
@@ -928,7 +928,7 @@ int machine_start_getty(Machine *m, const char *ptmx_name, sd_bus_error *error)
container_bus = allocated_bus ?: m->manager->system_bus;
getty = strjoina("container-getty@", p, ".service");
r = bus_call_method(container_bus, bus_systemd_mgr, "StartUnit", error, /* ret_reply = */ NULL, "ss", getty, "replace");
r = bus_call_method(container_bus, bus_systemd_mgr, "StartUnit", error, /* ret_reply= */ NULL, "ss", getty, "replace");
if (r < 0)
return log_debug_errno(r, "Failed to StartUnit '%s' in container '%s': %m", getty, m->name);
@@ -1183,14 +1183,14 @@ int machine_copy_from_to_operation(
r = namespace_fork("(sd-copyns)",
"(sd-copy)",
/* except_fds = */ NULL,
/* n_except_fds = */ 0,
/* except_fds= */ NULL,
/* n_except_fds= */ 0,
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL,
/* pidns_fd = */ -EBADF,
/* pidns_fd= */ -EBADF,
target_mntns_fd,
/* netns_fd = */ -EBADF,
/* userns_fd = */ -EBADF,
/* root_fd = */ -EBADF,
/* netns_fd= */ -EBADF,
/* userns_fd= */ -EBADF,
/* root_fd= */ -EBADF,
&child);
if (r < 0)
return log_debug_errno(r, "Failed to fork into mount namespace of machine '%s': %m", machine->name);
@@ -1223,8 +1223,8 @@ int machine_copy_from_to_operation(
uid_shift == 0 ? UID_INVALID : 0,
uid_shift == 0 ? GID_INVALID : 0,
copy_flags,
/* denylist = */ NULL,
/* subvolumes = */ NULL);
/* denylist= */ NULL,
/* subvolumes= */ NULL);
else
r = copy_tree_at(
host_fd,
@@ -1234,8 +1234,8 @@ int machine_copy_from_to_operation(
uid_shift == 0 ? UID_INVALID : uid_shift,
uid_shift == 0 ? GID_INVALID : uid_shift,
copy_flags,
/* denylist = */ NULL,
/* subvolumes = */ NULL);
/* denylist= */ NULL,
/* subvolumes= */ NULL);
if (r < 0)
log_debug_errno(r, "Failed to copy tree: %m");
@@ -1536,10 +1536,10 @@ int machine_open_root_directory(Machine *machine) {
pid_t child;
r = pidref_namespace_open(&machine->leader,
/* ret_pidns_fd = */ NULL,
/* ret_pidns_fd= */ NULL,
&mntns_fd,
/* ret_netns_fd = */ NULL,
/* ret_userns_fd = */ NULL,
/* ret_netns_fd= */ NULL,
/* ret_userns_fd= */ NULL,
&root_fd);
if (r < 0)
return log_debug_errno(r, "Failed to open mount namespace of machine '%s': %m", machine->name);
@@ -1553,13 +1553,13 @@ int machine_open_root_directory(Machine *machine) {
r = namespace_fork(
"(sd-openrootns)",
"(sd-openroot)",
/* except_fds = */ NULL,
/* n_except_fds = */ 0,
/* except_fds= */ NULL,
/* n_except_fds= */ 0,
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL,
/* pidns_fd = */ -EBADF,
/* pidns_fd= */ -EBADF,
mntns_fd,
/* netns_fd = */ -EBADF,
/* userns_fd = */ -EBADF,
/* netns_fd= */ -EBADF,
/* userns_fd= */ -EBADF,
root_fd,
&child);
if (r < 0)
@@ -1576,7 +1576,7 @@ int machine_open_root_directory(Machine *machine) {
report_errno_and_exit(errno_pipe_fd[1], -errno);
}
r = send_one_fd(fd_pass_socket[1], dfd, /* flags = */ 0);
r = send_one_fd(fd_pass_socket[1], dfd, /* flags= */ 0);
dfd = safe_close(dfd);
if (r < 0) {
log_debug_errno(r, "Failed to send FD over socket: %m");
@@ -1589,7 +1589,7 @@ int machine_open_root_directory(Machine *machine) {
errno_pipe_fd[1] = safe_close(errno_pipe_fd[1]);
fd_pass_socket[1] = safe_close(fd_pass_socket[1]);
r = wait_for_terminate_and_check("(sd-openrootns)", child, /* flags = */ 0);
r = wait_for_terminate_and_check("(sd-openrootns)", child, /* flags= */ 0);
if (r < 0)
return log_debug_errno(r, "Failed to wait for child: %m");
+8 -8
View File
@@ -642,15 +642,15 @@ static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
show_journal_by_unit(
stdout,
i->unit,
/* namespace = */ NULL,
/* namespace= */ NULL,
arg_output,
/* n_columns = */ 0,
/* n_columns= */ 0,
i->timestamp.monotonic,
arg_lines,
get_output_flags() | OUTPUT_BEGIN_NEWLINE,
SD_JOURNAL_LOCAL_ONLY,
/* system_unit = */ true,
/* ellipsized = */ NULL);
/* system_unit= */ true,
/* ellipsized= */ NULL);
}
}
@@ -1472,7 +1472,7 @@ static int shell_machine(int argc, char *argv[], void *userdata) {
if (r < 0)
return bus_log_parse_error(r);
return process_forward(event, slot, master, /* flags = */ 0, machine);
return process_forward(event, slot, master, /* flags= */ 0, machine);
}
static int normalize_nspawn_filename(const char *name, char **ret_file) {
@@ -1607,7 +1607,7 @@ static int cat_settings(int argc, char *argv[], void *userdata) {
"Invalid settings file path '%s'.",
*name);
q = cat_files(*name, /* dropins = */ NULL, /* flags = */ CAT_FORMAT_HAS_SECTIONS);
q = cat_files(*name, /* dropins= */ NULL, /* flags= */ CAT_FORMAT_HAS_SECTIONS);
if (q < 0)
return r < 0 ? r : q;
continue;
@@ -1628,7 +1628,7 @@ static int cat_settings(int argc, char *argv[], void *userdata) {
return r < 0 ? r : q;
}
q = cat_files(path, /* dropins = */ NULL, /* flags = */ CAT_FORMAT_HAS_SECTIONS);
q = cat_files(path, /* dropins= */ NULL, /* flags= */ CAT_FORMAT_HAS_SECTIONS);
if (q < 0)
return r < 0 ? r : q;
}
@@ -1904,7 +1904,7 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
if (!new_args)
return log_oom();
r = strv_extend_strv(&new_args, argv + 1, /* filter_duplicates = */ false);
r = strv_extend_strv(&new_args, argv + 1, /* filter_duplicates= */ false);
if (r < 0)
return log_oom();
+24 -24
View File
@@ -217,7 +217,7 @@ int machine_get_addresses(Machine *machine, struct local_address **ret_addresses
_cleanup_free_ struct local_address *addresses = NULL;
int n;
n = local_addresses(/* context = */ NULL, /* ifindex = */ 0, AF_UNSPEC, &addresses);
n = local_addresses(/* context= */ NULL, /* ifindex= */ 0, AF_UNSPEC, &addresses);
if (n < 0)
return log_debug_errno(n, "Failed to get local addresses: %m");
@@ -231,18 +231,18 @@ int machine_get_addresses(Machine *machine, struct local_address **ret_addresses
pid_t child;
int r;
r = pidref_in_same_namespace(/* pid1 = */ NULL, &machine->leader, NAMESPACE_NET);
r = pidref_in_same_namespace(/* pid1= */ NULL, &machine->leader, NAMESPACE_NET);
if (r < 0)
return log_debug_errno(r, "Failed to check if container has private network: %m");
if (r > 0)
return -ENONET;
r = pidref_namespace_open(&machine->leader,
/* ret_pidns_fd = */ NULL,
/* ret_mntns_fd = */ NULL,
/* ret_pidns_fd= */ NULL,
/* ret_mntns_fd= */ NULL,
&netns_fd,
/* ret_userns_fd = */ NULL,
/* ret_root_fd = */ NULL);
/* ret_userns_fd= */ NULL,
/* ret_root_fd= */ NULL);
if (r < 0)
return log_debug_errno(r, "Failed to open namespace: %m");
@@ -251,14 +251,14 @@ int machine_get_addresses(Machine *machine, struct local_address **ret_addresses
r = namespace_fork("(sd-addrns)",
"(sd-addr)",
/* except_fds = */ NULL,
/* n_except_fds = */ 0,
/* except_fds= */ NULL,
/* n_except_fds= */ 0,
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL,
/* pidns_fd = */ -EBADF,
/* mntns_fd = */ -EBADF,
/* pidns_fd= */ -EBADF,
/* mntns_fd= */ -EBADF,
netns_fd,
/* userns_fd = */ -EBADF,
/* root_fd = */ -EBADF,
/* userns_fd= */ -EBADF,
/* root_fd= */ -EBADF,
&child);
if (r < 0)
return log_debug_errno(r, "Failed to fork(): %m");
@@ -267,7 +267,7 @@ int machine_get_addresses(Machine *machine, struct local_address **ret_addresses
pair[0] = safe_close(pair[0]);
int n = local_addresses(/* context = */ NULL, /* ifindex = */ 0, AF_UNSPEC, &addresses);
int n = local_addresses(/* context= */ NULL, /* ifindex= */ 0, AF_UNSPEC, &addresses);
if (n < 0) {
log_debug_errno(n, "Failed to get local addresses: %m");
_exit(EXIT_FAILURE);
@@ -313,7 +313,7 @@ int machine_get_addresses(Machine *machine, struct local_address **ret_addresses
return log_debug_errno(r, "Failed to add local address: %m");
}
r = wait_for_terminate_and_check("(sd-addrns)", child, /* flags = */ 0);
r = wait_for_terminate_and_check("(sd-addrns)", child, /* flags= */ 0);
if (r < 0)
return log_debug_errno(r, "Failed to wait for child: %m");
if (r != EXIT_SUCCESS)
@@ -340,7 +340,7 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
switch (machine->class) {
case MACHINE_HOST:
r = load_os_release_pairs(/* root = */ NULL, &l);
r = load_os_release_pairs(/* root= */ NULL, &l);
if (r < 0)
return log_debug_errno(r, "Failed to load OS release information: %m");
@@ -355,8 +355,8 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
r = pidref_namespace_open(&machine->leader,
&pidns_fd,
&mntns_fd,
/* ret_netns_fd = */ NULL,
/* ret_userns_fd = */ NULL,
/* ret_netns_fd= */ NULL,
/* ret_userns_fd= */ NULL,
&root_fd);
if (r < 0)
return log_debug_errno(r, "Failed to open namespace: %m");
@@ -366,13 +366,13 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
r = namespace_fork("(sd-osrelns)",
"(sd-osrel)",
/* except_fds = */ NULL,
/* n_except_fds = */ 0,
/* except_fds= */ NULL,
/* n_except_fds= */ 0,
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL,
pidns_fd,
mntns_fd,
/* netns_fd = */ -EBADF,
/* userns_fd = */ -EBADF,
/* netns_fd= */ -EBADF,
/* userns_fd= */ -EBADF,
root_fd,
&child);
if (r < 0)
@@ -382,7 +382,7 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
pair[0] = safe_close(pair[0]);
r = open_os_release(/* root = */ NULL, /* ret_path = */ NULL, &fd);
r = open_os_release(/* root= */ NULL, /* ret_path= */ NULL, &fd);
if (r == -ENOENT)
_exit(EXIT_NOT_FOUND);
if (r < 0) {
@@ -390,7 +390,7 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
_exit(EXIT_FAILURE);
}
r = copy_bytes(fd, pair[1], UINT64_MAX, /* copy_flags = */ 0);
r = copy_bytes(fd, pair[1], UINT64_MAX, /* copy_flags= */ 0);
if (r < 0) {
log_debug_errno(r, "Failed to write to fd: %m");
_exit(EXIT_FAILURE);
@@ -409,7 +409,7 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
if (r < 0)
return log_debug_errno(r, "Failed to load OS release information: %m");
r = wait_for_terminate_and_check("(sd-osrelns)", child, /* flags = */ 0);
r = wait_for_terminate_and_check("(sd-osrelns)", child, /* flags= */ 0);
if (r < 0)
return log_debug_errno(r, "Failed to wait for child: %m");
if (r == EXIT_NOT_FOUND)
+10 -10
View File
@@ -546,7 +546,7 @@ static int vl_method_list(sd_varlink *link, sd_json_variant *parameters, sd_varl
if (r < 0)
return r;
return list_machine_one_and_maybe_read_metadata(link, machine, /* more = */ false, p.acquire_metadata);
return list_machine_one_and_maybe_read_metadata(link, machine, /* more= */ false, p.acquire_metadata);
}
if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
@@ -555,7 +555,7 @@ static int vl_method_list(sd_varlink *link, sd_json_variant *parameters, sd_varl
Machine *previous = NULL, *i;
HASHMAP_FOREACH(i, m->machines) {
if (previous) {
r = list_machine_one_and_maybe_read_metadata(link, previous, /* more = */ true, p.acquire_metadata);
r = list_machine_one_and_maybe_read_metadata(link, previous, /* more= */ true, p.acquire_metadata);
if (r < 0)
return r;
}
@@ -564,7 +564,7 @@ static int vl_method_list(sd_varlink *link, sd_json_variant *parameters, sd_varl
}
if (previous)
return list_machine_one_and_maybe_read_metadata(link, previous, /* more = */ false, p.acquire_metadata);
return list_machine_one_and_maybe_read_metadata(link, previous, /* more= */ false, p.acquire_metadata);
return sd_varlink_error(link, VARLINK_ERROR_MACHINE_NO_SUCH_MACHINE, NULL);
}
@@ -608,11 +608,11 @@ static int vl_method_terminate(sd_varlink *link, sd_json_variant *parameters, sd
}
static int vl_method_copy_from(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
return vl_method_copy_internal(link, parameters, flags, userdata, /* copy_from = */ true);
return vl_method_copy_internal(link, parameters, flags, userdata, /* copy_from= */ true);
}
static int vl_method_copy_to(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
return vl_method_copy_internal(link, parameters, flags, userdata, /* copy_from = */ false);
return vl_method_copy_internal(link, parameters, flags, userdata, /* copy_from= */ false);
}
static int vl_method_open_root_directory(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
@@ -697,27 +697,27 @@ static int vl_method_list_images(sd_varlink *link, sd_json_variant *parameters,
if (!image_name_is_valid(p.image_name))
return sd_varlink_error_invalid_parameter_name(link, "name");
r = image_find(m->runtime_scope, IMAGE_MACHINE, p.image_name, /* root = */ NULL, &found);
r = image_find(m->runtime_scope, IMAGE_MACHINE, p.image_name, /* root= */ NULL, &found);
if (r == -ENOENT)
return sd_varlink_error(link, VARLINK_ERROR_MACHINE_IMAGE_NO_SUCH_IMAGE, NULL);
if (r < 0)
return log_debug_errno(r, "Failed to find image: %m");
return list_image_one_and_maybe_read_metadata(m, link, found, /* more = */ false, p.acquire_metadata);
return list_image_one_and_maybe_read_metadata(m, link, found, /* more= */ false, p.acquire_metadata);
}
if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
return sd_varlink_error(link, SD_VARLINK_ERROR_EXPECTED_MORE, NULL);
_cleanup_hashmap_free_ Hashmap *images = NULL;
r = image_discover(m->runtime_scope, IMAGE_MACHINE, /* root = */ NULL, &images);
r = image_discover(m->runtime_scope, IMAGE_MACHINE, /* root= */ NULL, &images);
if (r < 0)
return log_debug_errno(r, "Failed to discover images: %m");
Image *image, *previous = NULL;
HASHMAP_FOREACH(image, images) {
if (previous) {
r = list_image_one_and_maybe_read_metadata(m, link, previous, /* more = */ true, p.acquire_metadata);
r = list_image_one_and_maybe_read_metadata(m, link, previous, /* more= */ true, p.acquire_metadata);
if (r < 0)
return r;
}
@@ -726,7 +726,7 @@ static int vl_method_list_images(sd_varlink *link, sd_json_variant *parameters,
}
if (previous)
return list_image_one_and_maybe_read_metadata(m, link, previous, /* more = */ false, p.acquire_metadata);
return list_image_one_and_maybe_read_metadata(m, link, previous, /* more= */ false, p.acquire_metadata);
return sd_varlink_error(link, VARLINK_ERROR_MACHINE_IMAGE_NO_SUCH_IMAGE, NULL);
}
+1 -1
View File
@@ -84,7 +84,7 @@ static int operation_done(sd_event_source *s, const siginfo_t *si, void *userdat
* an error on failure or an empty success message on success. */
if (o->done)
(void) o->done(o, r, /* error = */ NULL);
(void) o->done(o, r, /* error= */ NULL);
else if (r < 0)
(void) sd_varlink_error_errno(o->link, r);
else