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

* [PATCH 2/3 proxmox-rrd-migration-tool] d/control: add missing build-deps rust-crossbeam-channel
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: Luke Yasuda @ 2026-10-08  6:48 UTC (permalink / raw)
  To: pve-devel; +Cc: Luke Yasuda

Signed-off-by: Luke Yasuda <jing@jing.rocks>
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index 5634344..eb1e5ff 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Build-Depends: cargo:native,
                dh-cargo (>= 25),
                librust-anyhow-1+default-dev,
                librust-bindgen-0.71-dev,
+               librust-crossbeam-channel-0.5-dev,
                librust-libc-0.2+default-dev (>= 0.2.107-~~),
                librust-pico-args-0.5+default-dev,
                librust-pkg-config-dev,
-- 
2.56.0





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

* [PATCH 3/3 proxmox-rrd-migration-tool] d/control: add missing build-deps librrd-dev
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: Luke Yasuda @ 2026-10-08  6:48 UTC (permalink / raw)
  To: pve-devel; +Cc: Luke Yasuda

Otherwise it can't find rrd.h

Signed-off-by: Luke Yasuda <jing@jing.rocks>
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index eb1e5ff..d44fb09 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Build-Depends: cargo:native,
                librust-pkg-config-dev,
                librust-pretty-assertions-dev,
                librust-proxmox-async-0.5-dev,
+               librrd-dev,
                libstd-rust-dev,
                rrdtool,
                rustc:native,
-- 
2.56.0





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

* Re: [PATCH 1/3 proxmox-rrd-migration-tool] use libc::c_char instead of i8 to fix mismatched type
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2026-10-08  7:39 UTC (permalink / raw)
  To: Luke Yasuda; +Cc: pve-devel

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




^ permalink raw reply	[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