From: Mikhail Zaslonko <zaslonko@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Eduard Shishkin <edward6@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
zaslonko@linux.ibm.com
Subject: [PATCH v2 5/6] lib/zlib: Add zlib_deflate_dfltcc_enabled() function
Date: Mon, 9 Dec 2019 16:29:47 +0100 [thread overview]
Message-ID: <20191209152948.37080-6-zaslonko@linux.ibm.com> (raw)
In-Reply-To: <20191209152948.37080-1-zaslonko@linux.ibm.com>
Add a new function to zlib.h checking if s390 Deflate-Conversion facility
is installed and enabled.
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
---
include/linux/zlib.h | 6 ++++++
lib/zlib_deflate/deflate.c | 6 ++++++
lib/zlib_deflate/deflate_syms.c | 1 +
lib/zlib_dfltcc/dfltcc.h | 3 +++
4 files changed, 16 insertions(+)
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 92dbbd3f6c75..c757d848a758 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -191,6 +191,12 @@ extern int zlib_deflate_workspacesize (int windowBits, int memLevel);
exceed those passed here.
*/
+extern int zlib_deflate_dfltcc_enabled (void);
+/*
+ Returns 1 if Deflate-Conversion facility is installed and enabled,
+ otherwise 0.
+*/
+
/*
extern int deflateInit (z_streamp strm, int level);
diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c
index 9595b32b944a..52177d8527f9 100644
--- a/lib/zlib_deflate/deflate.c
+++ b/lib/zlib_deflate/deflate.c
@@ -59,6 +59,7 @@
#define DEFLATE_RESET_HOOK(strm) do {} while (0)
#define DEFLATE_HOOK(strm, flush, bstate) 0
#define DEFLATE_NEED_CHECKSUM(strm) 1
+#define DEFLATE_DFLTCC_ENABLED() 0
#endif
/* ===========================================================================
@@ -1138,3 +1139,8 @@ int zlib_deflate_workspacesize(int windowBits, int memLevel)
+ zlib_deflate_head_memsize(memLevel)
+ zlib_deflate_overlay_memsize(memLevel);
}
+
+int zlib_deflate_dfltcc_enabled(void)
+{
+ return DEFLATE_DFLTCC_ENABLED();
+}
diff --git a/lib/zlib_deflate/deflate_syms.c b/lib/zlib_deflate/deflate_syms.c
index 72fe4b73be53..24b740b99678 100644
--- a/lib/zlib_deflate/deflate_syms.c
+++ b/lib/zlib_deflate/deflate_syms.c
@@ -12,6 +12,7 @@
#include <linux/zlib.h>
EXPORT_SYMBOL(zlib_deflate_workspacesize);
+EXPORT_SYMBOL(zlib_deflate_dfltcc_enabled);
EXPORT_SYMBOL(zlib_deflate);
EXPORT_SYMBOL(zlib_deflateInit2);
EXPORT_SYMBOL(zlib_deflateEnd);
diff --git a/lib/zlib_dfltcc/dfltcc.h b/lib/zlib_dfltcc/dfltcc.h
index be70c807b62f..1bd9709416fb 100644
--- a/lib/zlib_dfltcc/dfltcc.h
+++ b/lib/zlib_dfltcc/dfltcc.h
@@ -3,6 +3,7 @@
#define DFLTCC_H
#include "../zlib_deflate/defutil.h"
+#include "dfltcc_util.h"
/*
* Tuning parameters.
@@ -121,6 +122,8 @@ dfltcc_inflate_action dfltcc_inflate(z_streamp strm,
#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm)))
+#define DEFLATE_DFLTCC_ENABLED() is_dfltcc_enabled()
+
#define INFLATE_RESET_HOOK(strm) \
dfltcc_reset((strm), sizeof(struct inflate_state))
--
2.17.1
next prev parent reply other threads:[~2019-12-09 15:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 15:29 [PATCH v2 0/6] S390 hardware compression support for kernel zlib Mikhail Zaslonko
2019-12-09 15:29 ` [PATCH v2 1/6] lib/zlib: Add s390 hardware support for kernel zlib_deflate Mikhail Zaslonko
2019-12-09 15:29 ` [PATCH v2 2/6] s390/boot: Rename HEAP_SIZE due to name collision Mikhail Zaslonko
2019-12-09 15:29 ` [PATCH v2 3/6] lib/zlib: Add s390 hardware support for kernel zlib_inflate Mikhail Zaslonko
2019-12-09 15:29 ` [PATCH v2 4/6] s390/boot: Add dfltcc= kernel command line parameter Mikhail Zaslonko
2019-12-09 15:29 ` Mikhail Zaslonko [this message]
2019-12-09 15:29 ` [PATCH v2 6/6] btrfs: Use larger zlib buffer for s390 hardware compression Mikhail Zaslonko
2019-12-13 16:10 ` Zaslonko Mikhail
2019-12-13 17:35 ` David Sterba
2019-12-16 16:31 ` Zaslonko Mikhail
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191209152948.37080-6-zaslonko@linux.ibm.com \
--to=zaslonko@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=borntraeger@de.ibm.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=edward6@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=josef@toxicpanda.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).