aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/zram-swap/files
diff options
context:
space:
mode:
authorConn O'Griofa <connogriofa@gmail.com>2016-07-24 17:18:39 +0100
committerJohn Crispin <john@phrozen.org>2016-09-05 07:12:00 +0200
commitf362dc154d776630fd0c02062b50e9f02d57476f (patch)
tree86dfa464e783f392e41a346885b4197898eb3cc8 /package/system/zram-swap/files
parent911b6ca234d6d924709be27392736de9a741604d (diff)
downloadupstream-f362dc154d776630fd0c02062b50e9f02d57476f.tar.gz
upstream-f362dc154d776630fd0c02062b50e9f02d57476f.tar.bz2
upstream-f362dc154d776630fd0c02062b50e9f02d57476f.zip
zram-swap: CONFIG_PROCD_ZRAM_TMPFS compatibility
Enable CONFIG_PROCD_ZRAM_TMPFS compatibility via two changes to list_cpu_idx(): * detect if /tmp is being used by /dev/zram0; if yes, offset initial value by 1 to skip first zram device. * hot-add /dev/zram1, if not already present. Signed-off-by: Conn O'Griofa >connogriofa@gmail.com>
Diffstat (limited to 'package/system/zram-swap/files')
-rw-r--r--package/system/zram-swap/files/zram.init13
1 files changed, 11 insertions, 2 deletions
diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 23de915c8f..431e47c8f9 100644
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -71,8 +71,17 @@ zram_reset()
list_cpu_idx()
{
- local line i=0
-
+ # Offset by 1 if /dev/zram0 is in use by /tmp
+ if [ "$(mount | grep /dev/zram0)" ]; then
+ local line i=1
+ # Hot-add new ZRAM device (if necessary)
+ if [ ! -b /dev/zram1 ]; then
+ cat /sys/class/zram-control/hot_add
+ fi
+ else
+ local line i=0
+ fi
+
while read line; do {
case "$line" in
[Pp]rocessor*)