diff options
-rw-r--r-- | twrp-functions.cpp | 124 | ||||
-rw-r--r-- | twrp-functions.hpp | 2 |
2 files changed, 0 insertions, 126 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 4a7b340a5..50f05a70a 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -729,130 +729,6 @@ int32_t TWFunc::timespec_diff_ms(timespec& start, timespec& end) ((start.tv_sec * 1000) + start.tv_nsec/1000000); } -int TWFunc::drop_caches(void) { - string file = "/proc/sys/vm/drop_caches"; - string value = "3"; - if (write_file(file, value) != 0) - return -1; - return 0; -} - -int TWFunc::tw_chmod(const string& fn, const string& mode) { - long mask = 0; - std::string::size_type n = mode.length(); - int cls = 0; - - if(n == 3) - ++cls; - else if(n != 4) - { - LOGERR("TWFunc::tw_chmod used with %u long mode string (should be 3 or 4)!\n", mode.length()); - return -1; - } - - for (n = 0; n < mode.length(); ++n, ++cls) { - if (cls == 0) { - if (mode[n] == '0') - continue; - else if (mode[n] == '1') - mask |= S_ISVTX; - else if (mode[n] == '2') - mask |= S_ISGID; - else if (mode[n] == '4') - mask |= S_ISUID; - else if (mode[n] == '5') { - mask |= S_ISVTX; - mask |= S_ISUID; - } - else if (mode[n] == '6') { - mask |= S_ISGID; - mask |= S_ISUID; - } - else if (mode[n] == '7') { - mask |= S_ISVTX; - mask |= S_ISGID; - mask |= S_ISUID; - } - } - else if (cls == 1) { - if (mode[n] == '7') { - mask |= S_IRWXU; - } - else if (mode[n] == '6') { - mask |= S_IRUSR; - mask |= S_IWUSR; - } - else if (mode[n] == '5') { - mask |= S_IRUSR; - mask |= S_IXUSR; - } - else if (mode[n] == '4') - mask |= S_IRUSR; - else if (mode[n] == '3') { - mask |= S_IWUSR; - mask |= S_IRUSR; - } - else if (mode[n] == '2') - mask |= S_IWUSR; - else if (mode[n] == '1') - mask |= S_IXUSR; - } - else if (cls == 2) { - if (mode[n] == '7') { - mask |= S_IRWXG; - } - else if (mode[n] == '6') { - mask |= S_IRGRP; - mask |= S_IWGRP; - } - else if (mode[n] == '5') { - mask |= S_IRGRP; - mask |= S_IXGRP; - } - else if (mode[n] == '4') - mask |= S_IRGRP; - else if (mode[n] == '3') { - mask |= S_IWGRP; - mask |= S_IXGRP; - } - else if (mode[n] == '2') - mask |= S_IWGRP; - else if (mode[n] == '1') - mask |= S_IXGRP; - } - else if (cls == 3) { - if (mode[n] == '7') { - mask |= S_IRWXO; - } - else if (mode[n] == '6') { - mask |= S_IROTH; - mask |= S_IWOTH; - } - else if (mode[n] == '5') { - mask |= S_IROTH; - mask |= S_IXOTH; - } - else if (mode[n] == '4') - mask |= S_IROTH; - else if (mode[n] == '3') { - mask |= S_IWOTH; - mask |= S_IXOTH; - } - else if (mode[n] == '2') - mask |= S_IWOTH; - else if (mode[n] == '1') - mask |= S_IXOTH; - } - } - - if (chmod(fn.c_str(), mask) != 0) { - LOGERR("Unable to chmod '%s' %l\n", fn.c_str(), mask); - return -1; - } - - return 0; -} - bool TWFunc::Install_SuperSU(void) { if (!PartitionManager.Mount_By_Path("/system", true)) return false; diff --git a/twrp-functions.hpp b/twrp-functions.hpp index 36cfff5b8..c10a184e6 100644 --- a/twrp-functions.hpp +++ b/twrp-functions.hpp @@ -72,8 +72,6 @@ public: static int read_file(string fn, string& results); //read from file static int read_file(string fn, uint64_t& results); //read from file static int write_file(string fn, string& line); //write from file - static int drop_caches(void); //drop linux cache memory - static int tw_chmod(const string& fn, const string& mode); // chmod function that converts a 3 or 4 char string into st_mode automatically static bool Install_SuperSU(void); // Installs su binary and apk and sets proper permissions static bool Try_Decrypting_Backup(string Restore_Path, string Password); // true for success, false for failed to decrypt static string System_Property_Get(string Prop_Name); // Returns value of Prop_Name from reading /system/build.prop |