Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__alloc_file

Proto:static struct file *__alloc_file(int flags, const struct cred *cred)

Type:struct file

Parameter:

TypeParameterName
intflags
const struct cred *cred
101  f = Shortcuts
102  If Value for the false possibility is greater at compile time(!f) Then Return ERR_PTR( - ENOMEM)
105  f_cred = get_cred - Get a reference on a set of credentials*@cred: The credentials to reference* Get a reference on the specified set of credentials. The caller must* release the reference. If %NULL is passed, it is returned with no action.
106  error = security_file_alloc(f)
107  If Value for the false possibility is greater at compile time(error) Then
108  file_free_rcu( & fu_rcuhead)
109  Return ERR_PTR(error)
112  atomic_long_set( & f_count, 1)
113  rwlock_init( & lock)
114  Process spin lock initialization( & * Protects f_ep_links, f_flags. * Must not be taken from IRQ context.)
115  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & f_pos_lock)
116  Used to initialize the epoll bits inside the "struct file"
117  f_flags = flags
118  f_mode = OPEN_FMODE(flags)
121  Return f
Caller
NameDescribe
alloc_empty_fileFind an unused file structure and return a pointer to it
alloc_empty_file_noaccountVariant of alloc_empty_file() that doesn't check and modify nr_files.* Should not be used unless there's a very good reason to do so.