diff options
author | Abaakouk Mehdi <theli48@gmail.com> | 2011-04-04 15:36:58 +0200 |
---|---|---|
committer | Abaakouk Mehdi <theli48@gmail.com> | 2011-04-04 15:36:58 +0200 |
commit | f92561b3de70d6a007846707e60fab6e5a1775f8 (patch) | |
tree | 12dd1fc8f3dcf72089ae0313724d2089a4d54ff4 /prebuilt/common/bin | |
parent | df5b82a4f281cbe183d9fcfbe4e4f315371b963c (diff) | |
download | vendor_replicant-f92561b3de70d6a007846707e60fab6e5a1775f8.zip vendor_replicant-f92561b3de70d6a007846707e60fab6e5a1775f8.tar.gz vendor_replicant-f92561b3de70d6a007846707e60fab6e5a1775f8.tar.bz2 |
Add support for old and new compcache module
Change-Id: Iff0109f863114307fc34203819ef241a5efe1656
Diffstat (limited to 'prebuilt/common/bin')
-rwxr-xr-x | prebuilt/common/bin/compcache | 33 | ||||
-rwxr-xr-x | prebuilt/common/bin/handle_compcache | 2 |
2 files changed, 25 insertions, 10 deletions
diff --git a/prebuilt/common/bin/compcache b/prebuilt/common/bin/compcache index 388e388..36540c2 100755 --- a/prebuilt/common/bin/compcache +++ b/prebuilt/common/bin/compcache @@ -4,17 +4,28 @@ # shade@chemlab.org (cyanogen) # -DEV=/dev/block/zram0 -SYSFS_PATH=/sys/block/zram0 -MODULE=zram +isramzswap="$(ls -1 /system/lib/modules/2.6.*/kernel/drivers/staging/ramzswap/ramzswap.ko 2>/dev/null)" + +if [ -n "$isramzswap" ] ; then + MODULE=ramzswap + DEV=/dev/block/ramzswap0 +else + DEV=/dev/block/zram0 + MODULE=zram + SYSFS_PATH=/sys/block/zram0 +fi case "$1" in start) echo 3 > /proc/sys/vm/drop_caches echo 30 > /proc/sys/vm/swappiness modprobe $MODULE - echo "$2" > $SYSFS_PATH/disksize - mkswap $DEV >/dev/null + if [ $MODULE = ramzswap ]; then + rzscontrol $DEV --disksize_kb=$2 --init + else + echo "$((2 * 1024))" > $SYSFS_PATH/disksize + mkswap $DEV >/dev/null + fi swapon $DEV ;; @@ -23,10 +34,14 @@ case "$1" in rmmod $MODULE >/dev/null 2>&1 ;; stats) - cd $SYSFS_PATH && for i in * ; do - echo -n "$i:" - cat $i - done + if [ $MODULE = ramzswap ]; then + rzscontrol $DEV --stats + else + cd $SYSFS_PATH && for i in * ; do + echo -n "$i:" + cat $i + done + fi ;; *) echo "Usage: $0 {start <size>|stop|stats}" diff --git a/prebuilt/common/bin/handle_compcache b/prebuilt/common/bin/handle_compcache index 00b97d6..44ab0b7 100755 --- a/prebuilt/common/bin/handle_compcache +++ b/prebuilt/common/bin/handle_compcache @@ -21,7 +21,7 @@ fi if [ $PROP != 0 ] then - CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100 * 1024)) + CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100)) `dirname $0`/compcache start $CCSIZE else `dirname $0`/compcache stop |