execute: drop DissectImageFlags parameter from namespace_setup()

The function already has a ridiculous amount of paramaters, let's drop
one that is either not used at all or has a constant value and let's
pick it internally.
This commit is contained in:
Lennart Poettering
2021-03-16 14:57:45 +01:00
parent 4b5de5dd6c
commit 9cb1709b72
5 changed files with 7 additions and 7 deletions
-1
View File
@@ -3247,7 +3247,6 @@ static int apply_mount_namespace(
propagate_dir,
incoming_dir,
root_dir || root_image ? params->notify_socket : NULL,
DISSECT_IMAGE_DISCARD_ON_LOOP|DISSECT_IMAGE_RELAX_VAR_CHECK|DISSECT_IMAGE_FSCK|DISSECT_IMAGE_USR_NO_ROOT,
error_path);
/* If we couldn't set up the namespace this is probably due to a missing capability. setup_namespace() reports
+7 -3
View File
@@ -1802,7 +1802,6 @@ int setup_namespace(
const char *propagate_dir,
const char *incoming_dir,
const char *notify_socket,
DissectImageFlags dissect_image_flags,
char **error_path) {
_cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL;
@@ -1813,6 +1812,13 @@ int setup_namespace(
MountEntry *m = NULL, *mounts = NULL;
bool require_prefix = false, setup_propagate = false;
const char *root, *extension_dir = "/run/systemd/unit-extensions";
DissectImageFlags dissect_image_flags =
DISSECT_IMAGE_GENERIC_ROOT |
DISSECT_IMAGE_REQUIRE_ROOT |
DISSECT_IMAGE_DISCARD_ON_LOOP |
DISSECT_IMAGE_RELAX_VAR_CHECK |
DISSECT_IMAGE_FSCK |
DISSECT_IMAGE_USR_NO_ROOT;
size_t n_mounts;
int r;
@@ -1825,8 +1831,6 @@ int setup_namespace(
mount_flags = MS_SHARED;
if (root_image) {
dissect_image_flags |= DISSECT_IMAGE_GENERIC_ROOT | DISSECT_IMAGE_REQUIRE_ROOT;
/* Make the whole image read-only if we can determine that we only access it in a read-only fashion. */
if (root_read_only(read_only_paths,
ns_info->protect_system) &&
-1
View File
@@ -143,7 +143,6 @@ int setup_namespace(
const char *propagate_dir,
const char *incoming_dir,
const char *notify_socket,
DissectImageFlags dissected_image_flags,
char **error_path);
#define RUN_SYSTEMD_EMPTY "/run/systemd/empty"
-1
View File
@@ -187,7 +187,6 @@ static void test_protect_kernel_logs(void) {
NULL,
NULL,
NULL,
0,
NULL);
assert_se(r == 0);
-1
View File
@@ -107,7 +107,6 @@ int main(int argc, char *argv[]) {
NULL,
NULL,
NULL,
0,
NULL);
if (r < 0) {
log_error_errno(r, "Failed to set up namespace: %m");