Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:may_open

Proto:static int may_open(const struct path *path, int acc_mode, int flag)

Type:int

Parameter:

TypeParameterName
const struct path *path
intacc_mode
intflag
2892  dentry = dentry
2893  inode = Where the name belongs to - NULL is * negative
2896  If Not inode Then Return -ENOENT
2900  Case & == S_IFLNK
2901  Return -ELOOP
2902  Case & == S_IFDIR
2903  If acc_mode & MAY_WRITE Then Return -EISDIR
2905  Break
2906  Case & == S_IFBLK
2907  Case & == S_IFCHR
2908  If Not may_open_dev(path) Then Return -EACCES
2911  Case & == S_IFIFO
2912  Case & == S_IFSOCK
2913  flag &= ~O_TRUNC
2914  Break
2917  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
2918  If error Then Return error
2924  If IS_APPEND(inode) Then
2925  If (flag & O_ACCMODE) != O_RDONLY && Not (flag & O_APPEND) Then Return -EPERM
2927  If flag & O_TRUNC Then Return -EPERM
2932  If flag & O_NOATIME && Not inode_owner_or_capable(inode) Then Return -EPERM
2935  Return 0
Caller
NameDescribe
atomic_openAttempt to atomically look up, create and open a file from a negative* dentry
do_lastHandle the last step of open()
do_tmpfile