From: Luke Yasuda <jing@jing.rocks>
To: pve-devel@lists.proxmox.com
Cc: Luke Yasuda <jing@jing.rocks>
Subject: [PATCH v2 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type
Date: Fri, 9 Oct 2026 22:02:07 +0900 [thread overview]
Message-ID: <20261009130412.927074-1-jing@jing.rocks> (raw)
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
next reply other threads:[~2026-10-09 13:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 13:02 Luke Yasuda [this message]
2026-10-09 13:05 ` [PATCH v2 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type Luke Yasuda
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=20261009130412.927074-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.