In order to avoid warning like:
warning: use of deprecated item 'libc::uint64_t': Use u64 instead.
--> src/lib.rs:42:19
|
42 | _struct_size: uint64_t,
| ^^^^^^^^
|
= note: #[warn(deprecated)] on by default
and
warning: use of deprecated item 'libc::fixed_width_ints::int64_t': Use i64
instead.
--> examples/ramdisk.rs:68:49
|
68 | extern fn ramdisk_get_size (_h: *mut c_void) -> int64_t {
| ^^^^^^^
|
= note: #[warn(deprecated)] on by default
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
plugins/rust/examples/ramdisk.rs | 12 ++++++------
plugins/rust/src/lib.rs | 32 ++++++++++++++++----------------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/plugins/rust/examples/ramdisk.rs b/plugins/rust/examples/ramdisk.rs
index 1994421b69a5..caf6fc8d8455 100644
--- a/plugins/rust/examples/ramdisk.rs
+++ b/plugins/rust/examples/ramdisk.rs
@@ -65,12 +65,12 @@ extern fn ramdisk_close (h: *mut c_void) {
drop (h);
}
-extern fn ramdisk_get_size (_h: *mut c_void) -> int64_t {
- return DISK.lock().unwrap().capacity() as int64_t;
+extern fn ramdisk_get_size (_h: *mut c_void) -> i64 {
+ return DISK.lock().unwrap().capacity() as i64;
}
-extern fn ramdisk_pread (_h: *mut c_void, buf: *mut c_char, count: uint32_t,
- offset: uint64_t, _flags: uint32_t) -> c_int {
+extern fn ramdisk_pread (_h: *mut c_void, buf: *mut c_char, count: u32,
+ offset: u64, _flags: u32) -> c_int {
let offset = offset as usize;
let count = count as usize;
let disk = DISK.lock().unwrap();
@@ -80,8 +80,8 @@ extern fn ramdisk_pread (_h: *mut c_void, buf: *mut c_char, count:
uint32_t,
return 0;
}
-extern fn ramdisk_pwrite (_h: *mut c_void, buf: *const c_char, count: uint32_t,
- offset: uint64_t, _flags: uint32_t) -> c_int {
+extern fn ramdisk_pwrite (_h: *mut c_void, buf: *const c_char, count: u32,
+ offset: u64, _flags: u32) -> c_int {
let offset = offset as usize;
let count = count as usize;
let mut disk = DISK.lock().unwrap();
diff --git a/plugins/rust/src/lib.rs b/plugins/rust/src/lib.rs
index 2a7121ba6748..ea68e8a701d2 100644
--- a/plugins/rust/src/lib.rs
+++ b/plugins/rust/src/lib.rs
@@ -39,7 +39,7 @@ use std::mem;
// function must return.
#[repr(C)]
pub struct Plugin {
- _struct_size: uint64_t,
+ _struct_size: u64,
_api_version: c_int,
_thread_model: c_int,
@@ -58,7 +58,7 @@ pub struct Plugin {
pub open: extern fn (c_int) -> *mut c_void,
pub close: Option<extern fn (*mut c_void)>,
- pub get_size: extern fn (*mut c_void) -> int64_t,
+ pub get_size: extern fn (*mut c_void) -> i64,
pub can_write: Option<extern fn (*mut c_void) -> c_int>,
pub can_flush: Option<extern fn (*mut c_void) -> c_int>,
@@ -79,19 +79,19 @@ pub struct Plugin {
pub can_zero: Option<extern fn (*mut c_void) -> c_int>,
pub can_fua: Option<extern fn (*mut c_void) -> c_int>,
- pub pread: extern fn (h: *mut c_void, buf: *mut c_char, count: uint32_t,
- offset: uint64_t,
- flags: uint32_t) -> c_int,
+ pub pread: extern fn (h: *mut c_void, buf: *mut c_char, count: u32,
+ offset: u64,
+ flags: u32) -> c_int,
pub pwrite: Option<extern fn (h: *mut c_void, buf: *const c_char,
- count: uint32_t, offset: uint64_t,
- flags: uint32_t) -> c_int>,
- pub flush: Option<extern fn (h: *mut c_void, flags: uint32_t) -> c_int>,
+ count: u32, offset: u64,
+ flags: u32) -> c_int>,
+ pub flush: Option<extern fn (h: *mut c_void, flags: u32) -> c_int>,
pub trim: Option<extern fn (h: *mut c_void,
- count: uint32_t, offset: uint64_t,
- flags: uint32_t) -> c_int>,
+ count: u32, offset: u64,
+ flags: u32) -> c_int>,
pub zero: Option<extern fn (h: *mut c_void,
- count: uint32_t, offset: uint64_t,
- flags: uint32_t) -> c_int>,
+ count: u32, offset: u64,
+ flags: u32) -> c_int>,
pub magic_config_key: *const c_char,
@@ -109,12 +109,12 @@ impl Plugin {
pub fn new (thread_model: ThreadModel,
name: *const c_char,
open: extern fn (c_int) -> *mut c_void,
- get_size: extern fn (*mut c_void) -> int64_t,
+ get_size: extern fn (*mut c_void) -> i64,
pread: extern fn (h: *mut c_void, buf: *mut c_char,
- count: uint32_t, offset: uint64_t,
- flags: uint32_t) -> c_int) -> Plugin {
+ count: u32, offset: u64,
+ flags: u32) -> c_int) -> Plugin {
Plugin {
- _struct_size: mem::size_of::<Plugin>() as uint64_t,
+ _struct_size: mem::size_of::<Plugin>() as u64,
_api_version: 2,
_thread_model: thread_model as c_int,
name: name,
--
2.21.0