Release 4.11 fs/cramfs/uncompress.c
/*
* 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 <linux/kernel.h>
#include <linux/errno.h>
#include <linux/vmalloc.h>
#include <linux/zlib.h>
#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;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 121 | 92.37% | 2 | 40.00% |
David Woodhouse | 5 | 3.82% | 1 | 20.00% |
Fabian Frederick | 3 | 2.29% | 1 | 20.00% |
David VomLehn | 2 | 1.53% | 1 | 20.00% |
Total | 131 | 100.00% | 5 | 100.00% |
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;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 35 | 55.56% | 1 | 33.33% |
Linus Torvalds | 26 | 41.27% | 1 | 33.33% |
David Woodhouse | 2 | 3.17% | 1 | 33.33% |
Total | 63 | 100.00% | 3 | 100.00% |
void cramfs_uncompress_exit(void)
{
if (!--initialized) {
zlib_inflateEnd(&stream);
vfree(stream.workspace);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 17 | 60.71% | 1 | 25.00% |
Linus Torvalds | 9 | 32.14% | 1 | 25.00% |
David Woodhouse | 1 | 3.57% | 1 | 25.00% |
Alexey Dobriyan | 1 | 3.57% | 1 | 25.00% |
Total | 28 | 100.00% | 4 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 188 | 74.02% | 2 | 20.00% |
Linus Torvalds | 41 | 16.14% | 1 | 10.00% |
Fabian Frederick | 10 | 3.94% | 2 | 20.00% |
David Woodhouse | 9 | 3.54% | 1 | 10.00% |
Adrian Bunk | 2 | 0.79% | 1 | 10.00% |
David VomLehn | 2 | 0.79% | 1 | 10.00% |
Al Viro | 1 | 0.39% | 1 | 10.00% |
Alexey Dobriyan | 1 | 0.39% | 1 | 10.00% |
Total | 254 | 100.00% | 10 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.