函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

函数原型:static int may_delete(struct inode *dir, struct dentry *victim, bool isdir)

返回类型:int

参数:

类型参数名称
struct inode *dir
struct dentry *victim
boolisdir
2736  inode等于d_backing_inode - Get upper or lower inode we should be using*@upper: The upper layer* This is the helper that should be used to get at the inode that will be used* if this dentry were to be opened as a file. The inode may be on the upper
2739  如果d_is_negative(victim)则返回:负ENOENT
2741  BUG_ON(!inode)
2743  BUG_ON( Where the name belongs to - NULL is * negative != dir)
2746  如果非uid_valid(i_uid)或非gid_valid(i_gid)则返回:负EOVERFLOW
2749  audit_inode_child(dir, victim, a child being deleted )
2751  error等于de_permission - Check for access rights to a given inode*@inode: Inode to check permission on*@mask: Right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)* Check for read/write/execute permissions on an inode
2752  如果error则返回:error
2754  如果IS_APPEND(dir)则返回:负EPERM
2757  如果check_sticky(dir, inode)或IS_APPEND(inode)或IS_IMMUTABLE(inode)或IS_SWAPFILE(inode)或HAS_UNMAPPED_ID(inode)则返回:负EPERM
2760  如果isdir
2761  如果非d_is_dir(victim)则返回:负ENOTDIR
2763  如果linux/include/linux/dcache.h* Dirent cache data structures* (C) Copyright 1997 Thomas Schoebel-Theuer,* with heavy changes by Linus Torvalds(victim)则返回:负EBUSY
2765  否则如果d_is_dir(victim)则返回:负EISDIR
2767  如果IS_DEADDIR(dir)则返回:负ENOENT
2769  如果 protected by d_lock 按位与DCACHE_NFSFS_RENAMED则返回:负EBUSY
2771  返回:0
调用者
名称描述
vfs_rmdir
vfs_unlinkvfs_unlink - unlink a filesystem object*@dir: parent directory*@dentry: victim*@delegated_inode: returns victim inode, if the inode is delegated.* The caller must hold dir->i_mutex.* If vfs_unlink discovers a delegation, it will return -EWOULDBLOCK and
vfs_renamevfs_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