* vm_map_entry_clone * * Create a duplicate map entry for clipping. */
| 2423 | * Create a duplicate map entry for clipping. |
| 2424 | */ |
| 2425 | static vm_map_entry_t |
| 2426 | vm_map_entry_clone(vm_map_t map, vm_map_entry_t entry) |
| 2427 | { |
| 2428 | vm_map_entry_t new_entry; |
| 2429 | |
| 2430 | VM_MAP_ASSERT_LOCKED(map); |
| 2431 | |
| 2432 | /* |
| 2433 | * Create a backing object now, if none exists, so that more individual |
| 2434 | * objects won't be created after the map entry is split. |
| 2435 | */ |
| 2436 | vm_map_entry_charge_object(map, entry); |
| 2437 | |
| 2438 | /* Clone the entry. */ |
| 2439 | new_entry = vm_map_entry_create(map); |
| 2440 | *new_entry = *entry; |
| 2441 | if (new_entry->cred != NULL) |
| 2442 | crhold(entry->cred); |
| 2443 | if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { |
| 2444 | vm_object_reference(new_entry->object.vm_object); |
| 2445 | vm_map_entry_set_vnode_text(new_entry, true); |
| 2446 | /* |
| 2447 | * The object->un_pager.vnp.writemappings for the object of |
| 2448 | * MAP_ENTRY_WRITECNT type entry shall be kept as is here. The |
| 2449 | * virtual pages are re-distributed among the clipped entries, |
| 2450 | * so the sum is left the same. |
| 2451 | */ |
| 2452 | } |
| 2453 | return (new_entry); |
| 2454 | } |
| 2455 | |
| 2456 | /* |
| 2457 | * vm_map_clip_start: [ internal use only ] |
no test coverage detected