mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
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.
This commit is contained in:
parent
aa0a6214e2
commit
66aa51f8f9
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user