Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:io_sqe_buffer_register

Proto:static int io_sqe_buffer_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
4765  struct vm_area_struct * * vmas = NULL
4766  struct page * * pages = NULL
4767  got_pages = 0
4768  ret = -EINVAL
4770  If user_bufs Then Return -EBUSY
4772  If Not nr_args || nr_args > UIO_MAXIOV Then Return -EINVAL
4775  user_bufs = 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).
4777  If Not user_bufs Then Return -ENOMEM
4780  When i < nr_args cycle
4781  imu = user_bufs[i]
4787  ret = io_copy_iov(ctx, & iov, arg, i)
4788  If ret Then Go to err
4796  ret = -EFAULT
4797  If Not BSD uses caddr_t (1003.1g requires void *) || Not Must be size_t (1003.1g) Then Go to err
4801  If Must be size_t (1003.1g) > SZ_1G Then Go to err
4804  ubuf = BSD uses caddr_t (1003.1g requires void *)
4805  end = ubuf + Must be size_t (1003.1g) + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
4806  start = ubuf >> PAGE_SHIFT determines the page size
4807  nr_pages = end - start
4809  If account_mem Then
4811  If ret Then Go to err
4815  ret = 0
4816  If Not pages || nr_pages > got_pages Then
4817  kfree(vmas)
4818  kfree(pages)
4819  pages = kvmalloc_array(nr_pages, size of * , GFP_KERNEL)
4821  vmas = kvmalloc_array(nr_pages, size of * , GFP_KERNEL)
4824  If Not pages || Not vmas Then
4825  ret = -ENOMEM
4828  Go to err
4830  got_pages = nr_pages
4833  bvec = kvmalloc_array(nr_pages, sizeof(structbio_vec), GFP_KERNEL)
4835  ret = -ENOMEM
4836  If Not bvec Then
4839  Go to err
4842  ret = 0
4843  lock for reading
4844  pret = This is the same as get_user_pages_remote(), just with a* less-flexible calling convention where we assume that the task* and mm being operated on are the current task's and don't allow* passing of a locked parameter. We also obviously don't pass
4847  If pret == nr_pages Then
4849  When j < nr_pages cycle
4858  Else
4859  ret = If pret < 0 Then pret Else -EFAULT
4861  lease a read lock
4862  If ret Then
4872  Go to err
4875  off = ubuf & ~PAGE_MASK
4876  size = Must be size_t (1003.1g)
4877  When j < nr_pages cycle
4881  bv_page = pages[j]
4882  bv_len = vec_len
4883  bv_offset = off
4884  off = 0
4885  size -= vec_len
4888  ubuf = ubuf
4889  len = Must be size_t (1003.1g)
4890  nr_bvecs = nr_pages
4892  if used, fixed mapped user buffers ++
4894  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.
4895  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.
4896  Return 0
4897  err :
4898  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.
4899  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.
4900  io_sqe_buffer_unregister(ctx)
4901  Return ret
Caller
NameDescribe
__io_uring_register