Steve Kondik | 2dc24f6 | 2010-07-06 00:19:10 -0400 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | # |
| 3 | # Compcache manager |
| 4 | # shade@chemlab.org (cyanogen) |
| 5 | # |
| 6 | |
| 7 | DEV=/dev/block/ramzswap0 |
| 8 | MODULE=ramzswap |
| 9 | MODULES_DIR=/system/modules/lib/modules/`uname -r` |
| 10 | |
| 11 | case "$1" in |
| 12 | start) |
| 13 | echo 3 > /proc/sys/vm/drop_caches |
| 14 | modprobe $MODULE |
Wes Garner | 2f1711d | 2010-08-31 18:04:01 -0500 | [diff] [blame^] | 15 | rzscontrol $DEV --disksize_kb=$2 --init |
Steve Kondik | 2dc24f6 | 2010-07-06 00:19:10 -0400 | [diff] [blame] | 16 | swapon $DEV |
| 17 | ;; |
| 18 | |
| 19 | stop) |
| 20 | swapoff $DEV >/dev/null 2>&1 |
| 21 | rmmod $MODULE >/dev/null 2>&1 |
| 22 | ;; |
| 23 | stats) |
| 24 | rzscontrol $DEV --stats |
| 25 | ;; |
| 26 | *) |
Wes Garner | 2f1711d | 2010-08-31 18:04:01 -0500 | [diff] [blame^] | 27 | echo "Usage: $0 {start <size>|stop|stats}" |
Steve Kondik | 2dc24f6 | 2010-07-06 00:19:10 -0400 | [diff] [blame] | 28 | exit 1 |
| 29 | esac |
| 30 | |
| 31 | exit 0 |
| 32 | |