函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Handle the last step of open()

函数原型:static int do_last(struct nameidata *nd, struct file *file, const struct open_flags *op)

返回类型:int

参数:

类型参数名称
struct nameidata *nd
struct file *file
const struct open_flags *op
3204  dir等于dentry
3205  dir_uid等于i_uid
3206  dir_mode等于i_mode
3207  open_flag等于open_flag
3208  will_truncate等于open_flag按位与O_TRUNC的值不等于0
3209  bool got_write = false
3210  acc_mode等于acc_mode
3216  flags与等于rnal use only 的反
3217  flags或等于intent
3219  如果last_type不等于LAST_NORM
3220  error等于handle_dots(nd, last_type)
3221  如果此条件成立可能性小(为编译器优化)(error)则返回:error
3223  转到:finish_open
3226  如果非open_flag按位与O_CREAT的值则
3227  如果name[len]则flags或等于llow links at the end 按位或quire a directory
3230  error等于lookup_fast(nd, & path, & inode, & seq)
3231  如果此条件成立可能性大(为编译器优化)(error > 0)则转到:finish_lookup
3234  如果error小于0则返回:error
3237  BUG_ON( path.dentry.d_inode != Where the name belongs to - NULL is * negative )
3238  BUG_ON(flags & RCU pathwalk mode; semi-internal )
3239  否则
3246  error等于mplete_walk - successful completion of path walk*@nd: pointer nameidata* If we had been in RCU mode, drop out of it and legitimize nd->path.* Revalidate the final result, unless we'd already done that during
3247  如果error则返回:error
3250  audit_inode(name, dir, dentry represents the parent )
3252  如果此条件成立可能性小(为编译器优化)(name[len])则返回:负EISDIR
3256  如果open_flag按位与O_CREAT按位或O_TRUNC按位或O_WRONLY按位或O_RDWR的值则
3257  error等于mnt_want_write(mnt)
3258  如果非errorgot_write = true
3266  如果open_flag按位与O_CREATinode_lock( Where the name belongs to - NULL is * negative )
3268  否则inode_lock_shared( Where the name belongs to - NULL is * negative )
3270  error等于Look up and maybe create and open the last component
3271  如果open_flag按位与O_CREATinode_unlock( Where the name belongs to - NULL is * negative )
3273  否则inode_unlock_shared( Where the name belongs to - NULL is * negative )
3276  如果error则转到:out
3279  如果f_mode按位与FMODE_OPENED
3280  如果f_mode按位与FMODE_CREATED或非S_ISREG(i_mode)则will_truncate = false
3284  audit_inode(name, dentry, 0)
3285  转到:opened
3288  如果f_mode按位与FMODE_CREATED
3290  open_flag与等于O_TRUNC的反
3291  will_truncate = false
3292  acc_mode等于0
3293  path_to_nameidata( & path, nd)
3294  转到:finish_open_created
3302  如果got_write
3303  mnt_drop_write(mnt)
3304  got_write = false
3307  error等于Handle a dentry that is managed in some way.* - Flagged for transit management (autofs)* - Flagged as mountpoint* - Flagged as automount point* This may only be called in refwalk mode.* On success path->dentry is known positive.
3308  如果此条件成立可能性小(为编译器优化)(error < 0)则返回:error
3314  audit_inode(name, dentry, 0)
3316  如果此条件成立可能性小(为编译器优化)((open_flag & (O_EXCL | O_CREAT)) == (O_EXCL | O_CREAT))则
3317  path_to_nameidata( & path, nd)
3318  返回:负EEXIST
3321  seq等于0
3322  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
3323  finish_lookup :
3324  error等于Do we need to follow links? We _really_ want to be able* to do this check without having to look at inode->i_op,* so we keep a cache of "no, this doesn't need follow_link"* for the common case.
3325  如果此条件成立可能性小(为编译器优化)(error)则返回:error
3327  finish_open :
3329  error等于mplete_walk - successful completion of path walk*@nd: pointer nameidata* If we had been in RCU mode, drop out of it and legitimize nd->path.* Revalidate the final result, unless we'd already done that during
3330  如果error则返回:error
3332  audit_inode(name, dentry, 0)
3333  如果open_flag按位与O_CREAT
3334  error等于负EISDIR
3335  如果d_is_dir(dentry)则转到:out
3337  error等于may_create_in_sticky - Check whether an O_CREAT open in a sticky directory* should be allowed, or not, on files that already* exist
3339  如果此条件成立可能性小(为编译器优化)(error)则转到:out
3342  error等于负ENOTDIR
3343  如果flags按位与quire a directory 且非d_can_lookup(dentry)则转到:out
3345  如果非d_is_reg(dentry)则will_truncate = false
3348  如果will_truncate
3349  error等于mnt_want_write(mnt)
3350  如果error则转到:out
3352  got_write = true
3354  finish_open_created :
3355  error等于may_open( & path, acc_mode, open_flag)
3356  如果error则转到:out
3358  BUG_ON(f_mode & FMODE_OPENED)
3359  error等于vfs_open - open the file at the given path*@path: path to open*@file: newly allocated file with f_flag initialized*@cred: credentials to use
3360  如果error则转到:out
3362  opened :
3363  error等于ima_file_check(file, acc_mode)
3364  如果非errorwill_truncateerror等于handle_truncate(file)
3366  out :
3367  如果此条件成立可能性小(为编译器优化)(error > 0)则
3368  WARN_ON(1)
3369  error等于负EINVAL
3371  如果got_writemnt_drop_write(mnt)
3373  返回:error
调用者
名称描述
path_openat