From: Lennart Poettering Date: Sat, 16 Oct 2021 12:45:42 +0000 (+0200) Subject: homed: rename home_setup_undo() → home_setup_done() X-Git-Tag: v250-rc1~490^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=66aa51f8f9c3d6b3283ea1c247030b5c9cb900ae;p=thirdparty%2Fsystemd.git homed: rename home_setup_undo() → home_setup_done() This function is a destructor, hence it should be named like one. (We usually use xyz_free() for a destructor that frees the object passed itself. xyz_unref() we typically use for destructors that are similar, but ref counted. xyz_done() usually is used for destructors which free the members of an object, but not the object itself – to allow stack allocation of objects. We don't strictly follow this, but it's good to stick to rules wherever we can.) No actual code change, just renaming. --- diff --git a/src/home/homework-cifs.c b/src/home/homework-cifs.c index 3ae478462c7..62625ab8672 100644 --- a/src/home/homework-cifs.c +++ b/src/home/homework-cifs.c @@ -102,7 +102,7 @@ int home_activate_cifs( PasswordCache *cache, UserRecord **ret_home) { - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; _cleanup_(user_record_unrefp) UserRecord *new_home = NULL; const char *hdo, *hd; int r; @@ -140,7 +140,7 @@ int home_activate_cifs( } int home_create_cifs(UserRecord *h, UserRecord **ret_home) { - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; _cleanup_(user_record_unrefp) UserRecord *new_home = NULL; _cleanup_(closedirp) DIR *d = NULL; _cleanup_close_ int copy = -1; diff --git a/src/home/homework-directory.c b/src/home/homework-directory.c index 5865f325ff3..4e978d2328d 100644 --- a/src/home/homework-directory.c +++ b/src/home/homework-directory.c @@ -30,7 +30,7 @@ int home_activate_directory( UserRecord **ret_home) { _cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *header_home = NULL; - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; const char *hdo, *hd, *ipo, *ip; int r; @@ -231,7 +231,7 @@ int home_resize_directory( if (r < 0) return r; - r = home_setup_undo(setup); + r = home_setup_done(setup); if (r < 0) return r; diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index afee37490e5..f302ee5f0bc 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -1362,7 +1362,7 @@ int home_activate_luks( UserRecord **ret_home) { _cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *luks_home_record = NULL; - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; uint64_t host_size, encrypted_size; const char *hdo, *hd; struct statfs sfs; @@ -2999,7 +2999,7 @@ int home_resize_luks( if (r < 0) return r; - r = home_setup_undo(setup); + r = home_setup_done(setup); if (r < 0) return r; diff --git a/src/home/homework.c b/src/home/homework.c index 394b5c58baf..820cafd3bd4 100644 --- a/src/home/homework.c +++ b/src/home/homework.c @@ -298,7 +298,7 @@ static void drop_caches_now(void) { log_debug("Dropped caches."); } -int home_setup_undo(HomeSetup *setup) { +int home_setup_done(HomeSetup *setup) { int r = 0, q; assert(setup); @@ -1426,7 +1426,7 @@ static int home_validate_update(UserRecord *h, HomeSetup *setup) { static int home_update(UserRecord *h, UserRecord **ret) { _cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *header_home = NULL, *embedded_home = NULL; - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; _cleanup_(password_cache_free) PasswordCache cache = {}; bool already_activated = false; int r; @@ -1469,7 +1469,7 @@ static int home_update(UserRecord *h, UserRecord **ret) { if (r < 0) return r; - r = home_setup_undo(&setup); + r = home_setup_done(&setup); if (r < 0) return r; @@ -1480,7 +1480,7 @@ static int home_update(UserRecord *h, UserRecord **ret) { } static int home_resize(UserRecord *h, UserRecord **ret) { - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; _cleanup_(password_cache_free) PasswordCache cache = {}; bool already_activated = false; int r; @@ -1520,7 +1520,7 @@ static int home_resize(UserRecord *h, UserRecord **ret) { static int home_passwd(UserRecord *h, UserRecord **ret_home) { _cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *embedded_home = NULL, *new_home = NULL; _cleanup_(strv_free_erasep) char **effective_passwords = NULL; - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; _cleanup_(password_cache_free) PasswordCache cache = {}; bool already_activated = false; int r; @@ -1583,7 +1583,7 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) { if (r < 0) return r; - r = home_setup_undo(&setup); + r = home_setup_done(&setup); if (r < 0) return r; @@ -1595,7 +1595,7 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) { static int home_inspect(UserRecord *h, UserRecord **ret_home) { _cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *new_home = NULL; - _cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT; + _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; _cleanup_(password_cache_free) PasswordCache cache = {}; bool already_activated = false; int r; @@ -1625,7 +1625,7 @@ static int home_inspect(UserRecord *h, UserRecord **ret_home) { if (r < 0) return r; - r = home_setup_undo(&setup); + r = home_setup_done(&setup); if (r < 0) return r; diff --git a/src/home/homework.h b/src/home/homework.h index b16f4a9086c..1bb985a44d2 100644 --- a/src/home/homework.h +++ b/src/home/homework.h @@ -54,7 +54,7 @@ void password_cache_free(PasswordCache *cache); .partition_size = UINT64_MAX, \ } -int home_setup_undo(HomeSetup *setup); +int home_setup_done(HomeSetup *setup); int home_setup(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_header_home);