函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:vfs_rename - rename a filesystem object*@old_dir: parent of source*@old_dentry: source*@new_dir: parent of destination*@new_dentry: destination*@delegated_inode: returns an inode needing a delegation break*@flags: rename flags

函数原型:int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, struct inode **delegated_inode, unsigned int flags)

返回类型:int

参数:

类型参数名称
struct inode *old_dir
struct dentry *old_dentry
struct inode *new_dir
struct dentry *new_dentry
struct inode **delegated_inode
unsigned intflags
4339  is_dir等于d_is_dir(old_dentry)
4340  source等于 Where the name belongs to - NULL is * negative
4341  target等于 Where the name belongs to - NULL is * negative
4342  bool new_is_dir = false
4343  max_links等于s_max_links
4346  如果source恒等于target则返回:0
4349  error等于Check whether we can remove a link victim from directory dir, check* whether the type of victim is right.* 1. We can't do it if dir is read-only (done in permission())* 2. We should have write and exec permissions on dir* 3
4350  如果error则返回:error
4353  如果非target
4354  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
4355  否则
4356  new_is_dir等于d_is_dir(new_dentry)
4358  如果非flags按位与Exchange source and dest 的值则error等于Check whether we can remove a link victim from directory dir, check* whether the type of victim is right.* 1. We can't do it if dir is read-only (done in permission())* 2. We should have write and exec permissions on dir* 3
4360  否则error等于Check whether we can remove a link victim from directory dir, check* whether the type of victim is right.* 1. We can't do it if dir is read-only (done in permission())* 2. We should have write and exec permissions on dir* 3
4363  如果error则返回:error
4366  如果非rename则返回:负EPERM
4373  如果new_dir不等于old_dir
4374  如果is_dir
4376  如果error则返回:error
4379  如果flags按位与Exchange source and dest new_is_dir
4381  如果error则返回:error
4386  error等于security_inode_rename(old_dir, old_dentry, new_dir, new_dentry, flags)
4388  如果error则返回:error
4391  take_dentry_name_snapshot( & old_name, old_dentry)
4392  获得目录项引用
4393  如果非is_dirflags按位与Exchange source and dest lock_two_nondirectories(source, target)
4395  否则如果targetinode_lock(target)
4398  error等于负EBUSY
4399  如果is_local_mountpoint(old_dentry)或is_local_mountpoint(new_dentry)则转到:out
4402  如果max_linksnew_dir不等于old_dir
4403  error等于负EMLINK
4404  如果is_dir且非new_is_diri_nlink大于等于max_links则转到:out
4406  如果flags按位与Exchange source and dest 且非is_dirnew_is_diri_nlink大于等于max_links则转到:out
4410  如果非is_dir
4411  error等于try_break_deleg(source, delegated_inode)
4412  如果error则转到:out
4415  如果target且非new_is_dir
4416  error等于try_break_deleg(target, delegated_inode)
4417  如果error则转到:out
4420  error等于rename(old_dir, old_dentry, new_dir, new_dentry, flags)
4422  如果error则转到:out
4425  如果非flags按位与Exchange source and dest 的值且target
4426  如果is_dir
4430  dont_mount(new_dentry)
4431  detach_mounts(new_dentry)
4433  如果非fs_flags按位与FS will handle d_move() during rename() internally. 的值则
4434  如果非flags按位与Exchange source and dest 的值则改变目录项
4436  否则d_exchange(old_dentry, new_dentry)
4439  out :
4440  如果非is_dirflags按位与Exchange source and dest unlock_two_nondirectories(source, target)
4442  否则如果targetinode_unlock(target)
4444  dput(new_dentry)
4445  如果非error
4446  snotify_move - file old_name at old_dir was moved to new_name at new_dir
4448  如果flags按位与Exchange source and dest
4453  release_dentry_name_snapshot( & old_name)
4455  返回:error
调用者
名称描述
do_renameat2