mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-29 14:04:26 +02:00
Remove FsPath and FsPathMnt trait
Directly use Utf8CStr
This commit is contained in:
parent
610945ac54
commit
3327fc668e
@ -11,7 +11,7 @@ use std::str::Utf8Error;
|
||||
use std::{fmt, mem, slice, str};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{FsPath, FsPathMnt, slice_from_ptr_mut};
|
||||
use crate::slice_from_ptr_mut;
|
||||
// Utf8CStr types are UTF-8 validated and null terminated strings.
|
||||
//
|
||||
// Several Utf8CStr types:
|
||||
@ -609,22 +609,6 @@ impl_cstr_buf_write!(
|
||||
(Utf8CString,)
|
||||
);
|
||||
|
||||
// impl<T: Deref<Target = Utf8CStr>> FsPath for T {}
|
||||
// impl<T: Deref<Target = Utf8CStr>> FsPathMnt for T {}
|
||||
macro_rules! impl_fs_path {
|
||||
($( ($t:ty, $($g:tt)*) )*) => {$(
|
||||
impl<$($g)*> FsPath for $t {}
|
||||
impl<$($g)*> FsPathMnt for $t {}
|
||||
)*}
|
||||
}
|
||||
|
||||
impl_fs_path!(
|
||||
(&Utf8CStr,)
|
||||
(Utf8CStrBufRef<'_>,)
|
||||
(Utf8CStrBufArr<N>, const N: usize)
|
||||
(Utf8CString,)
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cstr {
|
||||
($str:expr) => {{
|
||||
|
@ -8,8 +8,8 @@ use libc::{c_char, mode_t};
|
||||
use crate::files::map_file_at;
|
||||
pub(crate) use crate::xwrap::*;
|
||||
use crate::{
|
||||
CxxResultExt, Directory, FsPath, OsResultStatic, Utf8CStr, clone_attr, cstr, fclone_attr,
|
||||
fd_path, map_fd, map_file, slice_from_ptr,
|
||||
CxxResultExt, Directory, OsResultStatic, Utf8CStr, clone_attr, cstr, fclone_attr, fd_path,
|
||||
map_fd, map_file, slice_from_ptr,
|
||||
};
|
||||
|
||||
pub(crate) fn fd_path_for_cxx(fd: RawFd, buf: &mut [u8]) -> isize {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::cxx_extern::readlinkat;
|
||||
use crate::{
|
||||
FileAttr, FsPath, FsPathBuilder, LibcReturn, OsError, OsResult, OsResultStatic, Utf8CStr,
|
||||
Utf8CStrBuf, cstr, errno, fd_path, fd_set_attr,
|
||||
FileAttr, FsPathBuilder, LibcReturn, OsError, OsResult, OsResultStatic, Utf8CStr, Utf8CStrBuf,
|
||||
cstr, errno, fd_path, fd_set_attr,
|
||||
};
|
||||
use libc::{EEXIST, O_CLOEXEC, O_CREAT, O_RDONLY, O_TRUNC, O_WRONLY, dirent, mode_t};
|
||||
use std::fs::File;
|
||||
|
@ -14,7 +14,6 @@ use std::ffi::CStr;
|
||||
use std::fmt::Display;
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom, Write};
|
||||
use std::ops::Deref;
|
||||
use std::os::fd::{AsFd, BorrowedFd};
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd, OwnedFd, RawFd};
|
||||
@ -187,27 +186,27 @@ impl FileAttr {
|
||||
|
||||
const XATTR_NAME_SELINUX: &CStr = c"security.selinux";
|
||||
|
||||
pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
fn follow_link(&self) -> &FsPathFollow {
|
||||
unsafe { mem::transmute(self.deref()) }
|
||||
impl Utf8CStr {
|
||||
pub fn follow_link(&self) -> &FsPathFollow {
|
||||
unsafe { mem::transmute(self) }
|
||||
}
|
||||
|
||||
fn open(&self, flags: i32) -> OsResult<File> {
|
||||
pub fn open(&self, flags: i32) -> OsResult<File> {
|
||||
Ok(File::from(open_fd(self, flags, 0)?))
|
||||
}
|
||||
|
||||
fn create(&self, flags: i32, mode: mode_t) -> OsResult<File> {
|
||||
pub fn create(&self, flags: i32, mode: mode_t) -> OsResult<File> {
|
||||
Ok(File::from(open_fd(self, O_CREAT | flags, mode)?))
|
||||
}
|
||||
|
||||
fn exists(&self) -> bool {
|
||||
pub fn exists(&self) -> bool {
|
||||
unsafe {
|
||||
let mut st: stat = mem::zeroed();
|
||||
libc::lstat(self.as_ptr(), &mut st) == 0
|
||||
}
|
||||
}
|
||||
|
||||
fn rename_to<'a>(&'a self, name: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
pub fn rename_to<'a>(&'a self, name: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::rename(self.as_ptr(), name.as_ptr()).check_os_err(
|
||||
"rename",
|
||||
@ -217,11 +216,11 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn remove(&self) -> OsResult<()> {
|
||||
pub fn remove(&self) -> OsResult<()> {
|
||||
unsafe { libc::remove(self.as_ptr()).check_os_err("remove", Some(self), None) }
|
||||
}
|
||||
|
||||
fn remove_all(&self) -> OsResultStatic<()> {
|
||||
pub fn remove_all(&self) -> OsResultStatic<()> {
|
||||
let attr = self.get_attr()?;
|
||||
if attr.is_dir() {
|
||||
let mut dir = Directory::try_from(open_fd(self, O_RDONLY | O_CLOEXEC, 0)?)?;
|
||||
@ -231,7 +230,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
|
||||
#[allow(clippy::unnecessary_cast)]
|
||||
fn read_link(&self, buf: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
pub fn read_link(&self, buf: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
buf.clear();
|
||||
unsafe {
|
||||
let r = libc::readlink(self.as_ptr(), buf.as_mut_ptr(), buf.capacity() - 1)
|
||||
@ -242,7 +241,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn mkdir(&self, mode: mode_t) -> OsResult<()> {
|
||||
pub fn mkdir(&self, mode: mode_t) -> OsResult<()> {
|
||||
unsafe {
|
||||
if libc::mkdir(self.as_ptr(), mode) < 0 {
|
||||
if *errno() == EEXIST {
|
||||
@ -255,7 +254,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn mkdirs(&self, mode: mode_t) -> OsResultStatic<()> {
|
||||
pub fn mkdirs(&self, mode: mode_t) -> OsResultStatic<()> {
|
||||
if self.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
@ -280,7 +279,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
|
||||
// Inspired by https://android.googlesource.com/platform/bionic/+/master/libc/bionic/realpath.cpp
|
||||
fn realpath(&self, buf: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
pub fn realpath(&self, buf: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
let fd = self.open(O_PATH | O_CLOEXEC)?;
|
||||
let mut st1: libc::stat;
|
||||
let mut st2: libc::stat;
|
||||
@ -304,7 +303,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_attr(&self) -> OsResult<FileAttr> {
|
||||
pub fn get_attr(&self) -> OsResult<FileAttr> {
|
||||
let mut attr = FileAttr::new();
|
||||
unsafe {
|
||||
libc::lstat(self.as_ptr(), &mut attr.st).check_os_err("lstat", Some(self), None)?;
|
||||
@ -315,7 +314,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(attr)
|
||||
}
|
||||
|
||||
fn set_attr<'a>(&'a self, attr: &'a FileAttr) -> OsResult<'a, ()> {
|
||||
pub fn set_attr<'a>(&'a self, attr: &'a FileAttr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
if !attr.is_symlink() {
|
||||
libc::chmod(self.as_ptr(), (attr.st.st_mode & 0o777).as_()).check_os_err(
|
||||
@ -338,7 +337,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_secontext(&self, con: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
pub fn get_secontext(&self, con: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
unsafe {
|
||||
let sz = libc::lgetxattr(
|
||||
self.as_ptr(),
|
||||
@ -358,7 +357,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_secontext<'a>(&'a self, con: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
pub fn set_secontext<'a>(&'a self, con: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::lsetxattr(
|
||||
self.as_ptr(),
|
||||
@ -371,7 +370,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn copy_to(&self, path: &Utf8CStr) -> OsResultStatic<()> {
|
||||
pub fn copy_to(&self, path: &Utf8CStr) -> OsResultStatic<()> {
|
||||
let attr = self.get_attr()?;
|
||||
if attr.is_dir() {
|
||||
path.mkdir(0o777)?;
|
||||
@ -401,7 +400,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn move_to(&self, path: &Utf8CStr) -> OsResultStatic<()> {
|
||||
pub fn move_to(&self, path: &Utf8CStr) -> OsResultStatic<()> {
|
||||
if path.exists() {
|
||||
let attr = path.get_attr()?;
|
||||
if attr.is_dir() {
|
||||
@ -416,7 +415,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parent(&self, buf: &mut dyn Utf8CStrBuf) -> bool {
|
||||
pub fn parent(&self, buf: &mut dyn Utf8CStrBuf) -> bool {
|
||||
buf.clear();
|
||||
if let Some(parent) = Path::new(self.as_str()).parent() {
|
||||
let bytes = parent.as_os_str().as_bytes();
|
||||
@ -430,7 +429,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
|
||||
// ln self path
|
||||
fn link_to(&self, path: &Utf8CStr) -> OsResultStatic<()> {
|
||||
pub fn link_to(&self, path: &Utf8CStr) -> OsResultStatic<()> {
|
||||
let attr = self.get_attr()?;
|
||||
if attr.is_dir() {
|
||||
path.mkdir(0o777)?;
|
||||
@ -451,7 +450,7 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
|
||||
// ln -s target self
|
||||
fn create_symlink_to<'a>(&'a self, target: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
pub fn create_symlink_to<'a>(&'a self, target: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::symlink(target.as_ptr(), self.as_ptr()).check_os_err(
|
||||
"symlink",
|
||||
@ -461,21 +460,17 @@ pub trait FsPath: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn mkfifo(&self, mode: mode_t) -> OsResult<()> {
|
||||
pub fn mkfifo(&self, mode: mode_t) -> OsResult<()> {
|
||||
unsafe { libc::mkfifo(self.as_ptr(), mode).check_os_err("mkfifo", Some(self), None) }
|
||||
}
|
||||
}
|
||||
|
||||
impl FsPath for FsPathFollow {
|
||||
fn follow_link(&self) -> &FsPathFollow {
|
||||
self
|
||||
}
|
||||
|
||||
fn exists(&self) -> bool {
|
||||
impl FsPathFollow {
|
||||
pub fn exists(&self) -> bool {
|
||||
unsafe { libc::access(self.as_ptr(), F_OK) == 0 }
|
||||
}
|
||||
|
||||
fn get_attr(&self) -> OsResult<FileAttr> {
|
||||
pub fn get_attr(&self) -> OsResult<FileAttr> {
|
||||
let mut attr = FileAttr::new();
|
||||
unsafe {
|
||||
libc::stat(self.as_ptr(), &mut attr.st).check_os_err("stat", Some(self), None)?;
|
||||
@ -486,7 +481,7 @@ impl FsPath for FsPathFollow {
|
||||
Ok(attr)
|
||||
}
|
||||
|
||||
fn set_attr<'a>(&'a self, attr: &'a FileAttr) -> OsResult<'a, ()> {
|
||||
pub fn set_attr<'a>(&'a self, attr: &'a FileAttr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::chmod(self.as_ptr(), (attr.st.st_mode & 0o777).as_()).check_os_err(
|
||||
"chmod",
|
||||
@ -507,7 +502,7 @@ impl FsPath for FsPathFollow {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_secontext(&self, con: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
pub fn get_secontext(&self, con: &mut dyn Utf8CStrBuf) -> OsResult<()> {
|
||||
unsafe {
|
||||
let sz = libc::getxattr(
|
||||
self.as_ptr(),
|
||||
@ -527,7 +522,7 @@ impl FsPath for FsPathFollow {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_secontext<'a>(&'a self, con: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
pub fn set_secontext<'a>(&'a self, con: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::setxattr(
|
||||
self.as_ptr(),
|
||||
|
@ -15,7 +15,6 @@ pub use ffi::fork_dont_care;
|
||||
pub use files::*;
|
||||
pub use logging::*;
|
||||
pub use misc::*;
|
||||
pub use mount::*;
|
||||
pub use result::*;
|
||||
|
||||
pub mod cstr;
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::{LibcReturn, OsResult, Utf8CStr};
|
||||
use libc::c_ulong;
|
||||
use std::ops::Deref;
|
||||
use std::ptr;
|
||||
|
||||
pub trait FsPathMnt: Deref<Target = Utf8CStr> {
|
||||
fn bind_mount_to<'a>(&'a self, path: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
impl Utf8CStr {
|
||||
pub fn bind_mount_to<'a>(&'a self, path: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::mount(
|
||||
self.as_ptr(),
|
||||
@ -17,7 +16,7 @@ pub trait FsPathMnt: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn remount_with_flags(&self, flags: c_ulong) -> OsResult<()> {
|
||||
pub fn remount_with_flags(&self, flags: c_ulong) -> OsResult<()> {
|
||||
unsafe {
|
||||
libc::mount(
|
||||
ptr::null(),
|
||||
@ -30,7 +29,7 @@ pub trait FsPathMnt: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn remount_with_data(&self, data: &Utf8CStr) -> OsResult<()> {
|
||||
pub fn remount_with_data(&self, data: &Utf8CStr) -> OsResult<()> {
|
||||
unsafe {
|
||||
libc::mount(
|
||||
ptr::null(),
|
||||
@ -43,7 +42,7 @@ pub trait FsPathMnt: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn move_mount_to<'a>(&'a self, path: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
pub fn move_mount_to<'a>(&'a self, path: &'a Utf8CStr) -> OsResult<'a, ()> {
|
||||
unsafe {
|
||||
libc::mount(
|
||||
self.as_ptr(),
|
||||
@ -56,13 +55,13 @@ pub trait FsPathMnt: Deref<Target = Utf8CStr> {
|
||||
}
|
||||
}
|
||||
|
||||
fn unmount(&self) -> OsResult<()> {
|
||||
pub fn unmount(&self) -> OsResult<()> {
|
||||
unsafe {
|
||||
libc::umount2(self.as_ptr(), libc::MNT_DETACH).check_os_err("unmount", Some(self), None)
|
||||
}
|
||||
}
|
||||
|
||||
fn set_mount_private(&self, recursive: bool) -> OsResult<()> {
|
||||
pub fn set_mount_private(&self, recursive: bool) -> OsResult<()> {
|
||||
let flag = if recursive { libc::MS_REC } else { 0 };
|
||||
unsafe {
|
||||
libc::mount(
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
use crate::cxx_extern::readlinkat;
|
||||
use crate::{
|
||||
BorrowedDirectory, CxxResultExt, FsPath, LibcReturn, Utf8CStr, cstr, slice_from_ptr,
|
||||
slice_from_ptr_mut,
|
||||
BorrowedDirectory, CxxResultExt, LibcReturn, Utf8CStr, cstr, slice_from_ptr, slice_from_ptr_mut,
|
||||
};
|
||||
use libc::{
|
||||
c_char, c_uint, c_ulong, c_void, dev_t, mode_t, nfds_t, off_t, pollfd, sockaddr, socklen_t,
|
||||
|
@ -20,8 +20,8 @@ use base::libc::{
|
||||
c_char, dev_t, gid_t, major, makedev, minor, mknod, mode_t, uid_t,
|
||||
};
|
||||
use base::{
|
||||
BytesExt, EarlyExitExt, FsPath, LoggedResult, MappedFile, ResultExt, Utf8CStr, Utf8CStrBuf,
|
||||
WriteExt, cstr, log_err, map_args,
|
||||
BytesExt, EarlyExitExt, LoggedResult, MappedFile, ResultExt, Utf8CStr, Utf8CStrBuf, WriteExt,
|
||||
cstr, log_err, map_args,
|
||||
};
|
||||
|
||||
use crate::check_env;
|
||||
|
@ -10,9 +10,7 @@ use crate::mount::{clean_mounts, setup_mounts};
|
||||
use crate::package::ManagerInfo;
|
||||
use crate::su::SuInfo;
|
||||
use base::libc::{O_CLOEXEC, O_RDONLY};
|
||||
use base::{
|
||||
AtomicArc, BufReadExt, FsPath, FsPathBuilder, ResultExt, Utf8CStr, cstr, error, info, libc,
|
||||
};
|
||||
use base::{AtomicArc, BufReadExt, FsPathBuilder, ResultExt, Utf8CStr, cstr, error, info, libc};
|
||||
use std::io::BufReader;
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
|
||||
|
@ -7,8 +7,8 @@ use num_traits::AsPrimitive;
|
||||
|
||||
use base::libc::{c_uint, dev_t};
|
||||
use base::{
|
||||
FsPath, FsPathBuilder, FsPathMnt, LibcReturn, LoggedResult, MountInfo, ResultExt, Utf8CStr,
|
||||
Utf8CStrBuf, cstr, debug, info, libc, parse_mount_info, warn,
|
||||
FsPathBuilder, LibcReturn, LoggedResult, MountInfo, ResultExt, Utf8CStr, Utf8CStrBuf, cstr,
|
||||
debug, info, libc, parse_mount_info, warn,
|
||||
};
|
||||
|
||||
use crate::consts::{MODULEMNT, MODULEROOT, PREINITDEV, PREINITMIRR, WORKERDIR};
|
||||
|
@ -4,8 +4,8 @@ use crate::ffi::{DbEntryKey, get_magisk_tmp, install_apk, uninstall_pkg};
|
||||
use base::WalkResult::{Abort, Continue, Skip};
|
||||
use base::libc::{O_CLOEXEC, O_CREAT, O_RDONLY, O_TRUNC, O_WRONLY};
|
||||
use base::{
|
||||
BufReadExt, Directory, FsPath, FsPathBuilder, LoggedResult, ReadExt, ResultExt, Utf8CStrBuf,
|
||||
cstr, error, fd_get_attr, warn,
|
||||
BufReadExt, Directory, FsPathBuilder, LoggedResult, ReadExt, ResultExt, Utf8CStrBuf, cstr,
|
||||
error, fd_get_attr, warn,
|
||||
};
|
||||
use bit_set::BitSet;
|
||||
use cxx::CxxString;
|
||||
|
@ -16,8 +16,8 @@ use crate::resetprop::proto::persistent_properties::{
|
||||
use base::const_format::concatcp;
|
||||
use base::libc::{O_CLOEXEC, O_RDONLY};
|
||||
use base::{
|
||||
Directory, FsPath, FsPathBuilder, LibcReturn, LoggedResult, MappedFile, SilentResultExt,
|
||||
Utf8CStr, Utf8CStrBuf, WalkResult, clone_attr, cstr, debug, libc::mkstemp,
|
||||
Directory, FsPathBuilder, LibcReturn, LoggedResult, MappedFile, SilentResultExt, Utf8CStr,
|
||||
Utf8CStrBuf, WalkResult, clone_attr, cstr, debug, libc::mkstemp,
|
||||
};
|
||||
|
||||
const PERSIST_PROP_DIR: &str = "/data/property";
|
||||
|
@ -6,7 +6,7 @@ use crate::ffi::{
|
||||
use crate::socket::{IpcRead, UnixSocketExt};
|
||||
use base::libc::{O_CLOEXEC, O_CREAT, O_RDONLY, STDOUT_FILENO};
|
||||
use base::{
|
||||
Directory, FsPath, FsPathBuilder, LoggedError, LoggedResult, ResultExt, WriteExt, cstr, error,
|
||||
Directory, FsPathBuilder, LoggedError, LoggedResult, ResultExt, WriteExt, cstr, error,
|
||||
fork_dont_care, libc, raw_cstr, warn,
|
||||
};
|
||||
use std::fmt::Write;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::ffi::{BootConfig, MagiskInit, backup_init};
|
||||
use base::{BytesExt, FsPath, MappedFile, cstr};
|
||||
use base::{BytesExt, MappedFile, cstr};
|
||||
|
||||
impl BootConfig {
|
||||
#[allow(unused_imports, unused_unsafe)]
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
logging::setup_klog,
|
||||
};
|
||||
use base::{
|
||||
FsPath, FsPathMnt, LibcReturn, LoggedResult, ResultExt, cstr, info,
|
||||
LibcReturn, LoggedResult, ResultExt, cstr, info,
|
||||
libc::{basename, getpid, mount, umask},
|
||||
raw_cstr,
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
use base::{
|
||||
FsPath, LOGGER, LogLevel, Logger, SilentResultExt, Utf8CStr, cstr,
|
||||
LOGGER, LogLevel, Logger, SilentResultExt, Utf8CStr, cstr,
|
||||
libc::{
|
||||
O_CLOEXEC, O_RDWR, O_WRONLY, S_IFCHR, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO, SYS_dup3,
|
||||
makedev, mknod, syscall,
|
||||
|
@ -1,8 +1,7 @@
|
||||
use crate::ffi::MagiskInit;
|
||||
use base::libc::{TMPFS_MAGIC, statfs};
|
||||
use base::{
|
||||
Directory, FsPath, FsPathBuilder, FsPathMnt, LibcReturn, LoggedResult, ResultExt, Utf8CStr,
|
||||
cstr, debug, libc,
|
||||
Directory, FsPathBuilder, LibcReturn, LoggedResult, ResultExt, Utf8CStr, cstr, debug, libc,
|
||||
libc::{chdir, chroot, execve, exit, mount},
|
||||
parse_mount_info, raw_cstr,
|
||||
};
|
||||
|
@ -2,8 +2,8 @@ use crate::consts::{ROOTMNT, ROOTOVL};
|
||||
use crate::ffi::MagiskInit;
|
||||
use base::libc::{O_CREAT, O_RDONLY, O_WRONLY};
|
||||
use base::{
|
||||
BufReadExt, Directory, FsPath, FsPathBuilder, FsPathMnt, LoggedResult, ResultExt, Utf8CStr,
|
||||
Utf8CString, clone_attr, cstr, debug,
|
||||
BufReadExt, Directory, FsPathBuilder, LoggedResult, ResultExt, Utf8CStr, Utf8CString,
|
||||
clone_attr, cstr, debug,
|
||||
};
|
||||
use std::io::BufReader;
|
||||
use std::{
|
||||
|
@ -2,8 +2,8 @@ use crate::consts::{PREINITMIRR, SELINUXMOCK};
|
||||
use crate::ffi::{MagiskInit, preload_ack, preload_lib, preload_policy, split_plat_cil};
|
||||
use base::const_format::concatcp;
|
||||
use base::{
|
||||
BytesExt, FsPath, FsPathMnt, LibcReturn, LoggedResult, MappedFile, ResultExt, Utf8CStr, cstr,
|
||||
debug, error, info, libc, raw_cstr,
|
||||
BytesExt, LibcReturn, LoggedResult, MappedFile, ResultExt, Utf8CStr, cstr, debug, error, info,
|
||||
libc, raw_cstr,
|
||||
};
|
||||
use magiskpolicy::ffi::SePolicy;
|
||||
use std::io::{Read, Write};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::ffi::MagiskInit;
|
||||
use base::{
|
||||
FsPath, FsPathMnt, LoggedResult, MappedFile, MutBytesExt, ResultExt, cstr, debug, error,
|
||||
LoggedResult, MappedFile, MutBytesExt, ResultExt, cstr, debug, error,
|
||||
libc::{O_CLOEXEC, O_CREAT, O_RDONLY, O_WRONLY},
|
||||
};
|
||||
use std::io::Write;
|
||||
|
@ -5,7 +5,7 @@ use std::{iter::Peekable, vec::IntoIter};
|
||||
use crate::SePolicy;
|
||||
use crate::ffi::Xperm;
|
||||
use base::libc::{O_CLOEXEC, O_RDONLY};
|
||||
use base::{BufReadExt, FsPath, LoggedResult, Utf8CStr, error, warn};
|
||||
use base::{BufReadExt, LoggedResult, Utf8CStr, error, warn};
|
||||
|
||||
pub enum Token<'a> {
|
||||
AL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user