summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2014-12-28 01:53:02 +0100
committerDees Troy <dees_troy@teamw.in>2014-12-29 17:11:59 +0100
commitfcdb76dd057918d147cf3b1307a7ee18f65299f5 (patch)
tree5dc88f496a54b3c871d3e5de5efd13fd9b511b14 /twrp-functions.cpp
parentmtp: get rid of string streams, reduces binary size a bit (diff)
downloadandroid_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.tar
android_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.tar.gz
android_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.tar.bz2
android_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.tar.lz
android_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.tar.xz
android_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.tar.zst
android_bootable_recovery-fcdb76dd057918d147cf3b1307a7ee18f65299f5.zip
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp124
1 files changed, 0 insertions, 124 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;