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) {
* 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) {
DIR *dir;
struct dirent *entry;
......
......@@ -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_command(int err, int *fd, void (*setenv)(struct vector*), const char *argv0, ...);
int exec_command_sync(char *const argv0, ...);
int bind_mount(const char *from, const char *to);
int switch_mnt_ns(int pid);
int fork_dont_care();
void wait_till_exists(const char *target);
......
......@@ -22,7 +22,6 @@
#include "logging.h"
#include "utils.h"
#include "flags.h"
unsigned get_shell_uid() {
struct passwd* ppwd = getpwnam("shell");
......@@ -198,16 +197,6 @@ int exec_command(int err, int *fd, void (*setenv)(struct vector*), const char *a
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) {
char mnt[32];
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