Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f33532e7 authored by Dennis Shen's avatar Dennis Shen
Browse files

aconfig_storage_read_api: make map_file function public.

With aconfigd moving to rust implementation. It not only needs to open
boot copy, but also persist and default copy. The get_mapped_file
function is meant to be used by codegen which only opens boot copy. Thus
need to make map_file function public, just like what we did in c++.

Bug: b/321077378
Test: atest
Change-Id: I4fd2a5e0cf7839fde43e83b8888488caa74fb1b9
parent 5f837486
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ pub mod package_table_query;

pub use aconfig_storage_file::{AconfigStorageError, FlagValueType, StorageFileType};
pub use flag_table_query::FlagReadContext;
pub use mapped_file::map_file;
pub use package_table_query::PackageReadContext;

use aconfig_storage_file::read_u32_from_bytes;
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ use crate::StorageFileType;
/// The memory mapped file may have undefined behavior if there are writes to this
/// file after being mapped. Ensure no writes can happen to this file while this
/// mapping stays alive.
unsafe fn map_file(file_path: &str) -> Result<Mmap, AconfigStorageError> {
pub unsafe fn map_file(file_path: &str) -> Result<Mmap, AconfigStorageError> {
    let file = File::open(file_path)
        .map_err(|errmsg| FileReadFail(anyhow!("Failed to open file {}: {}", file_path, errmsg)))?;
    unsafe {