1 /* 2 * Copyright (c) 2023 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 29 #ifndef _VM_VM_UBC_H_ 30 #define _VM_VM_UBC_H_ 31 32 #include <sys/cdefs.h> 33 #include <mach/memory_object_types.h> 34 #include <mach/mach_types.h> 35 #include <kern/kern_types.h> 36 #include <vm/vm_options.h> 37 38 /* 39 * The upl declarations are all usable by ubc 40 */ 41 #include <vm/vm_upl.h> 42 __BEGIN_DECLS 43 44 struct vnode; 45 46 extern struct vnode * upl_lookup_vnode(upl_t upl); 47 48 extern upl_t vector_upl_create(vm_offset_t, uint32_t); 49 extern upl_size_t vector_upl_get_size(const upl_t); 50 extern boolean_t vector_upl_is_valid(upl_t); 51 extern boolean_t vector_upl_set_subupl(upl_t, upl_t, u_int32_t); 52 extern void vector_upl_set_pagelist(upl_t); 53 uint32_t vector_upl_max_upls(const upl_t upl); 54 55 56 extern kern_return_t memory_object_pages_resident( 57 memory_object_control_t control, 58 boolean_t * has_pages_resident); 59 60 extern kern_return_t memory_object_signed( 61 memory_object_control_t control, 62 boolean_t is_signed); 63 64 extern boolean_t memory_object_is_signed( 65 memory_object_control_t control); 66 67 extern void memory_object_mark_used( 68 memory_object_control_t control); 69 70 extern void memory_object_mark_unused( 71 memory_object_control_t control, 72 boolean_t rage); 73 74 extern void memory_object_mark_io_tracking( 75 memory_object_control_t control); 76 77 extern void memory_object_mark_trusted( 78 memory_object_control_t control); 79 80 81 extern memory_object_t vnode_pager_setup( 82 struct vnode *, memory_object_t); 83 84 extern void vnode_pager_deallocate( 85 memory_object_t); 86 extern void vnode_pager_vrele( 87 struct vnode *vp); 88 89 extern kern_return_t memory_object_create_named( 90 memory_object_t pager, 91 memory_object_offset_t size, 92 memory_object_control_t *control); 93 94 typedef int pager_return_t; 95 extern pager_return_t vnode_pagein( 96 struct vnode *, upl_t, 97 upl_offset_t, vm_object_offset_t, 98 upl_size_t, int, int *); 99 extern pager_return_t vnode_pageout( 100 struct vnode *, upl_t, 101 upl_offset_t, vm_object_offset_t, 102 upl_size_t, int, int *); 103 104 __END_DECLS 105 106 #endif /* _VM_VM_UBC_H_ */ 107