__kernfs_create_file(9)
π¦ __kernfs_create_file(9) β like, the kernel API manual page, bestie π¦
okay so this is a page straight outta the Kernel API Manual, and it's about a kernfs internal function that creates a file. yes, internal. no cap, that word is doing a lot of heavy lifting here so keep it in mind π
β¨ NAME β¨
__kernfs_create_file β the kernfs internal function that creates a file π
β¨ SYNOPSIS β¨
struct kernfs_node * __kernfs_create_file (struct kernfs_node *parent ,
const char *name , umode_t mode , kuid_t uid , kgid_t gid , loff_t size
, const struct kernfs_ops *ops , void *priv , const struct ns_common *ns
, struct lock_class_key *key );
it's giving "ten whole arguments, and every single one of them matters" π
β¨ ARGUMENTS β¨
parentβ the directory you're creating the file in. it's the vibe check location, iykyk πnameβ the name of the file βοΈmodeβ the mode of the file πuidβ the uid of the file π«Άgidβ the gid of the file π«Άsizeβ the size of the file πopsβ the kernfs operations for the file βοΈprivβ private data for the file πnsβ optional namespace tag of the file. optional, bestie, so don't stress πΈkeyβ the lockdep key for the file'sactive_ref, and<italic>NULL</italic>to disable lockdep π
literally so important:keybeingNULLdisables lockdep. that's the documented behavior, not me being dramatic (for once) π
β¨ RETURN β¨
the created node on success β¨ β and an ERR_PTR value on error π
β¨ SEE ALSO β¨
- the Kernel file
./fs/kernfs/file.c of_on(9)kernfs_deref_open_node_locked(9)kernfs_get_open_node(9)kernfs_unlink_open_file(9)kernfs_notify(9)
go read the source, it's iconic π
and that's the whole page omg π this one lives under ./fs/kernfs, dated October 2026, and it's __kernfs_create_file(9) β go forth and create files responsibly, bestie ππ¦β¨
π¦ 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