]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homework: always pass HomeSetup param first, PasswordCache second
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Oct 2021 15:16:13 +0000 (17:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Oct 2021 06:17:46 +0000 (08:17 +0200)
Some of our operations did it one way, most the other. Let's unify on
the order that is more popular.

src/home/homework-cifs.c
src/home/homework-directory.c
src/home/homework-directory.h
src/home/homework-fscrypt.c
src/home/homework-fscrypt.h
src/home/homework-luks.c
src/home/homework-luks.h
src/home/homework.c
src/home/homework.h

index 6a4431c2299bb159d154148f1cc9d59a5ab26830..c76d6a6b13edcdb281993769badf3fcbb29d153a 100644 (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;
 
index 3418034bd1ab222c520ed61a6589e349ef8e7841..af13fa026a9502a5a0b1ec5ca77e0a5ef1338512 100644 (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;
 
index 92cc755546c2754e6e4cc6ff437a663343e030fb..ecbb2f143cb807dbae50ee3f801aad27a339cfe6 100644 (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);
index 057bf0d45ed386c3bb8de709e3653837a77f34a2..f9fef73f7580af80021545739d89777b39c0a123 100644 (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 = {};
index e9262c6349a5ab0fbf04359b56190d5518f420b1..7c2d7aace416b6c3399cfe94e6fc051bf0d4b083 100644 (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);
 
index 56e232523d6697234119c0c154efddc6acc6187f..cd584b0f45ec0eb213eee0cd28f27e5087da394e 100644 (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;
 
index 25d096a175c634b140b6543290356817d9d9679e..f8af66e083edb4da51034bfd6bffec44973cc7f6 100644 (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);
 
index 8634a9323047e9e3045580fb0b732706830a9400..22a960efd5fe3aa3fc61de589f787fadf3992413 100644 (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;
 
index fe8cbb46358d2934abcc01c9a2bfcb35ce333de2..076033526c7bb8d0f3dbdf5e2aed1f6f9268357e 100644 (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);