From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: Luke Yasuda <jing@jing.rocks>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH 1/3 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type
Date: Thu, 08 Oct 2026 09:39:24 +0200 [thread overview]
Message-ID: <s8oqzi0myj7.fsf@toolbox> (raw)
In-Reply-To: <20261008065200.1686526-1-jing@jing.rocks> (Luke Yasuda's message of "Thu, 8 Oct 2026 15:48:43 +0900")
A small nit below.
Luke Yasuda <jing@jing.rocks> writes:
> 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];
I would recommend to use [c_char] from the standard library here.
[c_char] https://doc.rust-lang.org/std/ffi/type.c_char.html
> source[0] = file.0.as_ptr();
>
> let target_path = CString::new(target_path.to_str().unwrap()).unwrap();
--
Maximiliano
prev parent reply other threads:[~2026-10-08 7:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Maximiliano Sandoval [this message]
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=s8oqzi0myj7.fsf@toolbox \
--to=m.sandoval@proxmox.com \
--cc=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