]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: rename usrptr to userdata
authorLennart Poettering <lennart@poettering.net>
Thu, 2 Nov 2023 16:56:16 +0000 (17:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 2 Nov 2023 21:37:17 +0000 (22:37 +0100)
Across our codebase we call the generic pointer "userdata", not
"userptr". Do so here too.

src/cryptsetup/cryptsetup.c

index a0f93178f73815fe77e9c72b38e71d235948860d..618fd91d5c003a285e75fe32f632efb8d0d546ad 100644 (file)
@@ -1175,7 +1175,7 @@ static int crypt_activate_by_token_pin_ask_password(
                 const char *type,
                 usec_t until,
                 bool headless,
-                void *usrptr,
+                void *userdata,
                 uint32_t activation_flags,
                 const char *message,
                 const char *key_name,
@@ -1186,9 +1186,9 @@ static int crypt_activate_by_token_pin_ask_password(
         _cleanup_strv_free_erase_ char **pins = NULL;
         int r;
 
-        r = crypt_activate_by_token_pin(cd, name, type, CRYPT_ANY_TOKEN, NULL, 0, usrptr, activation_flags);
+        r = crypt_activate_by_token_pin(cd, name, type, CRYPT_ANY_TOKEN, /* pin=*/ NULL, /* pin_size= */ 0, userdata, activation_flags);
         if (r > 0) /* returns unlocked keyslot id on success */
-                r = 0;
+                return 0;
         if (r != -ENOANO) /* needs pin or pin is wrong */
                 return r;
 
@@ -1197,9 +1197,9 @@ static int crypt_activate_by_token_pin_ask_password(
                 return r;
 
         STRV_FOREACH(p, pins) {
-                r = crypt_activate_by_token_pin(cd, name, type, CRYPT_ANY_TOKEN, *p, strlen(*p), usrptr, activation_flags);
+                r = crypt_activate_by_token_pin(cd, name, type, CRYPT_ANY_TOKEN, *p, strlen(*p), userdata, activation_flags);
                 if (r > 0) /* returns unlocked keyslot id on success */
-                        r = 0;
+                        return 0;
                 if (r != -ENOANO) /* needs pin or pin is wrong */
                         return r;
         }
@@ -1209,14 +1209,14 @@ static int crypt_activate_by_token_pin_ask_password(
 
         for (;;) {
                 pins = strv_free_erase(pins);
-                r = ask_password_auto(message, "drive-harddisk", NULL, key_name, credential_name, until, flags, &pins);
+                r = ask_password_auto(message, "drive-harddisk", /* id= */ NULL, key_name, credential_name, until, flags, &pins);
                 if (r < 0)
                         return r;
 
                 STRV_FOREACH(p, pins) {
-                        r = crypt_activate_by_token_pin(cd, name, type, CRYPT_ANY_TOKEN, *p, strlen(*p), usrptr, activation_flags);
+                        r = crypt_activate_by_token_pin(cd, name, type, CRYPT_ANY_TOKEN, *p, strlen(*p), userdata, activation_flags);
                         if (r > 0) /* returns unlocked keyslot id on success */
-                                r = 0;
+                                return 0;
                         if (r != -ENOANO) /* needs pin or pin is wrong */
                                 return r;
                 }
@@ -1234,7 +1234,7 @@ static int attach_luks2_by_fido2_via_plugin(
                 const char *name,
                 usec_t until,
                 bool headless,
-                void *usrptr,
+                void *userdata,
                 uint32_t activation_flags) {
 
         return crypt_activate_by_token_pin_ask_password(
@@ -1243,7 +1243,7 @@ static int attach_luks2_by_fido2_via_plugin(
                         "systemd-fido2",
                         until,
                         headless,
-                        usrptr,
+                        userdata,
                         activation_flags,
                         "Please enter security token PIN:",
                         "fido2-pin",
@@ -2264,10 +2264,10 @@ static int run(int argc, char *argv[]) {
                                 r = crypt_activate_by_token_pin_ask_password(
                                                 cd,
                                                 volume,
-                                                NULL,
+                                                /* type= */ NULL,
                                                 until,
                                                 arg_headless,
-                                                NULL,
+                                                /* userdata= */ NULL,
                                                 flags,
                                                 "Please enter LUKS2 token PIN:",
                                                 "luks2-pin",