prepend_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 length qstr structure 🌈

πŸ”₯ 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