Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\namei.c Create Date:2022-07-28 20:05:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:vfs_link - create a new link*@old_dentry: object to be linked*@dir: new parent*@new_dentry: where to create the new link*@delegated_inode: returns inode needing a delegation break* The caller must hold dir->i_mutex* If vfs_link discovers a delegation on

Proto:int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode)

Type:int

Parameter:

TypeParameterName
struct dentry *old_dentry
struct inode *dir
struct dentry *new_dentry
struct inode **delegated_inode
4140  inode = Where the name belongs to - NULL is * negative
4141  max_links = s_max_links
4144  If Not inode Then Return -ENOENT
4147  error = Check whether we can create an object with dentry child in directory* dir.* 1. We can't do it if child already exists (open has special treatment for* this case, but since we are inlined it's OK)* 2
4148  If error Then Return error
4151  If i_sb != i_sb Then Return -EXDEV
4157  If IS_APPEND(inode) || IS_IMMUTABLE(inode) Then Return -EPERM
4164  If HAS_UNMAPPED_ID(inode) Then Return -EPERM
4166  If Not link Then Return -EPERM
4168  If S_ISDIR(i_mode) Then Return -EPERM
4171  error = security_inode_link(old_dentry, dir, new_dentry)
4172  If error Then Return error
4175  inode_lock(inode)
4177  If i_nlink == 0 && Not (Misc & I_LINKABLE) Then error = -ENOENT
4179  Else if max_links && i_nlink >= max_links Then error = -EMLINK
4181  Else
4182  error = try_break_deleg(inode, delegated_inode)
4183  If Not error Then error = link(old_dentry, dir, new_dentry)
4187  If Not error && Misc & I_LINKABLE Then
4188  spin_lock( & _blocks, i_bytes, maybe i_size )
4189  Misc &= ~I_LINKABLE
4190  spin_unlock( & _blocks, i_bytes, maybe i_size )
4192  inode_unlock(inode)
4193  If Not error Then snotify_link - new hardlink in 'inode' directory* Note: We have to pass also the linked inode ptr as some filesystems leave
4195  Return error
Caller
NameDescribe
do_linkatHardlinks are often used in delicate situations. We avoid* security-related surprises by not following symlinks on the* newname. --KAB* We don't follow them on the oldname either to be compatible* with linux 2.0, and to avoid hard-linking to directories