* Return an initialized object. */
| 82 | * Return an initialized object. |
| 83 | */ |
| 84 | static vm_object_t |
| 85 | default_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, |
| 86 | vm_ooffset_t offset, struct ucred *cred) |
| 87 | { |
| 88 | vm_object_t object; |
| 89 | |
| 90 | if (handle != NULL) |
| 91 | panic("default_pager_alloc: handle specified"); |
| 92 | if (cred != NULL) { |
| 93 | if (!swap_reserve_by_cred(size, cred)) |
| 94 | return (NULL); |
| 95 | crhold(cred); |
| 96 | } |
| 97 | object = vm_object_allocate(OBJT_DEFAULT, |
| 98 | OFF_TO_IDX(round_page(offset + size))); |
| 99 | if (cred != NULL) { |
| 100 | object->cred = cred; |
| 101 | object->charge = size; |
| 102 | } |
| 103 | return (object); |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | * Deallocate resources associated with the object. |
nothing calls this directly
no test coverage detected