public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Luke Yasuda <jing@jing.rocks>
To: pve-devel@lists.proxmox.com
Cc: Luke Yasuda <jing@jing.rocks>
Subject: [PATCH proxmox-datacenter-manager] cli/proxmox-fido2: fix mismatched type on other arches
Date: Wed, 21 Oct 2026 21:51:13 +0900	[thread overview]
Message-ID: <20261021125228.210884-1-jing@jing.rocks> (raw)

This fixes FTBFS on non-amd64 platforms: mismatched types, expected u8
but got i8.
---
This is more like an RFC, and I have little experience in rust
and don't know what I'm doing, but it builds and passes the tests.
---
 cli/proxmox-fido2/src/lib.rs | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/cli/proxmox-fido2/src/lib.rs b/cli/proxmox-fido2/src/lib.rs
index afed3496..5413b9c0 100644
--- a/cli/proxmox-fido2/src/lib.rs
+++ b/cli/proxmox-fido2/src/lib.rs
@@ -1,5 +1,5 @@
 use std::error::Error as StdError;
-use std::ffi::{CStr, CString, OsStr, c_int, c_void};
+use std::ffi::{CStr, CString, OsStr, c_int, c_void, c_char};
 use std::fmt;
 use std::path::{Path, PathBuf};
 use std::sync::{Arc, Mutex};
@@ -92,7 +92,7 @@ impl Dl {
 pub struct Lib {
     _lib: Dl,
     fido_init: extern "C" fn(c_int),
-    fido_strerr: extern "C" fn(c_int) -> *const i8,
+    fido_strerr: extern "C" fn(c_int) -> *const c_char,
 
     fido_dev_new: extern "C" fn() -> *mut c_void,
     fido_dev_free: extern "C" fn(&mut *mut c_void),
@@ -101,22 +101,22 @@ pub struct Lib {
     fido_dev_cancel: extern "C" fn(*mut c_void),
     fido_dev_is_fido2: extern "C" fn(*mut c_void) -> c_int,
     fido_dev_get_cbor_info: extern "C" fn(*mut c_void, *mut c_void) -> c_int,
-    fido_dev_make_cred: extern "C" fn(*mut c_void, *mut c_void, *const i8) -> c_int,
-    fido_dev_get_assert: extern "C" fn(*mut c_void, *mut c_void, *const i8) -> c_int,
+    fido_dev_make_cred: extern "C" fn(*mut c_void, *mut c_void, *const c_char) -> c_int,
+    fido_dev_get_assert: extern "C" fn(*mut c_void, *mut c_void, *const c_char) -> c_int,
 
     fido_dev_info_new: extern "C" fn(libc::size_t) -> *mut c_void,
     fido_dev_info_free: extern "C" fn(&mut *mut c_void, libc::size_t),
     fido_dev_info_manifest: extern "C" fn(*mut c_void, libc::size_t, *mut libc::size_t) -> c_int,
     fido_dev_info_ptr: extern "C" fn(*mut c_void, libc::size_t) -> *mut c_void,
-    fido_dev_info_manufacturer_string: extern "C" fn(*mut c_void) -> *const i8,
-    fido_dev_info_path: extern "C" fn(*mut c_void) -> *const i8,
-    fido_dev_info_product_string: extern "C" fn(*mut c_void) -> *const i8,
+    fido_dev_info_manufacturer_string: extern "C" fn(*mut c_void) -> *const c_char,
+    fido_dev_info_path: extern "C" fn(*mut c_void) -> *const c_char,
+    fido_dev_info_product_string: extern "C" fn(*mut c_void) -> *const c_char,
     fido_dev_get_touch_begin: extern "C" fn(*mut c_void) -> c_int,
     fido_dev_get_touch_status: extern "C" fn(*mut c_void, *mut c_int, c_int) -> c_int,
 
     fido_cbor_info_new: extern "C" fn() -> *mut c_void,
     fido_cbor_info_free: extern "C" fn(&mut *mut c_void),
-    fido_cbor_info_extensions_ptr: extern "C" fn(*mut c_void) -> *const *const i8,
+    fido_cbor_info_extensions_ptr: extern "C" fn(*mut c_void) -> *const *const c_char,
     fido_cbor_info_extensions_len: extern "C" fn(*mut c_void) -> libc::size_t,
     fido_cbor_info_options_name_ptr: extern "C" fn(*mut c_void) -> *const *const i8,
     fido_cbor_info_options_value_ptr: extern "C" fn(*mut c_void) -> *const i8,
@@ -126,16 +126,16 @@ pub struct Lib {
     fido_cred_free: extern "C" fn(&mut *mut c_void),
     fido_cred_exclude: extern "C" fn(*mut c_void, *const u8, libc::size_t) -> c_int,
     fido_cred_set_extensions: extern "C" fn(*mut c_void, c_int) -> c_int,
-    fido_cred_set_rp: extern "C" fn(*mut c_void, *const i8, *const i8) -> c_int,
-    fido_cred_set_fmt: extern "C" fn(*mut c_void, *const i8) -> c_int,
+    fido_cred_set_rp: extern "C" fn(*mut c_void, *const c_char, *const c_char) -> c_int,
+    fido_cred_set_fmt: extern "C" fn(*mut c_void, *const c_char) -> c_int,
     fido_cred_set_type: extern "C" fn(*mut c_void, c_int) -> c_int,
     fido_cred_set_user: extern "C" fn(
         *mut c_void,
         *const u8,
         libc::size_t,
-        *const i8,
-        *const i8,
-        *const i8,
+        *const c_char,
+        *const c_char,
+        *const c_char,
     ) -> c_int,
     fido_cred_set_clientdata_hash: extern "C" fn(*mut c_void, *const u8, libc::size_t) -> c_int,
     fido_cred_set_rk: extern "C" fn(*mut c_void, FidoOpt) -> c_int,
@@ -154,7 +154,7 @@ pub struct Lib {
     fido_assert_free: extern "C" fn(&mut *mut c_void),
     fido_assert_set_extensions: extern "C" fn(*mut c_void, c_int) -> c_int,
     fido_assert_set_hmac_salt: extern "C" fn(*mut c_void, *const u8, libc::size_t) -> c_int,
-    fido_assert_set_rp: extern "C" fn(*mut c_void, *const i8) -> c_int,
+    fido_assert_set_rp: extern "C" fn(*mut c_void, *const c_char) -> c_int,
     fido_assert_set_clientdata_hash: extern "C" fn(*mut c_void, *const u8, libc::size_t) -> c_int,
     fido_assert_allow_cred: extern "C" fn(*mut c_void, *const u8, libc::size_t) -> c_int,
     fido_assert_set_up: extern "C" fn(*mut c_void, FidoOpt) -> c_int,
@@ -692,7 +692,7 @@ impl FidoDev {
         let extensions = (self.lib.fido_cbor_info_extensions_ptr)(info.info);
         if !extensions.is_null() {
             let len = (self.lib.fido_cbor_info_extensions_len)(info.info);
-            let extensions = unsafe { std::slice::from_raw_parts(extensions as *const &i8, len) };
+            let extensions = unsafe { std::slice::from_raw_parts(extensions as *const &c_char, len) };
             for ext in extensions {
                 let name = unsafe { CStr::from_ptr(*ext) };
                 if name.to_bytes() == b"hmac-secret" {
@@ -712,7 +712,7 @@ impl FidoDev {
             let len = (self.lib.fido_cbor_info_options_len)(info.info);
 
             let option_names =
-                unsafe { std::slice::from_raw_parts(option_names as *const &i8, len) };
+                unsafe { std::slice::from_raw_parts(option_names as *const &c_char, len) };
             let option_values = unsafe { std::slice::from_raw_parts(option_values, len) };
 
             for (name, value) in std::iter::zip(option_names, option_values) {
-- 
2.55.0





             reply	other threads:[~2026-10-21 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 12:51 Luke Yasuda [this message]
2026-10-21 14:15 ` [PATCH proxmox-datacenter-manager] cli/proxmox-fido2: fix mismatched type on other arches Michael Köppl

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=20261021125228.210884-1-jing@jing.rocks \
    --to=jing@jing.rocks \
    --cc=pve-devel@lists.proxmox.com \
    /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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal