]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: drop DissectImageFlags parameter from namespace_setup()
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Mar 2021 16:49:42 +0000 (17:49 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Mar 2021 13:57:45 +0000 (14:57 +0100)
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.

src/core/execute.c
src/core/namespace.c
src/core/namespace.h
src/test/test-namespace.c
src/test/test-ns.c

index e791c31b279b55cddf6ac7beb932575e5c1a7e14..b644b51b01ca550b42eb665b876bdb3813f68163 100644 (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
index 56385270d86065239a481aadcf682f7ef9da1ff7..f7ebf9e64043325876f8929c840f4b1e8bdaf9ad 100644 (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) &&
index 2806db8fd1bf0aace57b52a8d4628f39f77ace16..737d6eae8b1e5d25d66fdc4d9e280bb971b4d94f 100644 (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"
index bf4b87e8a678d72d4d89826fa18b9155f28c8cf5..34eb6d40b8e76499100f5192cfcf67106b2bb9fd 100644 (file)
@@ -187,7 +187,6 @@ static void test_protect_kernel_logs(void) {
                                     NULL,
                                     NULL,
                                     NULL,
-                                    0,
                                     NULL);
                 assert_se(r == 0);
 
index 761ee5da866d5dc8c9eaa064bd89c5316b5282c0..ae666a3019a9aedd4dff7336719257b62211b75a 100644 (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");