* [PATCH v2 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type
@ 2026-10-09 13:02 Luke Yasuda
2026-10-09 13:05 ` Luke Yasuda
0 siblings, 1 reply; 2+ messages in thread
From: Luke Yasuda @ 2026-10-09 13:02 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>
---
Use std::ffi:c_char instead of the one from libc crate.
I don't know what I'm doing.
---
src/main.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 799cde8..40acb08 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,5 @@
use std::{
- ffi::{CStr, CString, OsString},
+ ffi::{c_char, CStr, CString, OsString},
fs,
io::ErrorKind,
os::unix::{ffi::OsStrExt, fs::PermissionsExt},
@@ -370,7 +370,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 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.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-09 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09 13:02 [PATCH v2 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type Luke Yasuda
2026-10-09 13:05 ` Luke Yasuda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox