Commit f9bde347 authored by topjohnwu's avatar topjohnwu

Convert indentation to spaces

The tab war is lost
parent 947a7d6a
...@@ -12,25 +12,25 @@ LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils ...@@ -12,25 +12,25 @@ LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils
LOCAL_C_INCLUDES := jni/include LOCAL_C_INCLUDES := jni/include
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
core/applets.cpp \ core/applets.cpp \
core/magisk.cpp \ core/magisk.cpp \
core/daemon.cpp \ core/daemon.cpp \
core/bootstages.cpp \ core/bootstages.cpp \
core/socket.cpp \ core/socket.cpp \
core/db.cpp \ core/db.cpp \
core/scripting.cpp \ core/scripting.cpp \
core/restorecon.cpp \ core/restorecon.cpp \
core/module.cpp \ core/module.cpp \
magiskhide/magiskhide.cpp \ magiskhide/magiskhide.cpp \
magiskhide/proc_monitor.cpp \ magiskhide/proc_monitor.cpp \
magiskhide/hide_utils.cpp \ magiskhide/hide_utils.cpp \
magiskhide/hide_policy.cpp \ magiskhide/hide_policy.cpp \
resetprop/persist_properties.cpp \ resetprop/persist_properties.cpp \
resetprop/resetprop.cpp \ resetprop/resetprop.cpp \
su/su.cpp \ su/su.cpp \
su/connect.cpp \ su/connect.cpp \
su/pts.cpp \ su/pts.cpp \
su/su_daemon.cpp su/su_daemon.cpp
LOCAL_LDLIBS := -llog LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
...@@ -52,24 +52,24 @@ ifdef BB_INIT ...@@ -52,24 +52,24 @@ ifdef BB_INIT
LOCAL_STATIC_LIBRARIES := libsepol libxz libutils LOCAL_STATIC_LIBRARIES := libsepol libxz libutils
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
jni/include \ jni/include \
out \ out \
out/$(TARGET_ARCH_ABI) out/$(TARGET_ARCH_ABI)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
init/init.cpp \ init/init.cpp \
init/mount.cpp \ init/mount.cpp \
init/rootdir.cpp \ init/rootdir.cpp \
init/getinfo.cpp \ init/getinfo.cpp \
init/twostage.cpp \ init/twostage.cpp \
init/raw_data.cpp \ init/raw_data.cpp \
core/socket.cpp \ core/socket.cpp \
magiskpolicy/sepolicy.cpp \ magiskpolicy/sepolicy.cpp \
magiskpolicy/magiskpolicy.cpp \ magiskpolicy/magiskpolicy.cpp \
magiskpolicy/rules.cpp \ magiskpolicy/rules.cpp \
magiskpolicy/policydb.cpp \ magiskpolicy/policydb.cpp \
magiskpolicy/statement.cpp \ magiskpolicy/statement.cpp \
magiskboot/pattern.cpp magiskboot/pattern.cpp
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
...@@ -84,15 +84,15 @@ LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils ...@@ -84,15 +84,15 @@ LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils
LOCAL_C_INCLUDES := jni/include LOCAL_C_INCLUDES := jni/include
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
magiskboot/main.cpp \ magiskboot/main.cpp \
magiskboot/bootimg.cpp \ magiskboot/bootimg.cpp \
magiskboot/hexpatch.cpp \ magiskboot/hexpatch.cpp \
magiskboot/compress.cpp \ magiskboot/compress.cpp \
magiskboot/format.cpp \ magiskboot/format.cpp \
magiskboot/dtb.cpp \ magiskboot/dtb.cpp \
magiskboot/ramdisk.cpp \ magiskboot/ramdisk.cpp \
magiskboot/pattern.cpp \ magiskboot/pattern.cpp \
utils/cpio.cpp utils/cpio.cpp
LOCAL_LDLIBS := -lz LOCAL_LDLIBS := -lz
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
...@@ -108,12 +108,12 @@ LOCAL_STATIC_LIBRARIES := libsepol libutils ...@@ -108,12 +108,12 @@ LOCAL_STATIC_LIBRARIES := libsepol libutils
LOCAL_C_INCLUDES := jni/include LOCAL_C_INCLUDES := jni/include
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
core/applet_stub.cpp \ core/applet_stub.cpp \
magiskpolicy/sepolicy.cpp \ magiskpolicy/sepolicy.cpp \
magiskpolicy/magiskpolicy.cpp \ magiskpolicy/magiskpolicy.cpp \
magiskpolicy/rules.cpp \ magiskpolicy/rules.cpp \
magiskpolicy/policydb.cpp \ magiskpolicy/policydb.cpp \
magiskpolicy/statement.cpp magiskpolicy/statement.cpp
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=magiskpolicy_main LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=magiskpolicy_main
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
...@@ -129,9 +129,9 @@ LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils ...@@ -129,9 +129,9 @@ LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils
LOCAL_C_INCLUDES := jni/include LOCAL_C_INCLUDES := jni/include
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
core/applet_stub.cpp \ core/applet_stub.cpp \
resetprop/persist_properties.cpp \ resetprop/persist_properties.cpp \
resetprop/resetprop.cpp \ resetprop/resetprop.cpp \
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <utils.hpp> #include <utils.hpp>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
umask(0); umask(0);
cmdline_logging(); cmdline_logging();
return APPLET_STUB_MAIN(argc, argv); return APPLET_STUB_MAIN(argc, argv);
} }
...@@ -15,32 +15,32 @@ using main_fun = int (*)(int, char *[]); ...@@ -15,32 +15,32 @@ using main_fun = int (*)(int, char *[]);
static main_fun applet_main[] = { su_client_main, resetprop_main, magiskhide_main, nullptr }; static main_fun applet_main[] = { su_client_main, resetprop_main, magiskhide_main, nullptr };
[[noreturn]] static void call_applet(int argc, char **argv) { [[noreturn]] static void call_applet(int argc, char **argv) {
// Applets // Applets
for (int i = 0; applet_names[i]; ++i) { for (int i = 0; applet_names[i]; ++i) {
if (strcmp(basename(argv[0]), applet_names[i]) == 0) { if (strcmp(basename(argv[0]), applet_names[i]) == 0) {
exit((*applet_main[i])(argc, argv)); exit((*applet_main[i])(argc, argv));
} }
} }
fprintf(stderr, "%s: applet not found\n", basename(argv[0])); fprintf(stderr, "%s: applet not found\n", basename(argv[0]));
exit(1); exit(1);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
umask(0); umask(0);
dload_selinux(); dload_selinux();
cmdline_logging(); cmdline_logging();
init_argv0(argc, argv); init_argv0(argc, argv);
if (basename(argv[0]) == "magisk"sv) { if (basename(argv[0]) == "magisk"sv) {
if (argc > 1 && argv[1][0] != '-') { if (argc > 1 && argv[1][0] != '-') {
// Calling applet via magisk [applet] args // Calling applet via magisk [applet] args
--argc; --argc;
++argv; ++argv;
} else { } else {
return magisk_main(argc, argv); return magisk_main(argc, argv);
} }
} }
call_applet(argc, argv); call_applet(argc, argv);
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
using namespace std; using namespace std;
[[noreturn]] static void usage() { [[noreturn]] static void usage() {
fprintf(stderr, fprintf(stderr,
R"EOF(Magisk - Multi-purpose Utility R"EOF(Magisk - Multi-purpose Utility
Usage: magisk [applet [arguments]...] Usage: magisk [applet [arguments]...]
...@@ -39,92 +39,92 @@ Advanced Options (Internal APIs): ...@@ -39,92 +39,92 @@ Advanced Options (Internal APIs):
Available applets: Available applets:
)EOF"); )EOF");
for (int i = 0; applet_names[i]; ++i) for (int i = 0; applet_names[i]; ++i)
fprintf(stderr, i ? ", %s" : " %s", applet_names[i]); fprintf(stderr, i ? ", %s" : " %s", applet_names[i]);
fprintf(stderr, "\n\n"); fprintf(stderr, "\n\n");
exit(1); exit(1);
} }
int magisk_main(int argc, char *argv[]) { int magisk_main(int argc, char *argv[]) {
if (argc < 2) if (argc < 2)
usage(); usage();
if (argv[1] == "-c"sv) { if (argv[1] == "-c"sv) {
printf(MAGISK_VERSION ":MAGISK (" str(MAGISK_VER_CODE) ")\n"); printf(MAGISK_VERSION ":MAGISK (" str(MAGISK_VER_CODE) ")\n");
return 0; return 0;
} else if (argv[1] == "-v"sv) { } else if (argv[1] == "-v"sv) {
int fd = connect_daemon(); int fd = connect_daemon();
write_int(fd, CHECK_VERSION); write_int(fd, CHECK_VERSION);
char *v = read_string(fd); char *v = read_string(fd);
printf("%s\n", v); printf("%s\n", v);
free(v); free(v);
return 0; return 0;
} else if (argv[1] == "-V"sv) { } else if (argv[1] == "-V"sv) {
int fd = connect_daemon(); int fd = connect_daemon();
write_int(fd, CHECK_VERSION_CODE); write_int(fd, CHECK_VERSION_CODE);
printf("%d\n", read_int(fd)); printf("%d\n", read_int(fd));
return 0; return 0;
} else if (argv[1] == "--list"sv) { } else if (argv[1] == "--list"sv) {
for (int i = 0; applet_names[i]; ++i) for (int i = 0; applet_names[i]; ++i)
printf("%s\n", applet_names[i]); printf("%s\n", applet_names[i]);
return 0; return 0;
} else if (argv[1] == "--unlock-blocks"sv) { } else if (argv[1] == "--unlock-blocks"sv) {
unlock_blocks(); unlock_blocks();
return 0; return 0;
} else if (argv[1] == "--restorecon"sv) { } else if (argv[1] == "--restorecon"sv) {
restorecon(); restorecon();
return 0; return 0;
} else if (argc >= 4 && argv[1] == "--clone-attr"sv) {; } else if (argc >= 4 && argv[1] == "--clone-attr"sv) {;
clone_attr(argv[2], argv[3]); clone_attr(argv[2], argv[3]);
return 0; return 0;
} else if (argc >= 4 && argv[1] == "--clone"sv) { } else if (argc >= 4 && argv[1] == "--clone"sv) {
cp_afc(argv[2], argv[3]); cp_afc(argv[2], argv[3]);
return 0; return 0;
} else if (argv[1] == "--daemon"sv) { } else if (argv[1] == "--daemon"sv) {
int fd = connect_daemon(true); int fd = connect_daemon(true);
write_int(fd, START_DAEMON); write_int(fd, START_DAEMON);
return 0; return 0;
} else if (argv[1] == "--post-fs-data"sv) { } else if (argv[1] == "--post-fs-data"sv) {
int fd = connect_daemon(true); int fd = connect_daemon(true);
write_int(fd, POST_FS_DATA); write_int(fd, POST_FS_DATA);
return read_int(fd); return read_int(fd);
} else if (argv[1] == "--service"sv) { } else if (argv[1] == "--service"sv) {
int fd = connect_daemon(true); int fd = connect_daemon(true);
write_int(fd, LATE_START); write_int(fd, LATE_START);
return read_int(fd); return read_int(fd);
} else if (argv[1] == "--boot-complete"sv) { } else if (argv[1] == "--boot-complete"sv) {
int fd = connect_daemon(true); int fd = connect_daemon(true);
write_int(fd, BOOT_COMPLETE); write_int(fd, BOOT_COMPLETE);
return read_int(fd); return read_int(fd);
} else if (argc >= 3 && argv[1] == "--sqlite"sv) { } else if (argc >= 3 && argv[1] == "--sqlite"sv) {
int fd = connect_daemon(); int fd = connect_daemon();
write_int(fd, SQLITE_CMD); write_int(fd, SQLITE_CMD);
write_string(fd, argv[2]); write_string(fd, argv[2]);
for (;;) { for (;;) {
char *res = read_string(fd); char *res = read_string(fd);
if (res[0] == '\0') { if (res[0] == '\0') {
return 0; return 0;
} }
printf("%s\n", res); printf("%s\n", res);
free(res); free(res);
} }
} else if (argv[1] == "--remove-modules"sv) { } else if (argv[1] == "--remove-modules"sv) {
int fd = connect_daemon(); int fd = connect_daemon();
write_int(fd, REMOVE_MODULES); write_int(fd, REMOVE_MODULES);
return read_int(fd); return read_int(fd);
} else if (argv[1] == "--path"sv) { } else if (argv[1] == "--path"sv) {
int fd = connect_daemon(); int fd = connect_daemon();
write_int(fd, GET_PATH); write_int(fd, GET_PATH);
char *path = read_string(fd); char *path = read_string(fd);
printf("%s\n", path); printf("%s\n", path);
return 0; return 0;
} else if (argc >= 3 && argv[1] == "--install-module"sv) { } else if (argc >= 3 && argv[1] == "--install-module"sv) {
install_module(argv[2]); install_module(argv[2]);
} }
#if 0 #if 0
/* Entry point for testing stuffs */ /* Entry point for testing stuffs */
else if (argv[1] == "--test"sv) { else if (argv[1] == "--test"sv) {
return 0; return 0;
} }
#endif #endif
usage(); usage();
} }
This diff is collapsed.
...@@ -15,89 +15,89 @@ using namespace std; ...@@ -15,89 +15,89 @@ using namespace std;
#define EXEC_CON "u:object_r:" SEPOL_EXEC_TYPE ":s0" #define EXEC_CON "u:object_r:" SEPOL_EXEC_TYPE ":s0"
static void restore_syscon(int dirfd) { static void restore_syscon(int dirfd) {
struct dirent *entry; struct dirent *entry;
DIR *dir; DIR *dir;
char *con; char *con;
fgetfilecon(dirfd, &con); fgetfilecon(dirfd, &con);
if (strlen(con) == 0 || strcmp(con, UNLABEL_CON) == 0) if (strlen(con) == 0 || strcmp(con, UNLABEL_CON) == 0)
fsetfilecon(dirfd, SYSTEM_CON); fsetfilecon(dirfd, SYSTEM_CON);
freecon(con); freecon(con);
dir = xfdopendir(dirfd); dir = xfdopendir(dirfd);
while ((entry = xreaddir(dir))) { while ((entry = xreaddir(dir))) {
int fd = openat(dirfd, entry->d_name, O_RDONLY | O_CLOEXEC); int fd = openat(dirfd, entry->d_name, O_RDONLY | O_CLOEXEC);
if (entry->d_type == DT_DIR) { if (entry->d_type == DT_DIR) {
restore_syscon(fd); restore_syscon(fd);
} else if (entry->d_type == DT_REG) { } else if (entry->d_type == DT_REG) {
fgetfilecon(fd, &con); fgetfilecon(fd, &con);
if (con[0] == '\0' || strcmp(con, UNLABEL_CON) == 0) if (con[0] == '\0' || strcmp(con, UNLABEL_CON) == 0)
fsetfilecon(fd, SYSTEM_CON); fsetfilecon(fd, SYSTEM_CON);
freecon(con); freecon(con);
} else if (entry->d_type == DT_LNK) { } else if (entry->d_type == DT_LNK) {
getfilecon_at(dirfd, entry->d_name, &con); getfilecon_at(dirfd, entry->d_name, &con);
if (con[0] == '\0' || strcmp(con, UNLABEL_CON) == 0) if (con[0] == '\0' || strcmp(con, UNLABEL_CON) == 0)
setfilecon_at(dirfd, entry->d_name, con); setfilecon_at(dirfd, entry->d_name, con);
freecon(con); freecon(con);
} }
close(fd); close(fd);
} }
} }
static void restore_magiskcon(int dirfd) { static void restore_magiskcon(int dirfd) {
struct dirent *entry; struct dirent *entry;
DIR *dir; DIR *dir;
fsetfilecon(dirfd, MAGISK_CON); fsetfilecon(dirfd, MAGISK_CON);
fchown(dirfd, 0, 0); fchown(dirfd, 0, 0);
dir = xfdopendir(dirfd); dir = xfdopendir(dirfd);
while ((entry = xreaddir(dir))) { while ((entry = xreaddir(dir))) {
int fd = xopenat(dirfd, entry->d_name, O_RDONLY | O_CLOEXEC); int fd = xopenat(dirfd, entry->d_name, O_RDONLY | O_CLOEXEC);
if (entry->d_type == DT_DIR) { if (entry->d_type == DT_DIR) {
restore_magiskcon(fd); restore_magiskcon(fd);
} else if (entry->d_type) { } else if (entry->d_type) {
fsetfilecon(fd, MAGISK_CON); fsetfilecon(fd, MAGISK_CON);
fchown(fd, 0, 0); fchown(fd, 0, 0);
} }
close(fd); close(fd);
} }
} }
void restorecon() { void restorecon() {
int fd = xopen(SELINUX_CONTEXT, O_WRONLY | O_CLOEXEC); int fd = xopen(SELINUX_CONTEXT, O_WRONLY | O_CLOEXEC);
if (write(fd, ADB_CON, sizeof(ADB_CON)) >= 0) if (write(fd, ADB_CON, sizeof(ADB_CON)) >= 0)
lsetfilecon(SECURE_DIR, ADB_CON); lsetfilecon(SECURE_DIR, ADB_CON);
close(fd); close(fd);
lsetfilecon(MODULEROOT, SYSTEM_CON); lsetfilecon(MODULEROOT, SYSTEM_CON);
fd = xopen(MODULEROOT, O_RDONLY | O_CLOEXEC); fd = xopen(MODULEROOT, O_RDONLY | O_CLOEXEC);
restore_syscon(fd); restore_syscon(fd);
close(fd); close(fd);
fd = xopen(DATABIN, O_RDONLY | O_CLOEXEC); fd = xopen(DATABIN, O_RDONLY | O_CLOEXEC);
restore_magiskcon(fd); restore_magiskcon(fd);
close(fd); close(fd);
} }
void restore_tmpcon() { void restore_tmpcon() {
if (MAGISKTMP == "/system/bin") { if (MAGISKTMP == "/system/bin") {
// Running with emulator.sh // Running with emulator.sh
if (SDK_INT >= 26) if (SDK_INT >= 26)
lsetfilecon("/system/bin/magisk", EXEC_CON); lsetfilecon("/system/bin/magisk", EXEC_CON);
return; return;
} }
if (MAGISKTMP == "/sbin") if (MAGISKTMP == "/sbin")
setfilecon(MAGISKTMP.data(), ROOT_CON); setfilecon(MAGISKTMP.data(), ROOT_CON);
else else
chmod(MAGISKTMP.data(), 0700); chmod(MAGISKTMP.data(), 0700);
auto dir = xopen_dir(MAGISKTMP.data()); auto dir = xopen_dir(MAGISKTMP.data());
int dfd = dirfd(dir.get()); int dfd = dirfd(dir.get());
for (dirent *entry; (entry = xreaddir(dir.get()));) { for (dirent *entry; (entry = xreaddir(dir.get()));) {
if (SDK_INT >= 26 && entry->d_name == "magisk"sv) if (SDK_INT >= 26 && entry->d_name == "magisk"sv)
setfilecon_at(dfd, entry->d_name, EXEC_CON); setfilecon_at(dfd, entry->d_name, EXEC_CON);
else else
setfilecon_at(dfd, entry->d_name, SYSTEM_CON); setfilecon_at(dfd, entry->d_name, SYSTEM_CON);
} }
} }
...@@ -11,139 +11,139 @@ using namespace std; ...@@ -11,139 +11,139 @@ using namespace std;
#define BBEXEC_CMD bbpath(), "sh" #define BBEXEC_CMD bbpath(), "sh"
static const char *bbpath() { static const char *bbpath() {
static string path; static string path;
if (path.empty()) if (path.empty())
path = MAGISKTMP + "/" BBPATH "/busybox"; path = MAGISKTMP + "/" BBPATH "/busybox";
return path.data(); return path.data();
} }
static void set_script_env() { static void set_script_env() {
setenv("ASH_STANDALONE", "1", 1); setenv("ASH_STANDALONE", "1", 1);
char new_path[4096]; char new_path[4096];
sprintf(new_path, "%s:%s", getenv("PATH"), MAGISKTMP.data()); sprintf(new_path, "%s:%s", getenv("PATH"), MAGISKTMP.data());
setenv("PATH", new_path, 1); setenv("PATH", new_path, 1);
}; };
void exec_script(const char *script) { void exec_script(const char *script) {
exec_t exec { exec_t exec {
.pre_exec = set_script_env, .pre_exec = set_script_env,
.fork = fork_no_orphan .fork = fork_no_orphan
}; };
exec_command_sync(exec, BBEXEC_CMD, script); exec_command_sync(exec, BBEXEC_CMD, script);
} }
static timespec pfs_timeout; static timespec pfs_timeout;
#define PFS_SETUP() \ #define PFS_SETUP() \
if (pfs) { \ if (pfs) { \
if (int pid = xfork()) { \ if (int pid = xfork()) { \
if (pid < 0) \ if (pid < 0) \
return; \ return; \
/* In parent process, simply wait for child to finish */ \ /* In parent process, simply wait for child to finish */ \
waitpid(pid, nullptr, 0); \ waitpid(pid, nullptr, 0); \
return; \ return; \
} \ } \
timer_pid = xfork(); \ timer_pid = xfork(); \
if (timer_pid == 0) { \ if (timer_pid == 0) { \
/* In timer process, count down */ \ /* In timer process, count down */ \
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &pfs_timeout, nullptr); \ clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &pfs_timeout, nullptr); \
exit(0); \ exit(0); \
} \ } \
} }
#define PFS_WAIT() \ #define PFS_WAIT() \
if (pfs) { \ if (pfs) { \
/* If we ran out of time, don't block */ \ /* If we ran out of time, don't block */ \
if (timer_pid < 0) \ if (timer_pid < 0) \
continue; \ continue; \
if (int pid = waitpid(-1, nullptr, 0); pid == timer_pid) { \ if (int pid = waitpid(-1, nullptr, 0); pid == timer_pid) { \
LOGW("* post-fs-data scripts blocking phase timeout\n"); \ LOGW("* post-fs-data scripts blocking phase timeout\n"); \
timer_pid = -1; \ timer_pid = -1; \
} \ } \
} }
#define PFS_DONE() \ #define PFS_DONE() \
if (pfs) { \ if (pfs) { \
if (timer_pid > 0) \ if (timer_pid > 0) \
kill(timer_pid, SIGKILL); \ kill(timer_pid, SIGKILL); \
exit(0); \ exit(0); \
} }
void exec_common_scripts(const char *stage) { void exec_common_scripts(const char *stage) {
LOGI("* Running %s.d scripts\n", stage); LOGI("* Running %s.d scripts\n", stage);
char path[4096]; char path[4096];
char *name = path + sprintf(path, SECURE_DIR "/%s.d", stage); char *name = path + sprintf(path, SECURE_DIR "/%s.d", stage);
auto dir = xopen_dir(path); auto dir = xopen_dir(path);
if (!dir) return; if (!dir) return;
bool pfs = stage == "post-fs-data"sv; bool pfs = stage == "post-fs-data"sv;
int timer_pid = -1; int timer_pid = -1;
if (pfs) { if (pfs) {
// Setup timer // Setup timer
clock_gettime(CLOCK_MONOTONIC, &pfs_timeout); clock_gettime(CLOCK_MONOTONIC, &pfs_timeout);
pfs_timeout.tv_sec += POST_FS_DATA_SCRIPT_MAX_TIME; pfs_timeout.tv_sec += POST_FS_DATA_SCRIPT_MAX_TIME;
} }
PFS_SETUP() PFS_SETUP()
*(name++) = '/'; *(name++) = '/';
int dfd = dirfd(dir.get()); int dfd = dirfd(dir.get());
for (dirent *entry; (entry = xreaddir(dir.get()));) { for (dirent *entry; (entry = xreaddir(dir.get()));) {
if (entry->d_type == DT_REG) { if (entry->d_type == DT_REG) {
if (faccessat(dfd, entry->d_name, X_OK, 0) != 0) if (faccessat(dfd, entry->d_name, X_OK, 0) != 0)
continue; continue;
LOGI("%s.d: exec [%s]\n", stage, entry->d_name); LOGI("%s.d: exec [%s]\n", stage, entry->d_name);
strcpy(name, entry->d_name); strcpy(name, entry->d_name);
exec_t exec { exec_t exec {
.pre_exec = set_script_env, .pre_exec = set_script_env,
.fork = pfs ? xfork : fork_dont_care .fork = pfs ? xfork : fork_dont_care
}; };
exec_command(exec, BBEXEC_CMD, path); exec_command(exec, BBEXEC_CMD, path);
PFS_WAIT() PFS_WAIT()
} }
} }
PFS_DONE() PFS_DONE()
} }
// Return if a > b // Return if a > b
static bool timespec_larger(timespec *a, timespec *b) { static bool timespec_larger(timespec *a, timespec *b) {
if (a->tv_sec != b->tv_sec) if (a->tv_sec != b->tv_sec)
return a->tv_sec > b->tv_sec; return a->tv_sec > b->tv_sec;
return a->tv_nsec > b->tv_nsec; return a->tv_nsec > b->tv_nsec;
} }
void exec_module_scripts(const char *stage, const vector<string> &module_list) { void exec_module_scripts(const char *stage, const vector<string> &module_list) {
LOGI("* Running module %s scripts\n", stage); LOGI("* Running module %s scripts\n", stage);
if (module_list.empty()) if (module_list.empty())
return; return;
bool pfs = stage == "post-fs-data"sv; bool pfs = stage == "post-fs-data"sv;
if (pfs) { if (pfs) {
timespec now{}; timespec now{};
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
// If we had already timed out, treat it as service mode // If we had already timed out, treat it as service mode
if (timespec_larger(&now, &pfs_timeout)) if (timespec_larger(&now, &pfs_timeout))
pfs = false; pfs = false;
} }
int timer_pid = -1; int timer_pid = -1;
PFS_SETUP() PFS_SETUP()
char path[4096]; char path[4096];
for (auto &m : module_list) { for (auto &m : module_list) {
const char* module = m.data(); const char* module = m.data();
sprintf(path, MODULEROOT "/%s/%s.sh", module, stage); sprintf(path, MODULEROOT "/%s/%s.sh", module, stage);
if (access(path, F_OK) == -1) if (access(path, F_OK) == -1)
continue; continue;
LOGI("%s: exec [%s.sh]\n", module, stage); LOGI("%s: exec [%s.sh]\n", module, stage);
exec_t exec { exec_t exec {
.pre_exec = set_script_env, .pre_exec = set_script_env,
.fork = pfs ? xfork : fork_dont_care .fork = pfs ? xfork : fork_dont_care
}; };
exec_command(exec, BBEXEC_CMD, path); exec_command(exec, BBEXEC_CMD, path);
PFS_WAIT() PFS_WAIT()
} }
PFS_DONE() PFS_DONE()
} }
constexpr char install_script[] = R"EOF( constexpr char install_script[] = R"EOF(
...@@ -154,23 +154,23 @@ rm -f $APK ...@@ -154,23 +154,23 @@ rm -f $APK
)EOF"; )EOF";
void install_apk(const char *apk) { void install_apk(const char *apk) {
setfilecon(apk, "u:object_r:" SEPOL_FILE_TYPE ":s0"); setfilecon(apk, "u:object_r:" SEPOL_FILE_TYPE ":s0");
exec_t exec { exec_t exec {
.fork = fork_no_orphan .fork = fork_no_orphan
}; };
char cmds[sizeof(install_script) + 4096]; char cmds[sizeof(install_script) + 4096];
sprintf(cmds, install_script, apk); sprintf(cmds, install_script, apk);
exec_command_sync(exec, "/system/bin/sh", "-c", cmds); exec_command_sync(exec, "/system/bin/sh", "-c", cmds);
} }
[[noreturn]] __printflike(2, 3) [[noreturn]] __printflike(2, 3)
static void abort(FILE *fp, const char *fmt, ...) { static void abort(FILE *fp, const char *fmt, ...) {
va_list valist; va_list valist;
va_start(valist, fmt); va_start(valist, fmt);
vfprintf(fp, fmt, valist); vfprintf(fp, fmt, valist);
fprintf(fp, "\n\n"); fprintf(fp, "\n\n");
va_end(valist); va_end(valist);
exit(1); exit(1);
} }
constexpr char install_module_script[] = R"EOF( constexpr char install_module_script[] = R"EOF(
...@@ -181,24 +181,24 @@ exit 0' ...@@ -181,24 +181,24 @@ exit 0'
)EOF"; )EOF";
void install_module(const char *file) { void install_module(const char *file) {
if (getuid() != 0) if (getuid() != 0)
abort(stderr, "Run this command with root"); abort(stderr, "Run this command with root");
if (access(DATABIN, F_OK) || if (access(DATABIN, F_OK) ||
access(DATABIN "/busybox", X_OK) || access(DATABIN "/busybox", X_OK) ||
access(DATABIN "/util_functions.sh", F_OK)) access(DATABIN "/util_functions.sh", F_OK))
abort(stderr, "Incomplete Magisk install"); abort(stderr, "Incomplete Magisk install");
if (access(file, F_OK)) if (access(file, F_OK))
abort(stderr, "'%s' does not exist", file); abort(stderr, "'%s' does not exist", file);
setenv("OUTFD", "1", 1); setenv("OUTFD", "1", 1);
setenv("ZIPFILE", file, 1); setenv("ZIPFILE", file, 1);
setenv("ASH_STANDALONE", "1", 1); setenv("ASH_STANDALONE", "1", 1);
int fd = xopen("/dev/null", O_RDONLY); int fd = xopen("/dev/null", O_RDONLY);
xdup2(fd, STDERR_FILENO); xdup2(fd, STDERR_FILENO);
close(fd); close(fd);
const char *argv[] = { "/system/bin/sh", "-c", install_module_script, nullptr }; const char *argv[] = { "/system/bin/sh", "-c", install_module_script, nullptr };
execve(argv[0], (char **) argv, environ); execve(argv[0], (char **) argv, environ);
abort(stdout, "Failed to execute BusyBox shell"); abort(stdout, "Failed to execute BusyBox shell");
} }
...@@ -7,30 +7,30 @@ ...@@ -7,30 +7,30 @@
#include <utils.hpp> #include <utils.hpp>
static size_t socket_len(sockaddr_un *sun) { static size_t socket_len(sockaddr_un *sun) {
if (sun->sun_path[0]) if (sun->sun_path[0])
return sizeof(sa_family_t) + strlen(sun->sun_path) + 1; return sizeof(sa_family_t) + strlen(sun->sun_path) + 1;
else else
return sizeof(sa_family_t) + strlen(sun->sun_path + 1) + 1; return sizeof(sa_family_t) + strlen(sun->sun_path + 1) + 1;
} }
socklen_t setup_sockaddr(sockaddr_un *sun, const char *name) { socklen_t setup_sockaddr(sockaddr_un *sun, const char *name) {
memset(sun, 0, sizeof(*sun)); memset(sun, 0, sizeof(*sun));
sun->sun_family = AF_UNIX; sun->sun_family = AF_UNIX;
strcpy(sun->sun_path + 1, name); strcpy(sun->sun_path + 1, name);
return socket_len(sun); return socket_len(sun);
} }
int socket_accept(int sockfd, int timeout) { int socket_accept(int sockfd, int timeout) {
struct pollfd pfd = { struct pollfd pfd = {
.fd = sockfd, .fd = sockfd,
.events = POLL_IN .events = POLL_IN
}; };
return xpoll(&pfd, 1, timeout * 1000) <= 0 ? -1 : xaccept4(sockfd, nullptr, nullptr, SOCK_CLOEXEC); return xpoll(&pfd, 1, timeout * 1000) <= 0 ? -1 : xaccept4(sockfd, nullptr, nullptr, SOCK_CLOEXEC);
} }
void get_client_cred(int fd, struct ucred *cred) { void get_client_cred(int fd, struct ucred *cred) {
socklen_t ucred_length = sizeof(*cred); socklen_t ucred_length = sizeof(*cred);
getsockopt(fd, SOL_SOCKET, SO_PEERCRED, cred, &ucred_length); getsockopt(fd, SOL_SOCKET, SO_PEERCRED, cred, &ucred_length);
} }
/* /*
...@@ -43,50 +43,50 @@ void get_client_cred(int fd, struct ucred *cred) { ...@@ -43,50 +43,50 @@ void get_client_cred(int fd, struct ucred *cred) {
* On error the function terminates by calling exit(-1) * On error the function terminates by calling exit(-1)
*/ */
int recv_fd(int sockfd) { int recv_fd(int sockfd) {
// Need to receive data from the message, otherwise don't care about it. // Need to receive data from the message, otherwise don't care about it.
char iovbuf; char iovbuf;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
struct iovec iov = { struct iovec iov = {
.iov_base = &iovbuf, .iov_base = &iovbuf,
.iov_len = 1, .iov_len = 1,
}; };
char cmsgbuf[CMSG_SPACE(sizeof(int))]; char cmsgbuf[CMSG_SPACE(sizeof(int))];
struct msghdr msg = { struct msghdr msg = {
.msg_iov = &iov, .msg_iov = &iov,
.msg_iovlen = 1, .msg_iovlen = 1,
.msg_control = cmsgbuf, .msg_control = cmsgbuf,
.msg_controllen = sizeof(cmsgbuf), .msg_controllen = sizeof(cmsgbuf),
}; };
xrecvmsg(sockfd, &msg, MSG_WAITALL); xrecvmsg(sockfd, &msg, MSG_WAITALL);
// Was a control message actually sent? // Was a control message actually sent?
switch (msg.msg_controllen) { switch (msg.msg_controllen) {
case 0: case 0:
// No, so the file descriptor was closed and won't be used. // No, so the file descriptor was closed and won't be used.
return -1; return -1;
case sizeof(cmsgbuf): case sizeof(cmsgbuf):
// Yes, grab the file descriptor from it. // Yes, grab the file descriptor from it.
break; break;
default: default:
goto error; goto error;
} }
cmsg = CMSG_FIRSTHDR(&msg); cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == nullptr || if (cmsg == nullptr ||
cmsg->cmsg_len != CMSG_LEN(sizeof(int)) || cmsg->cmsg_len != CMSG_LEN(sizeof(int)) ||
cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_level != SOL_SOCKET ||
cmsg->cmsg_type != SCM_RIGHTS) { cmsg->cmsg_type != SCM_RIGHTS) {
error: error:
LOGE("unable to read fd\n"); LOGE("unable to read fd\n");
exit(-1); exit(-1);
} }
return *(int *)CMSG_DATA(cmsg); return *(int *)CMSG_DATA(cmsg);
} }
/* /*
...@@ -99,106 +99,106 @@ error: ...@@ -99,106 +99,106 @@ error:
* but no control message with the FD is sent. * but no control message with the FD is sent.
*/ */
void send_fd(int sockfd, int fd) { void send_fd(int sockfd, int fd) {
// Need to send some data in the message, this will do. // Need to send some data in the message, this will do.
char junk[] = { '\0' }; char junk[] = { '\0' };
struct iovec iov = { struct iovec iov = {
.iov_base = junk, .iov_base = junk,
.iov_len = 1, .iov_len = 1,
}; };
struct msghdr msg = { struct msghdr msg = {
.msg_iov = &iov, .msg_iov = &iov,
.msg_iovlen = 1, .msg_iovlen = 1,
}; };
char cmsgbuf[CMSG_SPACE(sizeof(int))]; char cmsgbuf[CMSG_SPACE(sizeof(int))];
if (fd != -1) { if (fd != -1) {
// Is the file descriptor actually open? // Is the file descriptor actually open?
if (fcntl(fd, F_GETFD) == -1) { if (fcntl(fd, F_GETFD) == -1) {
if (errno != EBADF) { if (errno != EBADF) {
PLOGE("unable to send fd"); PLOGE("unable to send fd");
} }
// It's closed, don't send a control message or sendmsg will EBADF. // It's closed, don't send a control message or sendmsg will EBADF.
} else { } else {
// It's open, send the file descriptor in a control message. // It's open, send the file descriptor in a control message.
msg.msg_control = cmsgbuf; msg.msg_control = cmsgbuf;
msg.msg_controllen = sizeof(cmsgbuf); msg.msg_controllen = sizeof(cmsgbuf);
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_len = CMSG_LEN(sizeof(int));
cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_type = SCM_RIGHTS;
*(int *)CMSG_DATA(cmsg) = fd; *(int *)CMSG_DATA(cmsg) = fd;
} }
} }
xsendmsg(sockfd, &msg, 0); xsendmsg(sockfd, &msg, 0);
} }
int read_int(int fd) { int read_int(int fd) {
int val; int val;
if (xxread(fd, &val, sizeof(val)) != sizeof(val)) if (xxread(fd, &val, sizeof(val)) != sizeof(val))
return -1; return -1;
return val; return val;
} }
int read_int_be(int fd) { int read_int_be(int fd) {
uint32_t val; uint32_t val;
if (xxread(fd, &val, sizeof(val)) != sizeof(val)) if (xxread(fd, &val, sizeof(val)) != sizeof(val))
return -1; return -1;
return ntohl(val); return ntohl(val);
} }
void write_int(int fd, int val) { void write_int(int fd, int val) {
if (fd < 0) return; if (fd < 0) return;
xwrite(fd, &val, sizeof(val)); xwrite(fd, &val, sizeof(val));
} }
void write_int_be(int fd, int val) { void write_int_be(int fd, int val) {
uint32_t nl = htonl(val); uint32_t nl = htonl(val);
xwrite(fd, &nl, sizeof(nl)); xwrite(fd, &nl, sizeof(nl));
} }
static char *rd_str(int fd, int len) { static char *rd_str(int fd, int len) {
char *val = (char *) xmalloc(sizeof(char) * (len + 1)); char *val = (char *) xmalloc(sizeof(char) * (len + 1));
xxread(fd, val, len); xxread(fd, val, len);
val[len] = '\0'; val[len] = '\0';
return val; return val;
} }
char* read_string(int fd) { char* read_string(int fd) {
int len = read_int(fd); int len = read_int(fd);
return rd_str(fd, len); return rd_str(fd, len);
} }
char* read_string_be(int fd) { char* read_string_be(int fd) {
int len = read_int_be(fd); int len = read_int_be(fd);
return rd_str(fd, len); return rd_str(fd, len);
} }
void write_string(int fd, const char *val) { void write_string(int fd, const char *val) {
if (fd < 0) return; if (fd < 0) return;
int len = strlen(val); int len = strlen(val);
write_int(fd, len); write_int(fd, len);
xwrite(fd, val, len); xwrite(fd, val, len);
} }
void write_string_be(int fd, const char *val) { void write_string_be(int fd, const char *val) {
int len = strlen(val); int len = strlen(val);
write_int_be(fd, len); write_int_be(fd, len);
xwrite(fd, val, len); xwrite(fd, val, len);
} }
void write_key_value(int fd, const char *key, const char *val) { void write_key_value(int fd, const char *key, const char *val) {
write_string_be(fd, key); write_string_be(fd, key);
write_string_be(fd, val); write_string_be(fd, val);
} }
void write_key_token(int fd, const char *key, int tok) { void write_key_token(int fd, const char *key, int tok) {
char val[16]; char val[16];
sprintf(val, "%d", tok); sprintf(val, "%d", tok);
write_key_value(fd, key, val); write_key_value(fd, key, val);
} }
This diff is collapsed.
...@@ -54,9 +54,9 @@ extern "C" { ...@@ -54,9 +54,9 @@ extern "C" {
* be built with fewer features to minimize code size. * be built with fewer features to minimize code size.
*/ */
enum xz_mode { enum xz_mode {
XZ_SINGLE, XZ_SINGLE,
XZ_PREALLOC, XZ_PREALLOC,
XZ_DYNALLOC XZ_DYNALLOC
}; };
/** /**
...@@ -110,15 +110,15 @@ enum xz_mode { ...@@ -110,15 +110,15 @@ enum xz_mode {
* is used instead of XZ_BUF_ERROR. * is used instead of XZ_BUF_ERROR.
*/ */
enum xz_ret { enum xz_ret {
XZ_OK, XZ_OK,
XZ_STREAM_END, XZ_STREAM_END,
XZ_UNSUPPORTED_CHECK, XZ_UNSUPPORTED_CHECK,
XZ_MEM_ERROR, XZ_MEM_ERROR,
XZ_MEMLIMIT_ERROR, XZ_MEMLIMIT_ERROR,
XZ_FORMAT_ERROR, XZ_FORMAT_ERROR,
XZ_OPTIONS_ERROR, XZ_OPTIONS_ERROR,
XZ_DATA_ERROR, XZ_DATA_ERROR,
XZ_BUF_ERROR XZ_BUF_ERROR
}; };
/** /**
...@@ -138,13 +138,13 @@ enum xz_ret { ...@@ -138,13 +138,13 @@ enum xz_ret {
* the variables in_pos and out_pos are modified by the XZ code. * the variables in_pos and out_pos are modified by the XZ code.
*/ */
struct xz_buf { struct xz_buf {
const uint8_t *in; const uint8_t *in;
size_t in_pos; size_t in_pos;
size_t in_size; size_t in_size;
uint8_t *out; uint8_t *out;
size_t out_pos; size_t out_pos;
size_t out_size; size_t out_size;
}; };
/** /**
......
...@@ -65,7 +65,7 @@ typedef unsigned char bool; ...@@ -65,7 +65,7 @@ typedef unsigned char bool;
#ifndef __always_inline #ifndef __always_inline
# ifdef __GNUC__ # ifdef __GNUC__
# define __always_inline \ # define __always_inline \
inline __attribute__((__always_inline__)) inline __attribute__((__always_inline__))
# else # else
# define __always_inline inline # define __always_inline inline
# endif # endif
...@@ -75,40 +75,40 @@ typedef unsigned char bool; ...@@ -75,40 +75,40 @@ typedef unsigned char bool;
#ifndef get_unaligned_le32 #ifndef get_unaligned_le32
static inline uint32_t get_unaligned_le32(const uint8_t *buf) static inline uint32_t get_unaligned_le32(const uint8_t *buf)
{ {
return (uint32_t)buf[0] return (uint32_t)buf[0]
| ((uint32_t)buf[1] << 8) | ((uint32_t)buf[1] << 8)
| ((uint32_t)buf[2] << 16) | ((uint32_t)buf[2] << 16)
| ((uint32_t)buf[3] << 24); | ((uint32_t)buf[3] << 24);
} }
#endif #endif
#ifndef get_unaligned_be32 #ifndef get_unaligned_be32
static inline uint32_t get_unaligned_be32(const uint8_t *buf) static inline uint32_t get_unaligned_be32(const uint8_t *buf)
{ {
return (uint32_t)(buf[0] << 24) return (uint32_t)(buf[0] << 24)
| ((uint32_t)buf[1] << 16) | ((uint32_t)buf[1] << 16)
| ((uint32_t)buf[2] << 8) | ((uint32_t)buf[2] << 8)
| (uint32_t)buf[3]; | (uint32_t)buf[3];
} }
#endif #endif
#ifndef put_unaligned_le32 #ifndef put_unaligned_le32
static inline void put_unaligned_le32(uint32_t val, uint8_t *buf) static inline void put_unaligned_le32(uint32_t val, uint8_t *buf)
{ {
buf[0] = (uint8_t)val; buf[0] = (uint8_t)val;
buf[1] = (uint8_t)(val >> 8); buf[1] = (uint8_t)(val >> 8);
buf[2] = (uint8_t)(val >> 16); buf[2] = (uint8_t)(val >> 16);
buf[3] = (uint8_t)(val >> 24); buf[3] = (uint8_t)(val >> 24);
} }
#endif #endif
#ifndef put_unaligned_be32 #ifndef put_unaligned_be32
static inline void put_unaligned_be32(uint32_t val, uint8_t *buf) static inline void put_unaligned_be32(uint32_t val, uint8_t *buf)
{ {
buf[0] = (uint8_t)(val >> 24); buf[0] = (uint8_t)(val >> 24);
buf[1] = (uint8_t)(val >> 16); buf[1] = (uint8_t)(val >> 16);
buf[2] = (uint8_t)(val >> 8); buf[2] = (uint8_t)(val >> 8);
buf[3] = (uint8_t)val; buf[3] = (uint8_t)val;
} }
#endif #endif
......
...@@ -29,31 +29,31 @@ STATIC_RW_DATA uint32_t xz_crc32_table[256]; ...@@ -29,31 +29,31 @@ STATIC_RW_DATA uint32_t xz_crc32_table[256];
XZ_EXTERN void xz_crc32_init(void) XZ_EXTERN void xz_crc32_init(void)
{ {
const uint32_t poly = 0xEDB88320; const uint32_t poly = 0xEDB88320;
uint32_t i; uint32_t i;
uint32_t j; uint32_t j;
uint32_t r; uint32_t r;
for (i = 0; i < 256; ++i) { for (i = 0; i < 256; ++i) {
r = i; r = i;
for (j = 0; j < 8; ++j) for (j = 0; j < 8; ++j)
r = (r >> 1) ^ (poly & ~((r & 1) - 1)); r = (r >> 1) ^ (poly & ~((r & 1) - 1));
xz_crc32_table[i] = r; xz_crc32_table[i] = r;
} }
return; return;
} }
XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc) XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
{ {
crc = ~crc; crc = ~crc;
while (size != 0) { while (size != 0) {
crc = xz_crc32_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8); crc = xz_crc32_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
--size; --size;
} }
return ~crc; return ~crc;
} }
This diff is collapsed.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# include <linux/crc32.h> # include <linux/crc32.h>
# undef crc32 # undef crc32
# define xz_crc32(buf, size, crc) \ # define xz_crc32(buf, size, crc) \
(~crc32_le(~(uint32_t)(crc), buf, size)) (~crc32_le(~(uint32_t)(crc), buf, size))
#endif #endif
/* /*
...@@ -50,10 +50,10 @@ typedef uint64_t vli_type; ...@@ -50,10 +50,10 @@ typedef uint64_t vli_type;
/* Integrity Check types */ /* Integrity Check types */
enum xz_check { enum xz_check {
XZ_CHECK_NONE = 0, XZ_CHECK_NONE = 0,
XZ_CHECK_CRC32 = 1, XZ_CHECK_CRC32 = 1,
XZ_CHECK_CRC64 = 4, XZ_CHECK_CRC64 = 4,
XZ_CHECK_SHA256 = 10 XZ_CHECK_SHA256 = 10
}; };
/* Maximum possible Check ID */ /* Maximum possible Check ID */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
int setprop(const char *name, const char *value, bool prop_svc = true); int setprop(const char *name, const char *value, bool prop_svc = true);
std::string getprop(const char *name, bool persist = false); std::string getprop(const char *name, bool persist = false);
void getprops(void (*callback)(const char *, const char *, void *), void getprops(void (*callback)(const char *, const char *, void *),
void *cookie = nullptr, bool persist = false); void *cookie = nullptr, bool persist = false);
int delprop(const char *name, bool persist = false); int delprop(const char *name, bool persist = false);
void load_prop_file(const char *filename, bool prop_svc = true); void load_prop_file(const char *filename, bool prop_svc = true);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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