From: Sasha Levin Subject: [RFC 03/10] zcache: export zcache interface Date: Wed, 6 Jun 2012 13:00:11 +0200 Message-ID: <1338980418-2519-3-git-send-email-levinsasha928@gmail.com> References: <1338980418-2519-1-git-send-email-levinsasha928@gmail.com> Cc: kvm@vger.kernel.org, Sasha Levin To: avi@redhat.com, mtosatti@redhat.com, gregkh@linuxfoundation.org, sjenning@linux.vnet.ibm.com, dan.magenheimer@oracle.com, konrad.wilk@oracle.com Return-path: Received: from mail-gg0-f174.google.com ([209.85.161.174]:59095 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753006Ab2FFK7b (ORCPT ); Wed, 6 Jun 2012 06:59:31 -0400 Received: by gglu4 with SMTP id u4so4804222ggl.19 for ; Wed, 06 Jun 2012 03:59:30 -0700 (PDT) In-Reply-To: <1338980418-2519-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: This patch exports the zcache interface to be used from the outside world. Signed-off-by: Sasha Levin --- drivers/staging/zcache/zcache-main.c | 13 +++++++------ drivers/staging/zcache/zcache.h | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 drivers/staging/zcache/zcache.h diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 784c796..a196aff 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -32,6 +32,7 @@ #include #include #include "tmem.h" +#include "zcache.h" #include "../zsmalloc/zsmalloc.h" @@ -1563,7 +1564,7 @@ static struct shrinker zcache_shrinker = { * zcache shims between cleancache/frontswap ops and tmem */ -static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp, +int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp, uint32_t index, struct page *page) { struct tmem_pool *pool; @@ -1596,7 +1597,7 @@ out: return ret; } -static int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp, +int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp, uint32_t index, struct page *page) { struct tmem_pool *pool; @@ -1616,7 +1617,7 @@ static int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp, return ret; } -static int zcache_flush_page(int cli_id, int pool_id, +int zcache_flush_page(int cli_id, int pool_id, struct tmem_oid *oidp, uint32_t index) { struct tmem_pool *pool; @@ -1637,7 +1638,7 @@ static int zcache_flush_page(int cli_id, int pool_id, return ret; } -static int zcache_flush_object(int cli_id, int pool_id, +int zcache_flush_object(int cli_id, int pool_id, struct tmem_oid *oidp) { struct tmem_pool *pool; @@ -1658,7 +1659,7 @@ static int zcache_flush_object(int cli_id, int pool_id, return ret; } -static int zcache_destroy_pool(int cli_id, int pool_id) +int zcache_destroy_pool(int cli_id, int pool_id) { struct tmem_pool *pool = NULL; struct zcache_client *cli = NULL; @@ -1941,7 +1942,7 @@ struct frontswap_ops zcache_frontswap_register_ops(void) * NOTHING HAPPENS! */ -static int zcache_enabled; +int zcache_enabled; static int __init enable_zcache(char *s) { diff --git a/drivers/staging/zcache/zcache.h b/drivers/staging/zcache/zcache.h new file mode 100644 index 0000000..ec06ea2 --- /dev/null +++ b/drivers/staging/zcache/zcache.h @@ -0,0 +1,17 @@ +#ifndef _ZCACHE_H_ +#define _ZCACHE_H_ + +extern int zcache_enabled; + +extern int zcache_new_pool(uint16_t cli_id, uint32_t flags); +extern int zcache_destroy_pool(int cli_id, int pool_id); +extern int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp, + uint32_t index, struct page *page); +extern int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp, + uint32_t index, struct page *page); +extern int zcache_flush_page(int cli_id, int pool_id, + struct tmem_oid *oidp, uint32_t index); +extern int zcache_flush_object(int cli_id, int pool_id, + struct tmem_oid *oidp); + +#endif -- 1.7.8.6