debugfs_file_get(9)
β¨ debugfs_file_get(9) β¨
ok so this is a page from the Kernel API Manual β yes bestie, the kernel has its own manual and it's kind of iconic π
π NAME π
debugfs_file_get β marks the beginning of file data access. that's it, that's the whole vibe π«Ά
πΈ SYNOPSIS πΈ
int debugfs_file_get (struct dentry *dentry );
π ARGUMENTS π
dentryβ the dentry object whose data is being accessed. like, the actual file-handle-from-the-kernel's-perspective thing you're about to poke at π¦
π DESCRIPTION π
okay so here's the tea β β up to a matching call to debugfs_file_put, any successive call into the file removing functions debugfs_remove and debugfs_remove_recursive will block. literally just sit there. no cap.
and the reason that's actually good news? since the associated private file data may only get freed after a successful return of any of the removal functions, you may safely access it after a successful call to debugfs_file_get without worrying about lifetime issues. bestie you are SAFE. the data is not going anywhere on you π«Άβ¨
now, the vibes check:
- if
-EIOis returned, the file has already been removed and thus, it is not safe to access any of its data. do not pass go. do not touch the data. π - if, on the other hand, it is allowed to access the file data, zero is returned. slay. go read your data π₯
fr fr, always check that return value. -EIO means the file is gone-gone and touching its data is straight-up undefined territory π
π SEE ALSO π
- Kernel file
./fs/debugfs/file.cβdebugfs_file_put(9) debugfs_enter_cancellation(9)debugfs_leave_cancellation(9)debugfs_create_u8(9)debugfs_create_u16(9)debugfs_create_u32(9)debugfs_create_u64(9)debugfs_create_ulong(9)debugfs_create_x8(9)debugfs_create_x16(9)debugfs_create_x32(9)debugfs_create_x64(9)debugfs_create_size_t(9)debugfs_create_atomic_t(9)debugfs_create_bool(9)debugfs_create_str(9)debugfs_create_blob(9)debugfs_create_u32_array(9)debugfs_print_regs32(9)debugfs_create_regset32(9)debugfs_create_devm_seqfile(9)
and that's the whole page, bestie π this one lives in ./fs/debugfs and the version is dated October 2026 β so like, future-core of them ngl. mwah, go forth and debugfs_file_get responsibly πβ¨
π¦ 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