Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proper to_ptr type cast to c_char #1796

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions io-engine/src/bdev/ftl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use std::{
collections::HashMap,
convert::TryFrom,
fmt::{Debug, Formatter},
os::raw::c_char,
};

use core::ffi::c_void;
Expand Down Expand Up @@ -210,9 +211,9 @@ impl CreateDestroy for Ftl {
..unsafe { mem::zeroed() }
};
unsafe { spdk_ftl_get_default_conf(&mut ftl_conf, spdk_ftl_conf_size) };
ftl_conf.name = ftl_dev_name.as_ptr() as *mut i8;
ftl_conf.base_bdev = base_dev_name.as_ptr() as *mut i8;
ftl_conf.cache_bdev = cache_dev_name.as_ptr() as *mut i8;
ftl_conf.name = ftl_dev_name.as_ptr() as *mut c_char;
ftl_conf.base_bdev = base_dev_name.as_ptr() as *mut c_char;
ftl_conf.cache_bdev = cache_dev_name.as_ptr() as *mut c_char;
ftl_conf.fast_shutdown = true;
ftl_conf.verbose_mode = true;
ftl_conf.mode = spdk_ftl_mode::SPDK_FTL_MODE_CREATE as u32;
Expand Down
4 changes: 2 additions & 2 deletions io-engine/tests/memory_pool.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, ffi::CString, ptr::null_mut};
use std::{collections::HashMap, ffi::CString, os::raw::c_char, ptr::null_mut};

use once_cell::sync::OnceCell;

Expand All @@ -16,7 +16,7 @@ fn get_ms() -> &'static MayastorTest<'static> {
struct TestCtx {
id: u64,
pos: u32,
ctx: *const i8,
ctx: *const c_char,
}

const POOL_SIZE: u64 = 128 * 1024 - 1;
Expand Down
8 changes: 4 additions & 4 deletions libnvme-rs/src/nvme_uri.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{convert::TryFrom, io, time::Duration};
use std::{convert::TryFrom, io, os::raw::c_char, time::Duration};

use url::{ParseError, Url};

Expand All @@ -15,14 +15,14 @@ use crate::{

/// Wrapper for caller-owned C-strings from libnvme
pub struct NvmeStringWrapper {
s: *mut i8,
s: *mut c_char,
}

impl NvmeStringWrapper {
pub fn new(s: *mut i8) -> Self {
pub fn new(s: *mut c_char) -> Self {
NvmeStringWrapper { s }
}
pub fn as_ptr(&self) -> *const i8 {
pub fn as_ptr(&self) -> *const c_char {
self.s
}
}
Expand Down
Loading