shmem_file_setup_with_mnt(9)
πΈ shmem_file_setup_with_mnt (9) β the kernel API manual, bestie edition π
okay so picture this: you need a file. but not, like, a file file. no directory entry, no name on disk, just a vibe living rent-free in tmpfs. that's literally what this function does and honestly? iconic. it hands you back a struct file * that's already unlinked, chillin' in a tmpfs mount of your choosing. no cap. π
β¨ NAME β¨
shmem_file_setup_with_mnt β get an unlinked file living in tmpfs π«Ά
π SYNOPSIS π
struct file * shmem_file_setup_with_mnt (struct vfsmount *mnt , const
char *name , loff_t size , vma_flags_t flags );
like, that's the whole signature. look at her go. π
π ARGUMENTS π
mntβ the tmpfs mount where the file will be created. yes, you pick which mount. main character energy fr fr.nameβ name for dentry (to be seen in/proc/<pid>/maps). so it does have a name, it's just for looking pretty in maps, not for finding on disk. iykyk.sizeβ size to be set for the file. the number. the whole lewk. πflagsβVMA_NORESERVE_BITsuppresses pre-accounting of the entire object size. like, no reserving the whole thing up front, mmkay? π
π¦ SEE ALSO π¦
- Kernel file
./mm/shmem.c shmem_recalc_inode(9)shmem_writeout(9)shmem_get_folio(9)shmem_kernel_file_setup(9)shmem_file_setup(9)shmem_zero_setup(9)shmem_zero_setup_desc(9)shmem_read_folio_gfp(9)
the whole shmem friend group!! go read them too, they're all serving. πΈβ¨
ngl bestie, this one lives in ./mm, and it's dated October 2026. that's the source/version and date teas, so now you know. mwah π π©·
π¦ 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