]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homework: make destroying of HomeSetup optional when resizing
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Oct 2021 07:59:35 +0000 (09:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Nov 2021 23:05:53 +0000 (00:05 +0100)
This will be useful when we want to issue a resize operation right when
activating, where the HomeSetup object should be destroyed only after
both activation is done.

src/home/homework-luks.c
src/home/homework.h

index 294c052720b8d5522e6ac28fa05f9dd370400d9c..f7015529e716b450a7c467cb09492099380b7565 100644 (file)
@@ -3240,9 +3240,11 @@ int home_resize_luks(
         if (r < 0)
                 return r;
 
-        r = home_setup_done(setup);
-        if (r < 0)
-                return r;
+        if (!FLAGS_SET(flags, HOME_SETUP_RESIZE_DONT_UNDO)) {
+                r = home_setup_done(setup);
+                if (r < 0)
+                        return r;
+        }
 
         log_info("Everything completed.");
 
index 55c2f5b2df9400f80c7c10a4a7b3c3587debe5b6..be77764d8e4fd119f8eb86e351cc7c8b9164bacf 100644 (file)
@@ -63,6 +63,7 @@ typedef enum HomeSetupFlags {
         HOME_SETUP_RESIZE_MINIMIZE             = 1 << 3, /* Shrink to minimal size */
         HOME_SETUP_RESIZE_DONT_GROW            = 1 << 4, /* If the resize would grow, gracefully terminate operation */
         HOME_SETUP_RESIZE_DONT_SHRINK          = 1 << 5, /* If the resize would shrink, gracefully terminate operation */
+        HOME_SETUP_RESIZE_DONT_UNDO            = 1 << 6, /* Leave loopback/DM device context open after successful operation */
 } HomeSetupFlags;
 
 int home_setup_done(HomeSetup *setup);