prepend_name(9)
π prepend_name(9) β the Kernel API Manual, bestie β¨
okay so you opened section 9 of the Kernel API Manual, and this page is all about prepend_name, which is literally here to prepend a pathname in front of the current buffer pointer. π
β¨ NAME β¨
prepend_name β prepend a pathname in front of current buffer pointer π
πΈ SYNOPSIS πΈ
bool prepend_name (struct prepend_buffer *p , const struct qstr *name );
π¦ ARGUMENTS π¦
pβ the prepend buffer which contains the buffer pointer and the allocated length π«Άnameβ the name string and lengthqstrstructure π
π₯ DESCRIPTION π₯
Okay so picture this: with RCU path tracing, it may race with d_move. Use READ_ONCE to make sure that either the old or the new name pointer and length are fetched. π
However β and this is the messy part β there may be mismatch between length and pointer. But since the length cannot be trusted, we need to copy the name very carefully when doing the prepend_copy. π
It also prepends "/" at the beginning of the name. The sequence number check at the caller will retry it again when a d_move does happen. So any garbage in the buffer due to mismatched pointer and length will be discarded. ποΈβ¨
Load acquire is needed to make sure that we see the new name data even if we might get the length wrong. π
π SEE ALSO π
Kernel file ./fs/d_path.c β prepend_path(9), __d_path(9), d_path(9) π
kisses and sparkles, bestie πβ¨ β this one comes from ./fs, dated October 2026, and it is still the prepend_name(9) page. π
π¦ 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