block/blk-crypto-internal.h
Source file repositories/reference/linux-study-clean/block/blk-crypto-internal.h
File Facts
- System
- Linux kernel
- Corpus path
block/blk-crypto-internal.h- Extension
.h- Size
- 6385 bytes
- Lines
- 247
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bio.hlinux/blk-mq.h
Detected Declarations
struct blk_crypto_modefunction bio_crypt_ctx_back_mergeablefunction bio_crypt_ctx_front_mergeablefunction bio_crypt_ctx_merge_rqfunction blk_crypto_rq_set_defaultsfunction blk_crypto_rq_is_encryptedfunction blk_crypto_rq_has_keyslotfunction blk_crypto_supportedfunction blk_crypto_sysfs_registerfunction blk_crypto_sysfs_unregisterfunction bio_crypt_ctx_front_mergeablefunction bio_crypt_ctx_back_mergeablefunction bio_crypt_ctx_merge_rqfunction blk_crypto_rq_set_defaultsfunction blk_crypto_rq_has_keyslotfunction blk_crypto_ioctlfunction blk_crypto_supportedfunction bio_crypt_advancefunction bio_crypt_free_ctxfunction bio_crypt_do_front_mergefunction blk_crypto_rq_get_keyslotfunction blk_crypto_rq_put_keyslotfunction blk_crypto_free_requestfunction blk_crypto_rq_bio_prepfunction blk_crypto_fallback_start_using_modefunction blk_crypto_fallback_evict_key
Annotated Snippet
struct blk_crypto_mode {
const char *name; /* name of this mode, shown in sysfs */
const char *cipher_str; /* crypto API name (for fallback case) */
unsigned int keysize; /* key size in bytes */
unsigned int security_strength; /* security strength in bytes */
unsigned int ivsize; /* iv size in bytes */
};
extern const struct blk_crypto_mode blk_crypto_modes[];
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
int blk_crypto_sysfs_register(struct gendisk *disk);
void blk_crypto_sysfs_unregister(struct gendisk *disk);
void bio_crypt_dun_increment(u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE],
unsigned int inc);
bool bio_crypt_rq_ctx_compatible(struct request *rq, struct bio *bio);
bool bio_crypt_ctx_mergeable(struct bio_crypt_ctx *bc1, unsigned int bc1_bytes,
struct bio_crypt_ctx *bc2);
static inline bool bio_crypt_ctx_back_mergeable(struct request *req,
struct bio *bio)
{
return bio_crypt_ctx_mergeable(req->crypt_ctx, blk_rq_bytes(req),
bio->bi_crypt_context);
}
static inline bool bio_crypt_ctx_front_mergeable(struct request *req,
struct bio *bio)
{
return bio_crypt_ctx_mergeable(bio->bi_crypt_context,
bio->bi_iter.bi_size, req->crypt_ctx);
}
static inline bool bio_crypt_ctx_merge_rq(struct request *req,
struct request *next)
{
return bio_crypt_ctx_mergeable(req->crypt_ctx, blk_rq_bytes(req),
next->crypt_ctx);
}
static inline void blk_crypto_rq_set_defaults(struct request *rq)
{
rq->crypt_ctx = NULL;
rq->crypt_keyslot = NULL;
}
static inline bool blk_crypto_rq_is_encrypted(struct request *rq)
{
return rq->crypt_ctx;
}
static inline bool blk_crypto_rq_has_keyslot(struct request *rq)
{
return rq->crypt_keyslot;
}
blk_status_t blk_crypto_get_keyslot(struct blk_crypto_profile *profile,
const struct blk_crypto_key *key,
struct blk_crypto_keyslot **slot_ptr);
void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot);
int __blk_crypto_evict_key(struct blk_crypto_profile *profile,
const struct blk_crypto_key *key);
bool __blk_crypto_cfg_supported(struct blk_crypto_profile *profile,
const struct blk_crypto_config *cfg);
int blk_crypto_ioctl(struct block_device *bdev, unsigned int cmd,
void __user *argp);
static inline bool blk_crypto_supported(struct bio *bio)
{
return blk_crypto_config_supported_natively(bio->bi_bdev,
&bio->bi_crypt_context->bc_key->crypto_cfg);
}
#else /* CONFIG_BLK_INLINE_ENCRYPTION */
static inline int blk_crypto_sysfs_register(struct gendisk *disk)
{
return 0;
}
static inline void blk_crypto_sysfs_unregister(struct gendisk *disk)
Annotation
- Immediate include surface: `linux/bio.h`, `linux/blk-mq.h`.
- Detected declarations: `struct blk_crypto_mode`, `function bio_crypt_ctx_back_mergeable`, `function bio_crypt_ctx_front_mergeable`, `function bio_crypt_ctx_merge_rq`, `function blk_crypto_rq_set_defaults`, `function blk_crypto_rq_is_encrypted`, `function blk_crypto_rq_has_keyslot`, `function blk_crypto_supported`, `function blk_crypto_sysfs_register`, `function blk_crypto_sysfs_unregister`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- 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.