bd_prepare_to_claim(9)
π bd_prepare_to_claim β claim a block device
okay so this one lives in the Kernel API Manual (yeah, kernel docs, we're fancy now π) and it's literally the "can i have this block device pls" function. bestie, if you've ever fought over the aux cord, you already understand the vibe.
β¨ SYNOPSIS β¨
int bd_prepare_to_claim (struct block_device *bdev , void *holder ,
const struct blk_holder_ops *hops );
three args, one int, zero drama (until someone else already claimed it, then a little drama π).
π«Ά ARGUMENTS π«Ά
bdevβ the block device of interest. your main character, the one you're trying to claim πholderβ the holder that's trying to claimbdev. that's you. you're the holder. slay πhopsβ the holder ops, i.e. thestruct blk_holder_ops *. the ops. iconic.
πΈ DESCRIPTION πΈ
Claim bdev. that's the whole mission, no cap.
the tea β: this function fails if bdev is already claimed by another holder β like, someone else got there first, respectfully, go away. and it waits if another claiming is in progress. not "fails", not "errors out" β it waits. lowkey polite of it ngl π§
then, and this is the important bit β on return, the caller has ownership of bd_claiming and bd_holder[s]. π yes, that's exactly how the original says it, bd_holder[s] with the brackets and all, we do not edit the source in this house. so if you're the caller, congrats, those are yours now. handle with care bestie.
β RETURN β
0β yes babes,bdevcan be claimed, go off π₯-EBUSYβ nope, it's taken / busy. better luck next time π¦
π SEE ALSO π
kernel file ./block/bdev.c plus the whole friend group:
bdev_validate_blocksize(9), bdev_freeze(9), bdev_thaw(9), bdev_deny_freeze(9), bdev_allow_freeze(9), bd_may_claim(9), bd_finish_claiming(9), bd_abort_claiming(9), bdev_open(9), bdev_yield_claim(9), bdev_fput(9), lookup_bdev(9), bdev_mark_dead(9)
fr fr read thebd_*ones next, they're literally the rest of this story arc βbd_may_claim(9)is the vibe check andbd_finish_claiming(9)is the "it's official" post π
that's the page bestie, go claim something responsibly π
this lil drop came from ./block, dated October 2026, and it's filed under bd_prepare_to_claim(9) in case you need to find it again later πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms