Use cxx_name instead of rust_name

This commit is contained in:
topjohnwu 2023-08-10 21:22:53 -07:00
parent 350d0d600c
commit b5b14ce343
2 changed files with 12 additions and 12 deletions

View File

@ -42,11 +42,11 @@ pub mod ffi {
#[namespace = "rust"] #[namespace = "rust"]
extern "Rust" { extern "Rust" {
fn xpipe2(fds: &mut [i32; 2], flags: i32) -> i32; fn xpipe2(fds: &mut [i32; 2], flags: i32) -> i32;
#[rust_name = "fd_path_for_cxx"] #[cxx_name = "fd_path"]
fn fd_path(fd: i32, buf: &mut [u8]) -> isize; fn fd_path_for_cxx(fd: i32, buf: &mut [u8]) -> isize;
#[rust_name = "map_file_for_cxx"] #[cxx_name = "map_file"]
fn map_file(path: &[u8], rw: bool) -> &'static mut [u8]; fn map_file_for_cxx(path: &[u8], rw: bool) -> &'static mut [u8];
#[rust_name = "map_fd_for_cxx"] #[cxx_name = "map_fd"]
fn map_fd(fd: i32, sz: usize, rw: bool) -> &'static mut [u8]; fn map_fd_for_cxx(fd: i32, sz: usize, rw: bool) -> &'static mut [u8];
} }
} }

View File

@ -23,12 +23,12 @@ pub mod ffi {
fn decompress(buf: &[u8], fd: i32) -> bool; fn decompress(buf: &[u8], fd: i32) -> bool;
include!("bootimg.hpp"); include!("bootimg.hpp");
#[rust_name = "BootImage"] #[cxx_name = "boot_img"]
type boot_img; type BootImage;
#[rust_name = "payload"] #[cxx_name = "get_payload"]
fn get_payload(self: &BootImage) -> &[u8]; fn payload(self: &BootImage) -> &[u8];
#[rust_name = "tail"] #[cxx_name = "get_tail"]
fn get_tail(self: &BootImage) -> &[u8]; fn tail(self: &BootImage) -> &[u8];
} }
extern "Rust" { extern "Rust" {