drivers/md/dm-verity-fec.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-verity-fec.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-verity-fec.h- Extension
.h- Size
- 4841 bytes
- Lines
- 167
- Domain
- Driver Families
- Bucket
- drivers/md
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dm-verity.hlinux/rslib.h
Detected Declarations
struct dm_verity_fecstruct dm_verity_fec_iofunction verity_fec_is_enabledfunction verity_fec_finish_iofunction verity_fec_init_iofunction verity_fec_is_enabledfunction verity_fec_decodefunction verity_fec_status_tablefunction verity_fec_finish_iofunction verity_fec_parse_opt_argsfunction verity_fec_dtrfunction verity_fec_ctr
Annotated Snippet
struct dm_verity_fec {
struct dm_dev *dev; /* parity data device */
struct dm_bufio_client *data_bufio; /* for data dev access */
struct dm_bufio_client *bufio; /* for parity data access */
size_t block_size; /* size of data, hash, and parity blocks in bytes */
sector_t start; /* parity data start in blocks */
sector_t blocks; /* number of blocks covered */
sector_t region_blocks; /* blocks per region: ceil(blocks / rs_k) */
sector_t hash_blocks; /* blocks covered after v->hash_start */
unsigned char roots; /* parity bytes per RS codeword, n-k of RS(n, k) */
unsigned char rs_k; /* message bytes per RS codeword, k of RS(n, k) */
mempool_t fio_pool; /* mempool for dm_verity_fec_io */
mempool_t rs_pool; /* mempool for fio->rs */
mempool_t prealloc_pool; /* mempool for preallocated buffers */
mempool_t output_pool; /* mempool for output */
struct kmem_cache *cache; /* cache for buffers */
atomic64_t corrected; /* corrected errors */
};
/* per-bio data */
struct dm_verity_fec_io {
struct rs_control *rs; /* Reed-Solomon state */
int erasures[DM_VERITY_FEC_MAX_ROOTS + 1]; /* erasures for decode_rs8 */
u8 *output; /* buffer for corrected output */
unsigned int level; /* recursion level */
unsigned int nbufs; /* number of buffers allocated */
/*
* Buffers for deinterleaving RS codewords. Each buffer has space for
* the message bytes of (1 << DM_VERITY_FEC_BUF_RS_BITS) RS codewords.
* The array length is fec_max_nbufs(v), and we try to allocate that
* many buffers. However, in low-memory situations we may be unable to
* allocate all buffers. 'nbufs' holds the number actually allocated.
*/
u8 *bufs[];
};
#ifdef CONFIG_DM_VERITY_FEC
/* each feature parameter requires a value */
#define DM_VERITY_OPTS_FEC 8
/* Returns true if forward error correction is enabled. */
static inline bool verity_fec_is_enabled(struct dm_verity *v)
{
return v->fec && v->fec->dev;
}
extern int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io,
enum verity_block_type type, const u8 *want_digest,
sector_t block, u8 *dest);
extern unsigned int verity_fec_status_table(struct dm_verity *v, unsigned int sz,
char *result, unsigned int maxlen);
extern void __verity_fec_finish_io(struct dm_verity_io *io);
static inline void verity_fec_finish_io(struct dm_verity_io *io)
{
if (unlikely(io->fec_io))
__verity_fec_finish_io(io);
}
static inline void verity_fec_init_io(struct dm_verity_io *io)
{
io->fec_io = NULL;
}
extern bool verity_is_fec_opt_arg(const char *arg_name);
extern int verity_fec_parse_opt_args(struct dm_arg_set *as,
struct dm_verity *v, unsigned int *argc,
const char *arg_name);
extern void verity_fec_dtr(struct dm_verity *v);
extern int verity_fec_ctr_alloc(struct dm_verity *v);
extern int verity_fec_ctr(struct dm_verity *v);
#else /* !CONFIG_DM_VERITY_FEC */
#define DM_VERITY_OPTS_FEC 0
static inline bool verity_fec_is_enabled(struct dm_verity *v)
{
return false;
}
static inline int verity_fec_decode(struct dm_verity *v,
struct dm_verity_io *io,
enum verity_block_type type,
const u8 *want_digest,
sector_t block, u8 *dest)
Annotation
- Immediate include surface: `dm-verity.h`, `linux/rslib.h`.
- Detected declarations: `struct dm_verity_fec`, `struct dm_verity_fec_io`, `function verity_fec_is_enabled`, `function verity_fec_finish_io`, `function verity_fec_init_io`, `function verity_fec_is_enabled`, `function verity_fec_decode`, `function verity_fec_status_table`, `function verity_fec_finish_io`, `function verity_fec_parse_opt_args`.
- Atlas domain: Driver Families / drivers/md.
- 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.