make_kqid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… make_kqid β€” the kernel API manual, but make it make sense πŸ’…

Okay so bestie, we're deep in the kernel API manual today (that's the make_kqid(9) page, section 9, if you're keeping score πŸŽ€) and this one is genuinely so cute once you get it. It's all about taking a qid from userland's little namespace world and translating it into the kernel's own internal version. Slay. Let's go. ✨


🌸 NAME 🌸

make_kqid β€” maps a user-namespace, type, qid tuple into a kqid. That's it, that's the whole vibe. Three things in, one kqid out. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

struct kqid make_kqid (struct user_namespace *from , enum quota_type
type , qid_t qid );

Yes the spacing is exactly like that, do not come for me, I'm just the messenger 😭


✨ ARGUMENTS ✨

  • from β€” the user namespace that the qid lives in. Like, whose house is this qid visiting from? 🏠
  • type β€” the type of quota. Which flavour are we talking about, iykyk.
  • qid β€” the quota identifier itself. The main character of the tuple, honestly. πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

So here's the tea: make_kqid maps a user-namespace, type, qid tuple into a kernel internal kqid, and then returns that kqid right back to you. Handoff complete, no cap. 🫢

Now the part you actually need to pay attention to: when there is no mapping defined for the user-namespace, type, qid tuple, an invalid kqid is returned. Not a crash, not a silent weird value β€” an invalid kqid, deliberately. πŸ’€

And because of that, callers are expected to test for and handle invalid kqids being returned. Like, this is not optional, bestie. Check it. πŸ™ˆ

Wanna know if the kqid you got back is valid or not? You can test invalid kqids using qid_valid. Iconic little helper, does exactly what it says on the tin. βœ…


πŸ”₯ SEE ALSO πŸ”₯

Go read those too, they're all part of the same friend group and they ate. πŸ’…πŸŒˆ


⭐ and that's the whole page, you're officially educated ⭐

Shoutout to the source at ./include/linux and the October 2026 date stamp on this one β€” vintage behaviour from the kernel API manual, we stan a documented timestamp πŸŽ€πŸ§šπŸ’–

πŸ“¦ where this page comes from