zcomp.c (c60a4ef544464f03368ef399ccb8fc115ba9f070) zcomp.c (73e7d81abbc80b04595cc7da09dcaa05a3a92602)
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3#include <linux/kernel.h>
4#include <linux/string.h>
5#include <linux/err.h>
6#include <linux/slab.h>
7#include <linux/wait.h>
8#include <linux/sched.h>
9#include <linux/cpu.h>
10#include <linux/crypto.h>
11#include <linux/vmalloc.h>
12
13#include "zcomp.h"
14
15#include "backend_lzo.h"
16#include "backend_lzorle.h"
17#include "backend_lz4.h"
18#include "backend_lz4hc.h"
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3#include <linux/kernel.h>
4#include <linux/string.h>
5#include <linux/err.h>
6#include <linux/slab.h>
7#include <linux/wait.h>
8#include <linux/sched.h>
9#include <linux/cpu.h>
10#include <linux/crypto.h>
11#include <linux/vmalloc.h>
12
13#include "zcomp.h"
14
15#include "backend_lzo.h"
16#include "backend_lzorle.h"
17#include "backend_lz4.h"
18#include "backend_lz4hc.h"
19#include "backend_zstd.h"
19
20static const struct zcomp_ops *backends[] = {
21#if IS_ENABLED(CONFIG_ZRAM_BACKEND_LZO)
22 &backend_lzorle,
23 &backend_lzo,
24#endif
25#if IS_ENABLED(CONFIG_ZRAM_BACKEND_LZ4)
26 &backend_lz4,
27#endif
28#if IS_ENABLED(CONFIG_ZRAM_BACKEND_LZ4HC)
29 &backend_lz4hc,
30#endif
20
21static const struct zcomp_ops *backends[] = {
22#if IS_ENABLED(CONFIG_ZRAM_BACKEND_LZO)
23 &backend_lzorle,
24 &backend_lzo,
25#endif
26#if IS_ENABLED(CONFIG_ZRAM_BACKEND_LZ4)
27 &backend_lz4,
28#endif
29#if IS_ENABLED(CONFIG_ZRAM_BACKEND_LZ4HC)
30 &backend_lz4hc,
31#endif
32#if IS_ENABLED(CONFIG_ZRAM_BACKEND_ZSTD)
33 &backend_zstd,
34#endif
31 NULL
32};
33
34static void zcomp_strm_free(struct zcomp *comp, struct zcomp_strm *zstrm)
35{
36 if (zstrm->ctx)
37 comp->ops->destroy_ctx(zstrm->ctx);
38 vfree(zstrm->buffer);

--- 161 unchanged lines hidden ---
35 NULL
36};
37
38static void zcomp_strm_free(struct zcomp *comp, struct zcomp_strm *zstrm)
39{
40 if (zstrm->ctx)
41 comp->ops->destroy_ctx(zstrm->ctx);
42 vfree(zstrm->buffer);

--- 161 unchanged lines hidden ---