public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: linux-bcachefs@vger.kernel.org
Cc: David Disseldorp <ddiss@suse.de>
Subject: [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn
Date: Thu, 20 Jun 2024 14:58:05 +1000	[thread overview]
Message-ID: <20240620045804.27888-2-ddiss@suse.de> (raw)
In-Reply-To: <20240620045804.27888-1-ddiss@suse.de>

The keyctl_search() C function returns a long, which is already
reflected in the KeyHandle._id type. The search_keyring() helper
function currently returns a Result<i64>, which breaks 32-bit builds for
e.g. armv7l:
  error[E0308]: mismatched types
     --> src/key.rs:121:16
      |
  121 |             Ok(key_id)
      |             -- ^^^^^^ expected `i64`, found `i32`
      |             |
      |             arguments to this enum variant are incorrect
...
  error[E0308]: mismatched types
     --> src/key.rs:135:24
      |
  135 |                 _id:   id,
      |                        ^^ expected `i32`, found `i64`

Fix this by changing search_keyring() to return a Result<c_long>.

Fixes: f72ded6a ("fix(key): search for key in all relevant keyrings")
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 src/key.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/key.rs b/src/key.rs
index 96eb491d..0e061ee5 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -110,7 +110,7 @@ impl KeyHandle {
         }
     }
 
-    fn search_keyring(keyring: i32, key_name: &CStr) -> Result<i64> {
+    fn search_keyring(keyring: i32, key_name: &CStr) -> Result<c_long> {
         let key_name = CStr::as_ptr(key_name);
         let key_type = c_str!("user");
 
-- 
2.35.3


  reply	other threads:[~2024-06-20  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20  4:58 [tools PATCH 0/1] 32-bit build issues David Disseldorp
2024-06-20  4:58 ` David Disseldorp [this message]
2024-06-20 12:52   ` [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240620045804.27888-2-ddiss@suse.de \
    --to=ddiss@suse.de \
    --cc=linux-bcachefs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox