Skip to content

Commit

Permalink
feat: enable cargo build on aarch64
Browse files Browse the repository at this point in the history
Signed-off-by: Ana Hobden <[email protected]>
  • Loading branch information
Hoverbear committed Feb 23, 2021
1 parent 6fc8d3c commit 5b7c949
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion mayastor/src/bdev/nexus/nexus_fn_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl NexusFnTable {
unsafe {
spdk_json_write_named_array_begin(
w,
"children\0".as_ptr() as *mut i8,
"children\0".as_ptr() as *const u8,
);
};

Expand Down
2 changes: 1 addition & 1 deletion mayastor/src/bin/spdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() -> Result<(), std::io::Error> {

if spdk_app_parse_args(
(c_args.len() as c_int) - 1,
c_args.as_ptr() as *mut *mut i8,
c_args.as_ptr() as *mut *mut u8,
&mut opts,
null_mut(), // extra short options i.e. "f:S:"
null_mut(), // extra long options
Expand Down
2 changes: 1 addition & 1 deletion mayastor/src/core/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl IoChannel {
(*self.0)
.dev
.add(std::mem::size_of::<*mut spdk_io_channel>())
as *mut i8,
as *const u8,
)
.to_str()
.unwrap()
Expand Down
6 changes: 3 additions & 3 deletions mayastor/src/core/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,15 @@ impl MayastorEnvironment {
let mut cargs = args
.iter()
.map(|arg| arg.as_ptr())
.collect::<Vec<*const i8>>();
.collect::<Vec<*const u8>>();

cargs.push(std::ptr::null());
debug!("EAL arguments {:?}", args);

if unsafe {
rte_eal_init(
(cargs.len() as libc::c_int) - 1,
cargs.as_ptr() as *mut *mut i8,
cargs.as_ptr() as *mut *mut u8,
)
} < 0
{
Expand Down Expand Up @@ -576,7 +576,7 @@ impl MayastorEnvironment {
} else {
info!("RPC server listening at: {}", ctx.rpc.to_str().unwrap());
unsafe {
spdk_rpc_initialize(ctx.rpc.as_ptr() as *mut i8);
spdk_rpc_initialize(ctx.rpc.as_ptr() as *mut u8);
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
};

Expand Down
4 changes: 2 additions & 2 deletions mayastor/src/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ impl Replica {
pub fn get_pool_name(&self) -> &str {
unsafe {
let lvs = &*(*self.lvol_ptr).lvol_store;
CStr::from_ptr(&lvs.name as *const i8).to_str().unwrap()
CStr::from_ptr(&lvs.name as *const u8).to_str().unwrap()
}
}

/// Get uuid (= name) of the replica.
pub fn get_uuid(&self) -> &str {
unsafe {
CStr::from_ptr(&(*self.lvol_ptr).name as *const i8)
CStr::from_ptr(&(*self.lvol_ptr).name as *const u8)
.to_str()
.unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion mayastor/src/subsys/nvmf/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl Target {
let discovery = unsafe {
NvmfSubsystem::from(spdk_nvmf_subsystem_create(
self.tgt.as_ptr(),
SPDK_NVMF_DISCOVERY_NQN.as_ptr() as *const i8,
SPDK_NVMF_DISCOVERY_NQN.as_ptr() as *const u8,
SPDK_NVMF_SUBTYPE_DISCOVERY,
0,
))
Expand Down
22 changes: 11 additions & 11 deletions nix/pkgs/libspdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ let
"--without-isal"
"--with-iscsi-initiator"
"--with-uring"
# "--with-crypto"
"--disable-examples"
"--disable-unit-tests"
"--disable-tests"
];


enableParallelBuilding = true;

preConfigure = ''
substituteInPlace dpdk/config/defconfig_aarch64-native-linux-gcc --replace native default
'';

configurePhase = ''
patchShebangs ./.
./configure $configureFlags
Expand All @@ -77,13 +77,13 @@ let
find . -type f -name 'libspdk_ut_mock.a' -delete
$CC -shared -o libspdk.so \
-lc -laio -liscsi -lnuma -ldl -lrt -luuid -lpthread -lcrypto \
-luring \
-Wl,--whole-archive \
$(find build/lib -type f -name 'libspdk_*.a*' -o -name 'librte_*.a*') \
$(find dpdk/build/lib -type f -name 'librte_*.a*') \
$(find intel-ipsec-mb -type f -name 'libIPSec_*.a*') \
-Wl,--no-whole-archive
-lc -laio -liscsi -lnuma -ldl -lrt -luuid -lpthread -lcrypto \
-luring \
-Wl,--whole-archive \
$(find build/lib -type f -name 'libspdk_*.a*' -o -name 'librte_*.a*') \
$(find dpdk/build/lib -type f -name 'librte_*.a*') \
$(find intel-ipsec-mb -type f -name 'libIPSec_*.a*') \
-Wl,--no-whole-archive
'';

installPhase = ''
Expand Down
4 changes: 2 additions & 2 deletions spdk-sys/logwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

void
maya_log(int level, const char *file, const int line, const char *func,
const char *format, va_list args)
const char *format, va_list *args)
{
char buf[1024] = {0};
int n_written = vsnprintf(buf, sizeof(buf), format, args);
int n_written = vsnprintf(buf, sizeof(buf), format, *args);
logfn(level, file, line, func, &buf[0], n_written);
}

2 changes: 1 addition & 1 deletion spdk-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern "C" {
line: i32,
func: *const c_char,
format: *const c_char,
args: *mut __va_list_tag,
args: __va_list,
);

pub static mut logfn: LogProto;
Expand Down

0 comments on commit 5b7c949

Please sign in to comment.