Function report |
Source Code:fs\userfaultfd.c |
Create Date:2022-07-28 20:20:36 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:userfaultfd_register
Proto:static int userfaultfd_register(struct userfaultfd_ctx *ctx, unsigned long arg)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct userfaultfd_ctx * | ctx | |
| unsigned long | arg |
| 1309 | __user * user_uffdio_register |
| 1315 | user_uffdio_register = arg |
| 1318 | If copy_from_user( & uffdio_register, user_uffdio_register, size of uffdio_register - sizeof(__u64)) Then Go to out |
| 1325 | If mode & ~(UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP) Then Go to out |
| 1328 | vm_flags = 0 |
| 1329 | If mode & UFFDIO_REGISTER_MODE_MISSING Then vm_flags |= missing pages tracking |
| 1331 | If mode & UFFDIO_REGISTER_MODE_WP Then |
| 1341 | ret = validate_range(mm, & start, len) |
| 1350 | If Not mmget_not_zero(mm) Then Go to out |
| 1353 | lock for writing |
| 1357 | If Not vma Then Go to out_unlock |
| 1362 | If Our start address within vm_mm. >= end Then Go to out_unlock |
| 1369 | If is_vm_hugetlb_page(vma) Then |
| 1370 | vma_hpagesize = Return the size of the pages allocated when backing a VMA. In the majority* cases this will be same size as used by the page table entries. |
| 1372 | If start & vma_hpagesize - 1 Then Go to out_unlock |
| 1379 | found = false |
| 1380 | basic_ioctls = false |
| 1381 | When cur && Our start address within vm_mm. < end cycle |
| 1382 | cond_resched() |
| 1384 | BUG_ON(!!ctx ^ !!(Flags, see mm.h. & (missing pages tracking | wrprotect pages tracking ))) |
| 1389 | If Not vma_can_userfault(cur) Then Go to out_unlock |
| 1401 | If Value for the false possibility is greater at compile time(!(Flags, see mm.h. & VM_MAYWRITE)) Then Go to out_unlock |
| 1408 | If is_vm_hugetlb_page(cur) && end <= The first byte after our end addresswithin vm_mm. && end > Our start address within vm_mm. Then |
| 1410 | vma_hpagesize = Return the size of the pages allocated when backing a VMA. In the majority* cases this will be same size as used by the page table entries. |
| 1414 | If end & vma_hpagesize - 1 Then Go to out_unlock |
| 1425 | If ctx && ctx != ctx Then Go to out_unlock |
| 1432 | If is_vm_hugetlb_page(cur) Then basic_ioctls = true |
| 1435 | found = true |
| 1439 | If Our start address within vm_mm. < start Then prev = vma |
| 1442 | ret = 0 |
| 1443 | Do |
| 1444 | cond_resched() |
| 1446 | BUG_ON(!vma_can_userfault(vma)) |
| 1449 | WARN_ON(!(Flags, see mm.h. & VM_MAYWRITE)) |
| 1459 | If Our start address within vm_mm. > start Then start = Our start address within vm_mm. |
| 1461 | vma_end = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(end, The first byte after our end addresswithin vm_mm. ) |
| 1463 | new_flags = Flags, see mm.h. & ~(missing pages tracking | wrprotect pages tracking ) | vm_flags |
| 1465 | prev = Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor |
| 1469 | If prev Then |
| 1473 | If Our start address within vm_mm. < start Then |
| 1474 | ret = split a vma into two pieces at address 'addr', a new vma is allocated either* for the first part or the tail. |
| 1475 | If ret Then Break |
| 1478 | If The first byte after our end addresswithin vm_mm. > end Then |
| 1479 | ret = Split a vma into two pieces at address 'addr', a new vma is allocated* either for the first part or the tail. |
| 1480 | If ret Then Break |
| 1483 | next : |
| 1489 | Flags, see mm.h. = new_flags |
| 1492 | skip : |
| 1496 | When vma && Our start address within vm_mm. < end cycle |
| 1497 | out_unlock : |
| 1498 | lease a write lock |
| 1500 | If Not ret Then |
| 1511 | out : |
| 1512 | Return ret |
| Name | Describe |
|---|---|
| userfaultfd_ioctl |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |