Lines Matching refs:lzo_ctx

38 static int regcache_lzo_prepare(struct regcache_lzo_ctx *lzo_ctx)  in regcache_lzo_prepare()  argument
40 lzo_ctx->wmem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL); in regcache_lzo_prepare()
41 if (!lzo_ctx->wmem) in regcache_lzo_prepare()
46 static int regcache_lzo_compress(struct regcache_lzo_ctx *lzo_ctx) in regcache_lzo_compress() argument
51 ret = lzo1x_1_compress(lzo_ctx->src, lzo_ctx->src_len, in regcache_lzo_compress()
52 lzo_ctx->dst, &compress_size, lzo_ctx->wmem); in regcache_lzo_compress()
53 if (ret != LZO_E_OK || compress_size > lzo_ctx->dst_len) in regcache_lzo_compress()
55 lzo_ctx->dst_len = compress_size; in regcache_lzo_compress()
59 static int regcache_lzo_decompress(struct regcache_lzo_ctx *lzo_ctx) in regcache_lzo_decompress() argument
64 dst_len = lzo_ctx->dst_len; in regcache_lzo_decompress()
65 ret = lzo1x_decompress_safe(lzo_ctx->src, lzo_ctx->src_len, in regcache_lzo_decompress()
66 lzo_ctx->dst, &dst_len); in regcache_lzo_decompress()
67 if (ret != LZO_E_OK || dst_len != lzo_ctx->dst_len) in regcache_lzo_decompress()
73 struct regcache_lzo_ctx *lzo_ctx) in regcache_lzo_compress_cache_block() argument
77 lzo_ctx->dst_len = lzo1x_worst_compress(PAGE_SIZE); in regcache_lzo_compress_cache_block()
78 lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL); in regcache_lzo_compress_cache_block()
79 if (!lzo_ctx->dst) { in regcache_lzo_compress_cache_block()
80 lzo_ctx->dst_len = 0; in regcache_lzo_compress_cache_block()
84 ret = regcache_lzo_compress(lzo_ctx); in regcache_lzo_compress_cache_block()
91 struct regcache_lzo_ctx *lzo_ctx) in regcache_lzo_decompress_cache_block() argument
95 lzo_ctx->dst_len = lzo_ctx->decompressed_size; in regcache_lzo_decompress_cache_block()
96 lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL); in regcache_lzo_decompress_cache_block()
97 if (!lzo_ctx->dst) { in regcache_lzo_decompress_cache_block()
98 lzo_ctx->dst_len = 0; in regcache_lzo_decompress_cache_block()
102 ret = regcache_lzo_decompress(lzo_ctx); in regcache_lzo_decompress_cache_block()