Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:io_sqe_files_register

Proto:static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args)

Type:int

Parameter:

TypeParameterName
struct io_ring_ctx *ctx
void __user *arg
unsignednr_args
4282  __user * fds = arg
4284  ret = 0
4287  If * If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2). Then Return -EBUSY
4289  If Not nr_args Then Return -EINVAL
4291  If nr_args > IORING_MAX_FIXED_FILES Then Return -EMFILE
4294  nr_tables = DIV_ROUND_UP(nr_args, IORING_MAX_FILES_TABLE)
4295  * If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2). = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
4297  If Not * If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2). Then Return -ENOMEM
4300  If io_sqe_alloc_file_tables(ctx, nr_tables, nr_args) Then
4301  kfree(* If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2).)
4302  * If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2). = NULL
4303  Return -ENOMEM
4306  When i < nr_args cycle
4310  ret = -EFAULT
4311  If copy_from_user( & fd, & fds[i], size of fd ) Then Break
4314  If fd == -1 Then
4315  ret = 0
4316  Continue
4319  table = * If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2).[i >> Shift of 9 is 512 entries, or exactly one page on 64-bit archs]
4320  index = i & IORING_FILE_TABLE_MASK
4321  files[index] = fget(fd)
4323  ret = -EBADF
4324  If Not files[index] Then Break
4333  If f_op == io_uring_fops Then
4334  fput(files[index])
4335  Break
4337  ret = 0
4340  If ret Then
4341  When i < nr_user_files cycle
4345  If file Then fput(file)
4348  When i < nr_tables cycle kfree(files)
4351  kfree(* If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2).)
4352  * If used, fixed file set. Writers must ensure that ->refs is dead, * readers must ensure that ->refs is alive as long as the file* is * used. Only updated through io_uring_register(2). = NULL
4353  nr_user_files = 0
4354  Return ret
4357  ret = io_sqe_files_scm(ctx)
4358  If ret Then io_sqe_files_unregister(ctx)
4361  Return ret
Caller
NameDescribe
__io_uring_register