Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ramfs_nommu_get_unmapped_area

Proto:static unsigned long ramfs_nommu_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)

Type:unsigned long

Parameter:

TypeParameterName
struct file *file
unsigned longaddr
unsigned longlen
unsigned longpgoff
unsigned longflags
206  inode = file_inode(file)
207  pages = NULL
211  lpages = len + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
212  isize = NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
214  ret = -ENOSYS
215  maxpages = isize + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
216  If pgoff >= maxpages Then Go to out
219  If maxpages - pgoff < lpages Then Go to out
223  pages = 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).
224  If Not pages Then Go to out_free
227  nr = find_get_pages(i_mapping, & pgoff, lpages, pages)
228  If nr != lpages Then Go to out_free_pages
232  ptr = pages
233  page = ptr++
234  page++
235  When loop > 1 cycle If ptr++ != page++ Then
237  Go to out_free_pages
240  ret = page_address(pages[0])
242  out_free_pages :
243  ptr = pages
244  When loop > 0 cycle Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
246  out_free :
247  kfree(pages)
248  out :
249  Return ret