Migrate resetprop to Rust

This commit is contained in:
topjohnwu
2025-08-27 22:48:48 -07:00
committed by John Wu
parent 42d9f87bc9
commit c4e2985677
21 changed files with 678 additions and 655 deletions
+5
View File
@@ -17,6 +17,11 @@
#define to_app_id(uid) (uid % AID_USER_OFFSET)
#define to_user_id(uid) (uid / AID_USER_OFFSET)
// Multi-call entrypoints
int magisk_main(int argc, char *argv[]);
int su_client_main(int argc, char *argv[]);
int zygisk_main(int argc, char *argv[]);
// Return codes for daemon
enum class RespondCode : int {
ERROR = -1,
-30
View File
@@ -1,30 +0,0 @@
#pragma once
#include <string>
#include <cxx.h>
struct prop_info;
struct prop_callback {
virtual ~prop_callback() = default;
virtual void exec(const char *name, const char *value, uint32_t serial) = 0;
void exec(Utf8CStr name, Utf8CStr value) {
exec(name.data(), value.data(), INT_MAX);
}
void read(const prop_info *pi);
};
// System properties
std::string get_prop(const char *name, bool persist = false);
int delete_prop(const char *name, bool persist = false);
int set_prop(const char *name, const char *value, bool skip_svc = false);
void load_prop_file(const char *filename, bool skip_svc = false);
// Rust bindings
rust::String get_prop_rs(Utf8CStr name, bool persist);
static inline int set_prop_rs(Utf8CStr name, Utf8CStr value, bool skip_svc) {
return set_prop(name.data(), value.data(), skip_svc);
}
static inline void load_prop_file_rs(Utf8CStr filename, bool skip_svc) {
load_prop_file(filename.data(), skip_svc);
}