Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
71638191
Commit
71638191
authored
Jan 26, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup messy logging code
parent
9d6851cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
27 deletions
+13
-27
bootstages.cpp
native/jni/daemon/bootstages.cpp
+13
-27
No files found.
native/jni/daemon/bootstages.cpp
View file @
71638191
...
@@ -40,6 +40,12 @@ extern void auto_start_magiskhide();
...
@@ -40,6 +40,12 @@ extern void auto_start_magiskhide();
* Magic Mount *
* Magic Mount *
***************/
***************/
#ifdef MAGISK_DEBUG
#define VLOGI(tag, from, to) LOGI("%s: %s <- %s\n", tag, to, from)
#else
#define VLOGI(tag, from, to) LOGI("%s: %s\n", tag, to)
#endif
// Precedence: MODULE > SKEL > INTER > DUMMY
// Precedence: MODULE > SKEL > INTER > DUMMY
#define IS_DUMMY 0x01
/* mount from mirror */
#define IS_DUMMY 0x01
/* mount from mirror */
#define IS_INTER 0x02
/* intermediate node */
#define IS_INTER 0x02
/* intermediate node */
...
@@ -223,7 +229,7 @@ void node_entry::clone_skeleton() {
...
@@ -223,7 +229,7 @@ void node_entry::clone_skeleton() {
if
(
is_root
()
&&
child
->
name
==
"vendor"
)
{
if
(
is_root
()
&&
child
->
name
==
"vendor"
)
{
if
(
seperate_vendor
)
{
if
(
seperate_vendor
)
{
cp_afc
(
MIRRDIR
"/system/vendor"
,
"/system/vendor"
);
cp_afc
(
MIRRDIR
"/system/vendor"
,
"/system/vendor"
);
LOGI
(
"copy_link : %s <- %s
\n
"
,
"/system/vendor"
,
MIRRDIR
"/system/vendor"
);
VLOGI
(
"copy_link
"
,
"/system/vendor"
,
MIRRDIR
"/system/vendor"
);
}
}
// Skip
// Skip
continue
;
continue
;
...
@@ -243,11 +249,7 @@ void node_entry::clone_skeleton() {
...
@@ -243,11 +249,7 @@ void node_entry::clone_skeleton() {
if
(
IS_LNK
(
child
))
{
if
(
IS_LNK
(
child
))
{
// Copy symlinks directly
// Copy symlinks directly
cp_afc
(
buf2
,
buf
);
cp_afc
(
buf2
,
buf
);
#ifdef MAGISK_DEBUG
VLOGI
(
"copy_link "
,
buf2
,
buf
);
LOGI
(
"copy_link : %s <- %s
\n
"
,
buf
,
buf2
);
#else
LOGI
(
"copy_link : %s
\n
"
,
buf
);
#endif
}
else
{
}
else
{
snprintf
(
buf
,
PATH_MAX
,
"%s/%s"
,
full_path
.
c_str
(),
child
->
name
.
c_str
());
snprintf
(
buf
,
PATH_MAX
,
"%s/%s"
,
full_path
.
c_str
(),
child
->
name
.
c_str
());
bind_mount
(
buf2
,
buf
);
bind_mount
(
buf2
,
buf
);
...
@@ -389,11 +391,7 @@ static void simple_mount(const char *path) {
...
@@ -389,11 +391,7 @@ static void simple_mount(const char *path) {
static
int
bind_mount
(
const
char
*
from
,
const
char
*
to
)
{
static
int
bind_mount
(
const
char
*
from
,
const
char
*
to
)
{
int
ret
=
xmount
(
from
,
to
,
nullptr
,
MS_BIND
,
nullptr
);
int
ret
=
xmount
(
from
,
to
,
nullptr
,
MS_BIND
,
nullptr
);
#ifdef MAGISK_DEBUG
VLOGI
(
"bind_mount"
,
from
,
to
);
LOGI
(
"bind_mount: %s <- %s
\n
"
,
to
,
from
);
#else
LOGI
(
"bind_mount: %s
\n
"
,
to
);
#endif
return
ret
;
return
ret
;
}
}
...
@@ -449,22 +447,14 @@ static bool magisk_env() {
...
@@ -449,22 +447,14 @@ static bool magisk_env() {
sscanf
(
line
.
c_str
(),
"%s %*s %s"
,
buf
,
buf2
);
sscanf
(
line
.
c_str
(),
"%s %*s %s"
,
buf
,
buf2
);
system_block
=
strdup2
(
buf
);
system_block
=
strdup2
(
buf
);
xmount
(
system_block
,
MIRRDIR
"/system"
,
buf2
,
MS_RDONLY
,
nullptr
);
xmount
(
system_block
,
MIRRDIR
"/system"
,
buf2
,
MS_RDONLY
,
nullptr
);
#ifdef MAGISK_DEBUG
VLOGI
(
"mount"
,
system_block
,
MIRRDIR
"/system"
);
LOGI
(
"mount: %s <- %s
\n
"
,
MIRRDIR
"/system"
,
buf
);
#else
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/system"
);
#endif
}
else
if
(
str_contains
(
line
,
" /vendor "
))
{
}
else
if
(
str_contains
(
line
,
" /vendor "
))
{
seperate_vendor
=
true
;
seperate_vendor
=
true
;
sscanf
(
line
.
c_str
(),
"%s %*s %s"
,
buf
,
buf2
);
sscanf
(
line
.
c_str
(),
"%s %*s %s"
,
buf
,
buf2
);
vendor_block
=
strdup2
(
buf
);
vendor_block
=
strdup2
(
buf
);
xmkdir
(
MIRRDIR
"/vendor"
,
0755
);
xmkdir
(
MIRRDIR
"/vendor"
,
0755
);
xmount
(
buf
,
MIRRDIR
"/vendor"
,
buf2
,
MS_RDONLY
,
nullptr
);
xmount
(
vendor_block
,
MIRRDIR
"/vendor"
,
buf2
,
MS_RDONLY
,
nullptr
);
#ifdef MAGISK_DEBUG
VLOGI
(
"mount"
,
vendor_block
,
MIRRDIR
"/system"
);
LOGI
(
"mount: %s <- %s
\n
"
,
MIRRDIR
"/vendor"
,
buf
);
#else
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/vendor"
);
#endif
}
else
if
(
SDK_INT
>=
24
&&
}
else
if
(
SDK_INT
>=
24
&&
str_contains
(
line
,
" /proc "
)
&&
!
str_contains
(
line
,
"hidepid=2"
))
{
str_contains
(
line
,
" /proc "
)
&&
!
str_contains
(
line
,
"hidepid=2"
))
{
// Enforce hidepid
// Enforce hidepid
...
@@ -473,11 +463,7 @@ static bool magisk_env() {
...
@@ -473,11 +463,7 @@ static bool magisk_env() {
}
}
if
(
!
seperate_vendor
)
{
if
(
!
seperate_vendor
)
{
xsymlink
(
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
xsymlink
(
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
#ifdef MAGISK_DEBUG
VLOGI
(
"link"
,
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
LOGI
(
"link: %s <- %s
\n
"
,
MIRRDIR
"/vendor"
,
MIRRDIR
"/system/vendor"
);
#else
LOGI
(
"link: %s
\n
"
,
MIRRDIR
"/vendor"
);
#endif
}
}
xmkdirs
(
DATABIN
,
0755
);
xmkdirs
(
DATABIN
,
0755
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment