drivers/md/dm-verity.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-verity.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-verity.h- Extension
.h- Size
- 4562 bytes
- Lines
- 149
- 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
linux/dm-io.hlinux/dm-bufio.hlinux/device-mapper.hlinux/interrupt.hcrypto/hash.hcrypto/sha2.h
Detected Declarations
struct dm_verity_fecstruct dm_veritystruct pending_blockstruct dm_verity_ioenum verity_modeenum verity_block_type
Annotated Snippet
struct dm_verity {
struct dm_dev *data_dev;
struct dm_dev *hash_dev;
struct dm_target *ti;
struct dm_bufio_client *bufio;
char *alg_name;
struct crypto_shash *shash_tfm;
u8 *root_digest; /* digest of the root block */
u8 *salt; /* salt: its size is salt_size */
union {
struct sha256_ctx *sha256; /* for use_sha256_lib=1 */
u8 *shash; /* for use_sha256_lib=0 */
} initial_hashstate; /* salted initial state, if version >= 1 */
u8 *zero_digest; /* digest for a zero block */
#ifdef CONFIG_SECURITY
u8 *root_digest_sig; /* signature of the root digest */
unsigned int sig_size; /* root digest signature size */
#endif /* CONFIG_SECURITY */
unsigned int salt_size;
sector_t hash_start; /* index of first hash block on hash_dev */
sector_t hash_end; /* 1 + index of last hash block on hash dev */
sector_t data_blocks; /* the number of data blocks */
unsigned char data_dev_block_bits; /* log2(data blocksize) */
unsigned char hash_dev_block_bits; /* log2(hash blocksize) */
unsigned char hash_per_block_bits; /* log2(hashes in hash block) */
unsigned char levels; /* the number of tree levels */
unsigned char version;
bool hash_failed:1; /* set if hash of any block failed */
bool use_bh_wq:1; /* try to verify in BH wq before normal work-queue */
bool use_sha256_lib:1; /* use SHA-256 library instead of generic crypto API */
bool use_sha256_finup_2x:1; /* use interleaved hashing optimization */
unsigned int digest_size; /* digest size for the current hash algorithm */
enum verity_mode mode; /* mode for handling verification errors */
enum verity_mode error_mode;/* mode for handling I/O errors */
unsigned int corrupted_errs;/* Number of errors for corrupted blocks */
struct workqueue_struct *verify_wq;
/* starting blocks for each tree level. 0 is the lowest level. */
sector_t hash_level_block[DM_VERITY_MAX_LEVELS];
struct dm_verity_fec *fec; /* forward error correction */
unsigned long *validated_blocks; /* bitset blocks validated */
char *signature_key_desc; /* signature keyring reference */
struct dm_io_client *io;
mempool_t recheck_pool;
};
struct pending_block {
void *data;
sector_t blkno;
u8 want_digest[HASH_MAX_DIGESTSIZE];
u8 real_digest[HASH_MAX_DIGESTSIZE];
};
struct dm_verity_io {
struct dm_verity *v;
/* original value of bio->bi_end_io */
bio_end_io_t *orig_bi_end_io;
struct bvec_iter iter;
sector_t block;
unsigned int n_blocks;
bool in_bh;
bool had_mismatch;
#ifdef CONFIG_DM_VERITY_FEC
struct dm_verity_fec_io *fec_io;
#endif
struct work_struct work;
u8 tmp_digest[HASH_MAX_DIGESTSIZE];
/*
* This is the queue of data blocks that are pending verification. When
* the crypto layer supports interleaved hashing, we allow multiple
* blocks to be queued up in order to utilize it. This can improve
* performance significantly vs. sequential hashing of each block.
*/
int num_pending;
struct pending_block pending_blocks[2];
/*
* Temporary space for hashing. Either sha256 or shash is used,
* depending on the value of use_sha256_lib. If shash is used,
Annotation
- Immediate include surface: `linux/dm-io.h`, `linux/dm-bufio.h`, `linux/device-mapper.h`, `linux/interrupt.h`, `crypto/hash.h`, `crypto/sha2.h`.
- Detected declarations: `struct dm_verity_fec`, `struct dm_verity`, `struct pending_block`, `struct dm_verity_io`, `enum verity_mode`, `enum verity_block_type`.
- 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.