1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 11:55:44 +03:00

homework: make destroying of HomeSetup optional when resizing

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.
This commit is contained in:
Lennart Poettering 2021-10-29 09:59:35 +02:00
parent 1285252823
commit 5813fca61f
2 changed files with 6 additions and 3 deletions

View 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.");

View 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);