| 655 | } |
| 656 | |
| 657 | static vm_object_t |
| 658 | swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size, |
| 659 | vm_ooffset_t offset) |
| 660 | { |
| 661 | vm_object_t object; |
| 662 | |
| 663 | if (cred != NULL) { |
| 664 | if (!swap_reserve_by_cred(size, cred)) |
| 665 | return (NULL); |
| 666 | crhold(cred); |
| 667 | } |
| 668 | |
| 669 | /* |
| 670 | * The un_pager.swp.swp_blks trie is initialized by |
| 671 | * vm_object_allocate() to ensure the correct order of |
| 672 | * visibility to other threads. |
| 673 | */ |
| 674 | object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + |
| 675 | PAGE_MASK + size)); |
| 676 | |
| 677 | object->un_pager.swp.writemappings = 0; |
| 678 | object->handle = handle; |
| 679 | if (cred != NULL) { |
| 680 | object->cred = cred; |
| 681 | object->charge = size; |
| 682 | } |
| 683 | return (object); |
| 684 | } |
| 685 | |
| 686 | /* |
| 687 | * SWAP_PAGER_ALLOC() - allocate a new OBJT_SWAP VM object and instantiate |
no test coverage detected