mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 05:07:45 +02:00
Separate magiskinit components
This commit is contained in:
56
native/jni/init/init.h
Normal file
56
native/jni/init/init.h
Normal file
@ -0,0 +1,56 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
struct cmdline {
|
||||
bool system_as_root;
|
||||
char slot[3];
|
||||
char dt_dir[128];
|
||||
};
|
||||
|
||||
struct raw_data {
|
||||
void *buf;
|
||||
size_t sz;
|
||||
};
|
||||
|
||||
struct device {
|
||||
int major;
|
||||
int minor;
|
||||
char devname[32];
|
||||
char partname[32];
|
||||
};
|
||||
|
||||
class MagiskInit {
|
||||
private:
|
||||
cmdline cmd{};
|
||||
raw_data self{};
|
||||
raw_data config{};
|
||||
int root = -1;
|
||||
char **argv;
|
||||
bool load_sepol = false;
|
||||
bool mnt_system = false;
|
||||
bool mnt_vendor = false;
|
||||
bool mnt_product = false;
|
||||
bool mnt_odm = false;
|
||||
|
||||
void load_kernel_info();
|
||||
void preset();
|
||||
void early_mount();
|
||||
void setup_rootfs();
|
||||
bool read_dt_fstab(const char *name, char *partname, char *partfs);
|
||||
bool patch_sepolicy();
|
||||
void cleanup();
|
||||
void re_exec_init();
|
||||
|
||||
public:
|
||||
explicit MagiskInit(char *argv[]) : argv(argv) {}
|
||||
void start();
|
||||
void test();
|
||||
};
|
||||
|
||||
static inline bool is_lnk(const char *name) {
|
||||
struct stat st;
|
||||
if (lstat(name, &st))
|
||||
return false;
|
||||
return S_ISLNK(st.st_mode);
|
||||
}
|
||||
|
||||
int dump_magisk(const char *path, mode_t mode);
|
Reference in New Issue
Block a user