/* * Compressed RAM block device * * Copyright (C) 2008, 2009, 2010 Nitin Gupta * 2012, 2013 Minchan Kim * * This code is released using a dual license strategy: BSD/GPL * You can choose the licence that better fits your requirements. * * Released under the terms of 3-clause BSD License * Released under the terms of GNU General Public License Version 2.0 * */ #ifndef _ZRAM_DRV_H_ #define _ZRAM_DRV_H_ #include <linux/rwsem.h> #include <linux/zsmalloc.h> #include <linux/crypto.h> #include "zcomp.h" #define SECTORS_PER_PAGE_SHIFT … #define SECTORS_PER_PAGE … #define ZRAM_LOGICAL_BLOCK_SHIFT … #define ZRAM_LOGICAL_BLOCK_SIZE … #define ZRAM_SECTOR_PER_LOGICAL_BLOCK … /* * ZRAM is mainly used for memory efficiency so we want to keep memory * footprint small and thus squeeze size and zram pageflags into a flags * member. The lower ZRAM_FLAG_SHIFT bits is for object size (excluding * header), which cannot be larger than PAGE_SIZE (requiring PAGE_SHIFT * bits), the higher bits are for zram_pageflags. * * We use BUILD_BUG_ON() to make sure that zram pageflags don't overflow. */ #define ZRAM_FLAG_SHIFT … /* Only 2 bits are allowed for comp priority index */ #define ZRAM_COMP_PRIORITY_MASK … /* Flags for zram pages (table[page_no].flags) */ enum zram_pageflags { … }; /*-- Data structures */ /* Allocated for each disk page */ struct zram_table_entry { … }; struct zram_stats { … }; #ifdef CONFIG_ZRAM_MULTI_COMP #define ZRAM_PRIMARY_COMP … #define ZRAM_SECONDARY_COMP … #define ZRAM_MAX_COMPS … #else #define ZRAM_PRIMARY_COMP … #define ZRAM_SECONDARY_COMP … #define ZRAM_MAX_COMPS … #endif struct zram { … }; #endif