Commit 9954154c authored by topjohnwu's avatar topjohnwu

Move functions out of libutils

parent 4ecbf8c1
...@@ -190,6 +190,16 @@ static void exec_module_script(const char* stage) { ...@@ -190,6 +190,16 @@ static void exec_module_script(const char* stage) {
* Magic Mount * * Magic Mount *
***************/ ***************/
static int bind_mount(const char *from, const char *to) {
int ret = xmount(from, to, NULL, MS_BIND, NULL);
#ifdef MAGISK_DEBUG
LOGI("bind_mount: %s <- %s\n", to, from);
#else
LOGI("bind_mount: %s\n", to);
#endif
return ret;
}
static void construct_tree(const char *module, struct node_entry *parent) { static void construct_tree(const char *module, struct node_entry *parent) {
DIR *dir; DIR *dir;
struct dirent *entry; struct dirent *entry;
......
...@@ -90,7 +90,6 @@ int is_num(const char *s); ...@@ -90,7 +90,6 @@ int is_num(const char *s);
int exec_array(int err, int *fd, void (*setenv)(struct vector *), char *const *argv); int exec_array(int err, int *fd, void (*setenv)(struct vector *), char *const *argv);
int exec_command(int err, int *fd, void (*setenv)(struct vector*), const char *argv0, ...); int exec_command(int err, int *fd, void (*setenv)(struct vector*), const char *argv0, ...);
int exec_command_sync(char *const argv0, ...); int exec_command_sync(char *const argv0, ...);
int bind_mount(const char *from, const char *to);
int switch_mnt_ns(int pid); int switch_mnt_ns(int pid);
int fork_dont_care(); int fork_dont_care();
void wait_till_exists(const char *target); void wait_till_exists(const char *target);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "logging.h" #include "logging.h"
#include "utils.h" #include "utils.h"
#include "flags.h"
unsigned get_shell_uid() { unsigned get_shell_uid() {
struct passwd* ppwd = getpwnam("shell"); struct passwd* ppwd = getpwnam("shell");
...@@ -198,16 +197,6 @@ int exec_command(int err, int *fd, void (*setenv)(struct vector*), const char *a ...@@ -198,16 +197,6 @@ int exec_command(int err, int *fd, void (*setenv)(struct vector*), const char *a
return pid; return pid;
} }
int bind_mount(const char *from, const char *to) {
int ret = xmount(from, to, NULL, MS_BIND, NULL);
#ifdef MAGISK_DEBUG
LOGI("bind_mount: %s <- %s\n", to, from);
#else
LOGI("bind_mount: %s\n", to);
#endif
return ret;
}
int switch_mnt_ns(int pid) { int switch_mnt_ns(int pid) {
char mnt[32]; char mnt[32];
snprintf(mnt, sizeof(mnt), "/proc/%d/ns/mnt", pid); snprintf(mnt, sizeof(mnt), "/proc/%d/ns/mnt", pid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment