homework: always pass HomeSetup param first, PasswordCache second

Some of our operations did it one way, most the other. Let's unify on
the order that is more popular.
This commit is contained in:
Lennart Poettering
2021-10-28 08:17:46 +02:00
parent a70e0ad764
commit c00b2ddc6e
9 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ int home_activate_cifs(
assert_se(hdo = user_record_home_directory(h));
hd = strdupa_safe(hdo); /* copy the string out, since it might change later in the home record object */
r = home_setup(h, 0, cache, setup, &header_home);
r = home_setup(h, 0, setup, cache, &header_home);
if (r < 0)
return r;
+3 -3
View File
@@ -74,7 +74,7 @@ int home_activate_directory(
assert_se(hdo = user_record_home_directory(h));
hd = strdupa_safe(hdo);
r = home_setup(h, 0, cache, setup, &header_home);
r = home_setup(h, 0, setup, cache, &header_home);
if (r < 0)
return r;
@@ -259,8 +259,8 @@ int home_create_directory_or_subvolume(UserRecord *h, HomeSetup *setup, UserReco
int home_resize_directory(
UserRecord *h,
HomeSetupFlags flags,
PasswordCache *cache,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_home) {
_cleanup_(user_record_unrefp) UserRecord *embedded_home = NULL, *new_home = NULL;
@@ -271,7 +271,7 @@ int home_resize_directory(
assert(ret_home);
assert(IN_SET(user_record_storage(h), USER_DIRECTORY, USER_SUBVOLUME, USER_FSCRYPT));
r = home_setup(h, flags, cache, setup, NULL);
r = home_setup(h, flags, setup, cache, NULL);
if (r < 0)
return r;
+1 -1
View File
@@ -7,4 +7,4 @@
int home_setup_directory(UserRecord *h, HomeSetup *setup);
int home_activate_directory(UserRecord *h, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_create_directory_or_subvolume(UserRecord *h, HomeSetup *setup, UserRecord **ret_home);
int home_resize_directory(UserRecord *h, HomeSetupFlags flags, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home);
int home_resize_directory(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
+2 -2
View File
@@ -282,8 +282,8 @@ static int fscrypt_setup(
int home_setup_fscrypt(
UserRecord *h,
const PasswordCache *cache,
HomeSetup *setup) {
HomeSetup *setup,
const PasswordCache *cache) {
_cleanup_(erase_and_freep) void *volume_key = NULL;
struct fscrypt_policy policy = {};
+1 -1
View File
@@ -4,7 +4,7 @@
#include "homework.h"
#include "user-record.h"
int home_setup_fscrypt(UserRecord *h, const PasswordCache *cache, HomeSetup *setup);
int home_setup_fscrypt(UserRecord *h, HomeSetup *setup, const PasswordCache *cache);
int home_create_fscrypt(UserRecord *h, HomeSetup *setup, char **effective_passwords, UserRecord **ret_home);
+4 -4
View File
@@ -1168,8 +1168,8 @@ int home_setup_luks(
UserRecord *h,
HomeSetupFlags flags,
const char *force_image_path,
PasswordCache *cache,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_luks_home) {
sd_id128_t found_partition_uuid, found_luks_uuid, found_fs_uuid;
@@ -1446,8 +1446,8 @@ int home_activate_luks(
h,
0,
NULL,
cache,
setup,
cache,
&luks_home_record);
if (r < 0)
return r;
@@ -2735,8 +2735,8 @@ static int apply_resize_partition(int fd, sd_id128_t disk_uuids, struct fdisk_ta
int home_resize_luks(
UserRecord *h,
HomeSetupFlags flags,
PasswordCache *cache,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_home) {
uint64_t old_image_size, new_image_size, old_fs_size, new_fs_size, crypto_offset, new_partition_size;
@@ -2835,7 +2835,7 @@ int home_resize_luks(
new_image_size = new_image_size_rounded;
}
r = home_setup_luks(h, flags, whole_disk, cache, setup, &header_home);
r = home_setup_luks(h, flags, whole_disk, setup, cache, &header_home);
if (r < 0)
return r;
+2 -2
View File
@@ -5,7 +5,7 @@
#include "homework.h"
#include "user-record.h"
int home_setup_luks(UserRecord *h, HomeSetupFlags flags, const char *force_image_path, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_luks_home);
int home_setup_luks(UserRecord *h, HomeSetupFlags flags, const char *force_image_path, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_luks_home);
int home_activate_luks(UserRecord *h, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_deactivate_luks(UserRecord *h, HomeSetup *setup);
@@ -17,7 +17,7 @@ int home_create_luks(UserRecord *h, HomeSetup *setup, const PasswordCache *cache
int home_get_state_luks(UserRecord *h, HomeSetup *setup);
int home_resize_luks(UserRecord *h, HomeSetupFlags flags, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home);
int home_resize_luks(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_home);
int home_passwd_luks(UserRecord *h, HomeSetup *setup, const PasswordCache *cache, char **effective_passwords);
+8 -8
View File
@@ -407,8 +407,8 @@ int home_setup_done(HomeSetup *setup) {
int home_setup(
UserRecord *h,
HomeSetupFlags flags,
PasswordCache *cache,
HomeSetup *setup,
PasswordCache *cache,
UserRecord **ret_header_home) {
int r;
@@ -429,7 +429,7 @@ int home_setup(
switch (user_record_storage(h)) {
case USER_LUKS:
return home_setup_luks(h, flags, NULL, cache, setup, ret_header_home);
return home_setup_luks(h, flags, NULL, setup, cache, ret_header_home);
case USER_SUBVOLUME:
case USER_DIRECTORY:
@@ -437,7 +437,7 @@ int home_setup(
break;
case USER_FSCRYPT:
r = home_setup_fscrypt(h, cache, setup);
r = home_setup_fscrypt(h, setup, cache);
break;
case USER_CIFS:
@@ -1521,7 +1521,7 @@ static int home_update(UserRecord *h, UserRecord **ret) {
if (r < 0)
return r;
r = home_setup(h, flags, &cache, &setup, &header_home);
r = home_setup(h, flags, &setup, &cache, &header_home);
if (r < 0)
return r;
@@ -1579,12 +1579,12 @@ static int home_resize(UserRecord *h, UserRecord **ret) {
switch (user_record_storage(h)) {
case USER_LUKS:
return home_resize_luks(h, flags, &cache, &setup, ret);
return home_resize_luks(h, flags, &setup, &cache, ret);
case USER_DIRECTORY:
case USER_SUBVOLUME:
case USER_FSCRYPT:
return home_resize_directory(h, flags, &cache, &setup, ret);
return home_resize_directory(h, flags, &setup, &cache, ret);
default:
return log_error_errno(SYNTHETIC_ERRNO(ENOTTY), "Resizing home directories of type '%s' currently not supported.", user_storage_to_string(user_record_storage(h)));
@@ -1613,7 +1613,7 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) {
if (r < 0)
return r;
r = home_setup(h, flags, &cache, &setup, &header_home);
r = home_setup(h, flags, &setup, &cache, &header_home);
if (r < 0)
return r;
@@ -1683,7 +1683,7 @@ static int home_inspect(UserRecord *h, UserRecord **ret_home) {
if (r < 0)
return r;
r = home_setup(h, flags, &cache, &setup, &header_home);
r = home_setup(h, flags, &setup, &cache, &header_home);
if (r < 0)
return r;
+1 -1
View File
@@ -78,7 +78,7 @@ int home_setup_done(HomeSetup *setup);
int home_setup_undo_mount(HomeSetup *setup, int level);
int home_setup_undo_dm(HomeSetup *setup, int level);
int home_setup(UserRecord *h, HomeSetupFlags flags, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_header_home);
int home_setup(UserRecord *h, HomeSetupFlags flags, HomeSetup *setup, PasswordCache *cache, UserRecord **ret_header_home);
int home_refresh(UserRecord *h, HomeSetup *setup, UserRecord *header_home, PasswordCache *cache, struct statfs *ret_statfs, UserRecord **ret_new_home);