2 * Compressed RAM based swap device
4 * Copyright (C) 2008, 2009 Nitin Gupta
6 * This code is released using a dual license strategy: BSD/GPL
7 * You can choose the licence that better fits your requirements.
9 * Released under the terms of 3-clause BSD License
10 * Released under the terms of GNU General Public License Version 2.0
12 * Project home: http://compcache.googlecode.com
15 #ifndef _RAMZSWAP_IOCTL_H_
16 #define _RAMZSWAP_IOCTL_H_
18 #define MAX_SWAP_NAME_LEN 128
20 struct ramzswap_ioctl_stats
{
21 char backing_swap_name
[MAX_SWAP_NAME_LEN
];
22 u64 memlimit
; /* only applicable if backing swap present */
23 u64 disksize
; /* user specified or equal to backing swap
24 * size (if present) */
25 u64 num_reads
; /* failed + successful */
26 u64 num_writes
; /* --do-- */
27 u64 failed_reads
; /* can happen when memory is too low */
28 u64 failed_writes
; /* should NEVER! happen */
29 u64 invalid_io
; /* non-swap I/O requests */
30 u32 pages_zero
; /* no. of zero filled pages */
31 u32 good_compress_pct
; /* no. of pages with compression ratio<=50% */
32 u32 pages_expand_pct
; /* no. of incompressible pages */
38 u64 bdev_num_reads
; /* no. of reads on backing dev */
39 u64 bdev_num_writes
; /* no. of writes on backing dev */
40 } __attribute__ ((packed
, aligned(4)));
42 #define RZSIO_SET_DISKSIZE_KB _IOW('z', 0, size_t)
43 #define RZSIO_SET_MEMLIMIT_KB _IOW('z', 1, size_t)
44 #define RZSIO_SET_BACKING_SWAP _IOW('z', 2, unsigned char[MAX_SWAP_NAME_LEN])
45 #define RZSIO_GET_STATS _IOR('z', 3, struct ramzswap_ioctl_stats)
46 #define RZSIO_INIT _IO('z', 4)
47 #define RZSIO_RESET _IO('z', 5)