函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\namei.c Create Date:2022-07-29 10:35:11
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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

函数原型:int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode)

返回类型:int

参数:

类型参数名称
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  如果非inode则返回:负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  如果error则返回:error
4151  如果i_sb不等于i_sb则返回:负EXDEV
4157  如果IS_APPEND(inode)或IS_IMMUTABLE(inode)则返回:负EPERM
4164  如果HAS_UNMAPPED_ID(inode)则返回:负EPERM
4166  如果非link则返回:负EPERM
4168  如果S_ISDIR(i_mode)则返回:负EPERM
4171  error等于security_inode_link(old_dentry, dir, new_dentry)
4172  如果error则返回:error
4175  inode_lock(inode)
4177  如果i_nlink恒等于0且非Misc 按位与I_LINKABLE的值则error等于负ENOENT
4179  否则如果max_linksi_nlink大于等于max_linkserror等于负EMLINK
4181  否则
4182  error等于try_break_deleg(inode, delegated_inode)
4183  如果非errorerror等于link(old_dentry, dir, new_dentry)
4187  如果非errorMisc 按位与I_LINKABLE
4188  加自旋锁
4189  Misc 与等于I_LINKABLE的反
4190  自旋锁解锁
4192  inode_unlock(inode)
4193  如果非errorsnotify_link - new hardlink in 'inode' directory* Note: We have to pass also the linked inode ptr as some filesystems leave
4195  返回:error
调用者
名称描述
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