diff --git a/rust/src/composepost.rs b/rust/src/composepost.rs index 481072c8..ccb58a5a 100644 --- a/rust/src/composepost.rs +++ b/rust/src/composepost.rs @@ -84,29 +84,12 @@ fn postprocess_subs_dist(rootfs_dfd: &openat::Dir) -> Result<()> { // This function is called from rpmostree_postprocess_final(); think of // it as the bits of that function that we've chosen to implement in Rust. -fn compose_postprocess_final(rootfs_dfd: &openat::Dir) -> Result<()> { +pub(crate) fn compose_postprocess_final(rootfs_dfd: i32) -> Result<()> { + let rootfs_dfd = crate::ffiutil::ffi_view_openat_dir(rootfs_dfd); let tasks = [ postprocess_useradd, postprocess_presets, postprocess_subs_dist, ]; - tasks.par_iter().try_for_each(|f| f(rootfs_dfd)) + tasks.par_iter().try_for_each(|f| f(&rootfs_dfd)) } - -mod ffi { - use super::*; - use glib_sys; - use libc; - - use crate::ffiutil::*; - - #[no_mangle] - pub extern "C" fn ror_compose_postprocess_final( - rootfs_dfd: libc::c_int, - gerror: *mut *mut glib_sys::GError, - ) -> libc::c_int { - let rootfs_dfd = ffi_view_openat_dir(rootfs_dfd); - int_glib_error(compose_postprocess_final(&rootfs_dfd), gerror) - } -} -pub use self::ffi::*; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 32ead3da..1ffeebce 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -48,6 +48,11 @@ mod ffi { fn get_systemctl_wrapper() -> &'static [u8]; } + // composepost.rs + extern "Rust" { + fn compose_postprocess_final(rootfs_dfd: i32) -> Result<()>; + } + // initramfs.rs extern "Rust" { fn get_dracut_random_cpio() -> &'static [u8]; @@ -105,7 +110,7 @@ pub(crate) use client::*; mod cliwrap; pub use cliwrap::*; mod composepost; -pub use self::composepost::*; +pub(crate) use composepost::*; mod core; use crate::core::*; mod history; diff --git a/src/libpriv/rpmostree-postprocess.cxx b/src/libpriv/rpmostree-postprocess.cxx index 68a5b773..38e50129 100644 --- a/src/libpriv/rpmostree-postprocess.cxx +++ b/src/libpriv/rpmostree-postprocess.cxx @@ -984,8 +984,7 @@ rpmostree_postprocess_final (int rootfs_dfd, error)) return FALSE; - if (!ror_compose_postprocess_final (rootfs_dfd, error)) - return FALSE; + rpmostreecxx::compose_postprocess_final (rootfs_dfd); if (selinux) {