函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:do_dentry_open

函数原型:static int do_dentry_open(struct file *f, struct inode *inode, int (*open)(struct inode *, struct file *))

返回类型:int

参数:

类型参数名称
struct file *f
struct inode *inode
int (*open
740  static const struct file_operations empty_fops = {}
743  path_get( & f_path)
744  cached value 等于inode
745  f_mapping等于i_mapping
748  f_wb_err等于lemap_sample_wb_err - sample the current errseq_t to test for later errors*@mapping: mapping to be sampled* Writeback errors are always reported relative to a particular sample point* in the past. This function provides those sample points.
750  如果此条件成立可能性小(为编译器优化)(f_flags & O_PATH)则
751  f_mode等于File is opened with O_PATH; almost nothing can be done with it 按位或FMODE_OPENED
752  f_op等于empty_fops
753  返回:0
757  如果此条件成立可能性小(为编译器优化)(f_flags & File is opened for execution with sys_execve / sys_uselib && !S_ISREG(i_mode))则
758  error等于负EACCES
759  转到:cleanup_file
762  如果f_mode按位与le is open for writing 且非special_file(i_mode)则
763  error等于get_write_access() gets write permission for a file.* put_write_access() releases this write permission.* This is used for regular files.* We cannot support write (and maybe mmap read-write shared) accesses and* MAP_DENYWRITE mmappings simultaneously
764  如果此条件成立可能性小(为编译器优化)(error)则转到:cleanup_file
766  error等于__mnt_want_write(mnt)
769  转到:cleanup_file
771  f_mode或等于Write access to underlying fs
775  如果S_ISREG(i_mode)或S_ISDIR(i_mode)则f_mode或等于File needs atomic accesses to f_pos
778  f_op等于Alas, no aliases. Too much hassle with bringing module.h everywhere (rmer ->i_op->default_file_ops )
779  如果WARN_ON(!f_op)则
780  error等于负ENODEV
781  转到:cleanup_all
784  error等于security_file_open(f)
785  如果error则转到:cleanup_all
788  error等于break_lease(locks_inode(f), f_flags)
789  如果error则转到:cleanup_all
793  f_mode或等于le is seekable 按位或le can be accessed using pread 按位或le can be accessed using pwrite
794  如果非openopen等于open
796  如果open
797  error等于open(inode, f)
798  如果error则转到:cleanup_all
801  f_mode或等于FMODE_OPENED
802  如果f_mode按位与le is open for reading 按位或le is open for writing 的值的值恒等于le is open for reading i_readcount_inc(inode)
804  如果f_mode按位与le is open for reading 此条件成立可能性大(为编译器优化)(read || read_iter)则f_mode或等于Has read method(s)
807  如果f_mode按位与le is open for writing 此条件成立可能性大(为编译器优化)(write || write_iter)则f_mode或等于Has write method(s)
811  f_write_hint等于WRITE_LIFE_NOT_SET
812  f_flags与等于O_CREAT按位或O_EXCL按位或O_NOCTTY按位或O_TRUNC的值的反
814  Initialise a struct file's readahead state. Assumes that the caller has* memset *ra to zero.
817  如果f_flags按位与O_DIRECT
818  如果非a_ops或非direct_IO则返回:负EINVAL
826  如果f_mode按位与le is open for writing filemap_nr_thps(i_mapping)则runcate_pagecache - unmap and remove pagecache that has been truncated*@inode: inode*@newsize: new file size* inode's new i_size must already be written before truncate_pagecache* is called.* This function should typically be called before the filesystem
829  返回:0
831  cleanup_all :
832  如果WARN_ON_ONCE(error > 0)则error等于负EINVAL
834  fops_put(f_op)
835  如果f_mode按位与Write access to underlying fs
836  put_write_access(inode)
837  __mnt_drop_write(mnt)
839  cleanup_file :
840  path_put( & f_path)
841  mnt = NULL
842  dentry = NULL
843  cached value = NULL
844  返回:error
调用者
名称描述
finish_opensh_open - finish opening a file*@file: file pointer*@dentry: pointer to dentry*@open: open callback*@opened: state of open* This can be used to finish opening a file passed to i_op->atomic_open()
vfs_openvfs_open - open the file at the given path*@path: path to open*@file: newly allocated file with f_flag initialized*@cred: credentials to use
open_with_fake_path