bd_prepare_to_claim(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 claim bdev. that's you. you're the holder. slay πŸ’…
  • hops β€” the holder ops, i.e. the struct 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, bdev can 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 the bd_* ones next, they're literally the rest of this story arc β€” bd_may_claim(9) is the vibe check and bd_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