make_kqid(9)
π 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 π₯
- Kernel file
./include/linux/quota.h make_kqid_invalid(9)make_kqid_uid(9)make_kqid_gid(9)make_kqid_projid(9)qid_has_mapping(9)
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
- 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