Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: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

Proto:static int may_delete(struct inode *dir, struct dentry *victim, bool isdir)

Type:int

Parameter:

TypeParameterName
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  If d_is_negative(victim) Then Return -ENOENT
2741  BUG_ON(!inode)
2743  BUG_ON( Where the name belongs to - NULL is * negative != dir)
2746  If Not uid_valid(i_uid) || Not gid_valid(i_gid) Then Return -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  If error Then Return error
2754  If IS_APPEND(dir) Then Return -EPERM
2757  If check_sticky(dir, inode) || IS_APPEND(inode) || IS_IMMUTABLE(inode) || IS_SWAPFILE(inode) || HAS_UNMAPPED_ID(inode) Then Return -EPERM
2760  If isdir Then
2761  If Not d_is_dir(victim) Then Return -ENOTDIR
2763  If linux/include/linux/dcache.h* Dirent cache data structures* (C) Copyright 1997 Thomas Schoebel-Theuer,* with heavy changes by Linus Torvalds(victim) Then Return -EBUSY
2765  Else if d_is_dir(victim) Then Return -EISDIR
2767  If IS_DEADDIR(dir) Then Return -ENOENT
2769  If protected by d_lock & DCACHE_NFSFS_RENAMED Then Return -EBUSY
2771  Return 0
Caller
NameDescribe
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