public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH 1/3 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type
@ 2026-10-08  6:48 Luke Yasuda
  2026-10-08  6:48 ` [PATCH 2/3 proxmox-rrd-migration-tool] d/control: add missing build-deps rust-crossbeam-channel Luke Yasuda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luke Yasuda @ 2026-10-08  6:48 UTC (permalink / raw)
  To: pve-devel; +Cc: Luke Yasuda

Otherwise this fails on non-amd64 arches:

error[E0308]: mismatched types
   --> src/main.rs:374:17
    |
374 |     source[0] = file.0.as_ptr();
    |     ---------   ^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
    |     |
    |     expected due to the type of this binding
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
   --> src/main.rs:386:13
    |
381 |         let res = rrd_create_r2(
    |                   ------------- arguments to this function are incorrect
...
386 |             source.as_mut_ptr(),
    |             ^^^^^^^^^^^^^^^^^^^ expected `*mut *const u8`, found `*mut *const i8`
    |
    = note: expected raw pointer `*mut *const u8`
               found raw pointer `*mut *const i8`

Signed-off-by: Luke Yasuda <jing@jing.rocks>
---
 Cargo.toml  | 1 +
 src/main.rs | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 4574e32..a637278 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,7 @@ anyhow = "1"
 pico-args = "0.5"
 proxmox-async = "0.5"
 crossbeam-channel = "0.5"
+libc = "0.2"
 
 [build-dependencies]
 bindgen = "0.71"
diff --git a/src/main.rs b/src/main.rs
index 799cde8..b2b9bbe 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,6 +8,7 @@ use std::{
 };
 
 use anyhow::{bail, Context, Error, Result};
+use libc::c_char;
 
 use proxmox_rrd_migration_tool::{rrd_clear_error, rrd_create_r2, rrd_get_context, rrd_get_error};
 
@@ -370,7 +371,7 @@ fn do_rrd_migration(
         bail!("refusing to migrate metrics for {resource:?} - target already exists and 'force' not set!");
     }
 
-    let mut source: [*const i8; 2] = [std::ptr::null(); 2];
+    let mut source: [*const libc::c_char; 2] = [std::ptr::null(); 2];
     source[0] = file.0.as_ptr();
 
     let target_path = CString::new(target_path.to_str().unwrap()).unwrap();
-- 
2.56.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-08  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08  6:48 [PATCH 1/3 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type Luke Yasuda
2026-10-08  6:48 ` [PATCH 2/3 proxmox-rrd-migration-tool] d/control: add missing build-deps rust-crossbeam-channel Luke Yasuda
2026-10-08  6:48 ` [PATCH 3/3 proxmox-rrd-migration-tool] d/control: add missing build-deps librrd-dev Luke Yasuda
2026-10-08  7:39 ` [PATCH 1/3 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type Maximiliano Sandoval

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