securityfs_create_symlink(9)
π securityfs_create_symlink β the Kernel API Manual
okay so bestie, today's main character is securityfs_create_symlink(9) from the Kernel API Manual β and she is literally the girl who makes symlinks inside securityfs. no cap. β¨
π SYNOPSIS π
struct dentry * securityfs_create_symlink (const char *name , struct
dentry *parent , const char *target , const struct inode_operations
*iops );
likeβ¦ look at her. four params, one struct dentry * coming back at you. she ate. π
πΈ ARGUMENTS πΈ
nameβ a pointer to a string holding the name of the symlink you're about to create. that's the label on the door, bestie. πͺparentβ a pointer to the parent dentry for the symlink. this should be a directory dentry if you set it. and if this parameter isNULL? then the directory gets created in the root of thesecurityfsfilesystem. so like,NULL= "put it at the top, idc." π«Άtargetβ a pointer to a string containing the name of the symlink's target. β οΈ but heads up: if this parameter isNULL, then theiopsparameter needs to be set up to handle.readlinkand.get_linkinode_operations. it's giving "you have to do the work yourself." πiopsβ a pointer to thestruct inode_operationsto use for the symlink. if this parameter isNULL, then the defaultsimple_symlink_inodeoperations will be used. easy mode, slay. β¨
π¦ DESCRIPTION π¦
so what does she actually do? this function creates a symlink in securityfs with the given name. that's it, that's the vibe. π
now the important part, and i need you to actually listen for this one: this function returns a pointer to a dentry if it succeeds. π that pointer must be passed to the securityfs_remove function when the file is to be removed. like, for real. there is no automatic cleanup that happens if your module is unloaded β you are responsible here. no one is coming to save you, bestie. ππ
if an error occurs, the function will return the error value (via ERR_PTR). so, y'know, vibe check your return value before you dereference it. π
and if securityfs is not enabled in the kernel? the value -ENODEV is returned. iconic of her honestly. π
π SEE ALSO π
- Kernel file
./security/inode.c securityfs_create_dentry(9)securityfs_create_file(9)securityfs_create_dir(9)securityfs_remove(9)
and that's the whole page, bestie!! π«Άβ¨ this lil gem comes from the source ./security, dated October 2026, in the Kernel API Manual β go forth and symlink 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