]> git.karo-electronics.de Git - karo-tx-linux.git/commit
zram: do not let user enforce new device dev_id
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tue, 7 Apr 2015 23:44:46 +0000 (09:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 7 Apr 2015 23:44:46 +0000 (09:44 +1000)
commit0b09ec4107036207856474e593504e8b43896f5b
tree77f8209f50b8f4a9faa9bb6d3fa80344eb033b92
parent4e7079207d994ce66d1b813bc78db3ec5a486bd0
zram: do not let user enforce new device dev_id

This patch forbids user to enforce device ids for newly added zram
devices, as suggested by Minchan Kim.  There seems to be a little interest
in this functionality and its use-cases are rather non-obvious.

zram_add sysfs attr, thus, is now read only and has only automatic device
id assignment mode.

This operation is no longer allowed:
   echo 1 > /sys/class/zram-control/zram_add
   -bash: /sys/class/zram-control/zram_add: Permission denied

Correct usage example:
   cat /sys/class/zram-control/zram_add
   2

It also removes common zram_control() handler because device creation and
removal do not share a lot of common steps anymore.  Move zram_add and
zram_remove code to zram_add_show() and zram_remove_store()
correspondingly.

LKML reference: https://lkml.org/lkml/2015/3/4/1414

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reported-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/ABI/testing/sysfs-class-zram
Documentation/blockdev/zram.txt
drivers/block/zram/zram_drv.c