drivers/block/zram/backend_842.c
Source file repositories/reference/linux-study-clean/drivers/block/zram/backend_842.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/zram/backend_842.c- Extension
.c- Size
- 1323 bytes
- Lines
- 62
- 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/sw842.hlinux/vmalloc.hbackend_842.h
Detected Declarations
function release_params_842function destroy_842function create_842function compress_842function decompress_842
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sw842.h>
#include <linux/vmalloc.h>
#include "backend_842.h"
static void release_params_842(struct zcomp_params *params)
{
}
static int setup_params_842(struct zcomp_params *params)
{
return 0;
}
static void destroy_842(struct zcomp_ctx *ctx)
{
kfree(ctx->context);
}
static int create_842(struct zcomp_params *params, struct zcomp_ctx *ctx)
{
ctx->context = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL);
if (!ctx->context)
return -ENOMEM;
return 0;
}
static int compress_842(struct zcomp_params *params, struct zcomp_ctx *ctx,
struct zcomp_req *req)
{
unsigned int dlen = req->dst_len;
int ret;
ret = sw842_compress(req->src, req->src_len, req->dst, &dlen,
ctx->context);
if (ret == 0)
req->dst_len = dlen;
return ret;
}
static int decompress_842(struct zcomp_params *params, struct zcomp_ctx *ctx,
struct zcomp_req *req)
{
unsigned int dlen = req->dst_len;
return sw842_decompress(req->src, req->src_len, req->dst, &dlen);
}
const struct zcomp_ops backend_842 = {
.compress = compress_842,
.decompress = decompress_842,
.create_ctx = create_842,
.destroy_ctx = destroy_842,
.setup_params = setup_params_842,
.release_params = release_params_842,
.name = "842",
};
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/sw842.h`, `linux/vmalloc.h`, `backend_842.h`.
- Detected declarations: `function release_params_842`, `function destroy_842`, `function create_842`, `function compress_842`, `function decompress_842`.
- 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.