Staging: zram: Replace ioctls with sysfs interface
authorNitin Gupta <ngupta@vflare.org>
Mon, 9 Aug 2010 17:26:47 +0000 (22:56 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 31 Aug 2010 22:33:54 +0000 (15:33 -0700)
commit33863c21e69e9bd988b63580ada0b729c1d90215
tree75b4416212d83929e519c7be058a005ea5e5a917
parente1a164d7a3e05aae15eb603ee8f1b77446480a3b
Staging: zram: Replace ioctls with sysfs interface

Creates per-device sysfs nodes in /sys/block/zram<id>/
Currently following stats are exported:
 - disksize
 - num_reads
 - num_writes
 - invalid_io
 - zero_pages
 - orig_data_size
 - compr_data_size
 - mem_used_total

By default, disksize is set to 0. So, to start using
a zram device, fist write a disksize value and then
initialize device by writing any positive value to
initstate. For example:

        # initialize /dev/zram0 with 50MB disksize
        echo 50*1024*1024 | bc > /sys/block/zram0/disksize
        echo 1 > /sys/block/zram0/initstate

When done using a disk, issue reset to free its memory
by writing any positive value to reset node:

        echo 1 > /sys/block/zram0/reset

This change also obviates the need for 'rzscontrol' utility.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/zram/Kconfig
drivers/staging/zram/Makefile
drivers/staging/zram/zram_drv.c
drivers/staging/zram/zram_drv.h
drivers/staging/zram/zram_ioctl.h [deleted file]
drivers/staging/zram/zram_sysfs.c [new file with mode: 0644]