函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:alloc_fdtable

函数原型:static struct fdtable *alloc_fdtable(unsigned int nr)

返回类型:struct fdtable

参数:

类型参数名称
unsigned intnr
97  nr除等于1024除*的长度
98  nr等于undup_pow_of_two - round the given value up to nearest power of two*@n: parameter* round the given value up to the nearest power of two* - the result is undefined when n == 0* - this can be used to initialise global variables from constant data(nr + 1)
99  nr乘等于1024除*的长度
108  如果此条件成立可能性小(为编译器优化)(nr > sysctl_nr_open)则nr等于sysctl_nr_open减1按位或BITS_PER_LONG减1的值加1
111  fdt等于开辟内存
112  如果非fdt则转到:out
114  max_fds等于nr
115  data等于kvmalloc_array(nr, *的长度, GFP_KERNEL_ACCOUNT)
116  如果非data则转到:out_fdt
118  current fd array 等于data
120  data等于kvmalloc(max_t - return maximum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, 2 * nr / BITS_PER_BYTE + BITBIT_SIZE(nr), L1_CACHE_BYTES), GFP_KERNEL_ACCOUNT)
123  如果非data则转到:out_arr
125  open_fds等于data
126  data加等于nrBITS_PER_BYTE
127  close_on_exec等于data
128  data加等于nrBITS_PER_BYTE
129  full_fds_bits等于data
131  返回:fdt
133  out_arr :
134  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
135  out_fdt :
136  释放内存
137  out :
138  返回:NULL
调用者
名称描述
expand_fdtableExpand the file descriptor table.* This function will allocate a new fdtable and both fd array and fdset, of* the given size.* Return <0 error code on error; 1 on successful completion.
dup_fdAllocate a new files structure and copy contents from the* passed in files structure.* errorp will be valid only when the returned files_struct is NULL.