* Return the vnode for the given object, or NULL if none exists. * For tmpfs objects, the function may return NULL if there is * no vnode allocated at the time of the call. */
| 2430 | * no vnode allocated at the time of the call. |
| 2431 | */ |
| 2432 | struct vnode * |
| 2433 | vm_object_vnode(vm_object_t object) |
| 2434 | { |
| 2435 | struct vnode *vp; |
| 2436 | |
| 2437 | VM_OBJECT_ASSERT_LOCKED(object); |
| 2438 | if (object->type == OBJT_VNODE) { |
| 2439 | vp = object->handle; |
| 2440 | KASSERT(vp != NULL, ("%s: OBJT_VNODE has no vnode", __func__)); |
| 2441 | } else if (object->type == OBJT_SWAP && |
| 2442 | (object->flags & OBJ_TMPFS) != 0) { |
| 2443 | vp = object->un_pager.swp.swp_tmpfs; |
| 2444 | KASSERT(vp != NULL, ("%s: OBJT_TMPFS has no vnode", __func__)); |
| 2445 | } else { |
| 2446 | vp = NULL; |
| 2447 | } |
| 2448 | return (vp); |
| 2449 | } |
| 2450 | |
| 2451 | /* |
| 2452 | * Busy the vm object. This prevents new pages belonging to the object from |
no outgoing calls
no test coverage detected