/* * uncompress.c * * (C) Copyright 1999 Linus Torvalds * * cramfs interfaces to the uncompression library. There's really just * three entrypoints: * * - cramfs_uncompress_init() - called to initialize the thing. * - cramfs_uncompress_exit() - tell me when you're done * - cramfs_uncompress_block() - uncompress a block. * * NOTE NOTE NOTE! The uncompression is entirely single-threaded. We * only have one stream, and we'll initialize it only once even if it * then is used by multiple filesystems. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include #include #include #include #include "internal.h" static z_stream stream; static int initialized; /* Returns length of decompressed data. */ int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen) { int err; stream.next_in = src; stream.avail_in = srclen; stream.next_out = dst; stream.avail_out = dstlen; err = zlib_inflateReset(&stream); if (err != Z_OK) { pr_err("zlib_inflateReset error %d\n", err); zlib_inflateEnd(&stream); zlib_inflateInit(&stream); } err = zlib_inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) goto err; return stream.total_out; err: pr_err("Error %d while decompressing!\n", err); pr_err("%p(%d)->%p(%d)\n", src, srclen, dst, dstlen); return -EIO; } int cramfs_uncompress_init(void) { if (!initialized++) { stream.workspace = vmalloc(zlib_inflate_workspacesize()); if (!stream.workspace) { initialized = 0; return -ENOMEM; } stream.next_in = NULL; stream.avail_in = 0; zlib_inflateInit(&stream); } return 0; } void cramfs_uncompress_exit(void) { if (!--initialized) { zlib_inflateEnd(&stream); vfree(stream.workspace); } } b0d60e4f299f7c51e472ae77'>refslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-03 22:19:15 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-03 22:19:15 +0100
commit424414947da3dd5cb0d60e4f299f7c51e472ae77 (patch)
treea4067480c4256c80ae8f8438a3e4bb88e32050bc /net/mac80211/tkip.c
parenta3683e0c1410c5c8136a7a93b0336ce88d3b893a (diff)
parentd07830db1bdb254e4b50d366010b219286b8c937 (diff)
Merge tag 'usb-serial-4.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus
Johan writes: USB-serial fixes for v4.10-rc7 One more device ID for pl2303. Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'net/mac80211/tkip.c')