Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:alloc_fdtable

Proto:static struct fdtable *alloc_fdtable(unsigned int nr)

Type:struct fdtable

Parameter:

TypeParameterName
unsigned intnr
97  nr /= 1024 / size of *
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 / size of *
108  If Value for the false possibility is greater at compile time(nr > sysctl_nr_open) Then nr = ( sysctl_nr_open - 1 | BITS_PER_LONG - 1 ) + 1
111  fdt = Allocation memory
112  If Not fdt Then Go to out
114  max_fds = nr
115  data = kvmalloc_array(nr, size of * , GFP_KERNEL_ACCOUNT)
116  If Not data Then Go to 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  If Not data Then Go to out_arr
125  open_fds = data
126  data += nr / BITS_PER_BYTE
127  close_on_exec = data
128  data += nr / BITS_PER_BYTE
129  full_fds_bits = data
131  Return 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  kfree(fdt)
137  out :
138  Return NULL
Caller
NameDescribe
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.