Move functions out of libutils

This commit is contained in:
topjohnwu 2018-10-24 22:18:23 -04:00
parent 4ecbf8c12c
commit 9954154ca2
3 changed files with 10 additions and 12 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);