drivers/block/zram/backend_lzorle.c
Source file repositories/reference/linux-study-clean/drivers/block/zram/backend_lzorle.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/zram/backend_lzorle.c- Extension
.c- Size
- 1336 bytes
- Lines
- 60
- Domain
- Driver Families
- Bucket
- drivers/block
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/slab.hlinux/lzo.hbackend_lzorle.h
Detected Declarations
function lzorle_release_paramsfunction lzorle_createfunction lzorle_destroyfunction lzorle_compressfunction lzorle_decompress
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/lzo.h>
#include "backend_lzorle.h"
static void lzorle_release_params(struct zcomp_params *params)
{
}
static int lzorle_setup_params(struct zcomp_params *params)
{
return 0;
}
static int lzorle_create(struct zcomp_params *params, struct zcomp_ctx *ctx)
{
ctx->context = kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
if (!ctx->context)
return -ENOMEM;
return 0;
}
static void lzorle_destroy(struct zcomp_ctx *ctx)
{
kfree(ctx->context);
}
static int lzorle_compress(struct zcomp_params *params, struct zcomp_ctx *ctx,
struct zcomp_req *req)
{
int ret;
ret = lzorle1x_1_compress(req->src, req->src_len, req->dst,
&req->dst_len, ctx->context);
return ret == LZO_E_OK ? 0 : ret;
}
static int lzorle_decompress(struct zcomp_params *params, struct zcomp_ctx *ctx,
struct zcomp_req *req)
{
int ret;
ret = lzo1x_decompress_safe(req->src, req->src_len,
req->dst, &req->dst_len);
return ret == LZO_E_OK ? 0 : ret;
}
const struct zcomp_ops backend_lzorle = {
.compress = lzorle_compress,
.decompress = lzorle_decompress,
.create_ctx = lzorle_create,
.destroy_ctx = lzorle_destroy,
.setup_params = lzorle_setup_params,
.release_params = lzorle_release_params,
.name = "lzo-rle",
};
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/lzo.h`, `backend_lzorle.h`.
- Detected declarations: `function lzorle_release_params`, `function lzorle_create`, `function lzorle_destroy`, `function lzorle_compress`, `function lzorle_decompress`.
- Atlas domain: Driver Families / drivers/block.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.