2 * Copyright (c) 2013 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifdef XNU_KERNEL_PRIVATE
31 #ifndef _VM_VM_COMPRESSOR_PAGER_H_
32 #define _VM_VM_COMPRESSOR_PAGER_H_
34 #include <mach/mach_types.h>
35 #include <kern/kern_types.h>
36 #include <vm/vm_external.h>
38 extern kern_return_t
vm_compressor_pager_put(
39 memory_object_t mem_obj
,
40 memory_object_offset_t offset
,
44 extern kern_return_t
vm_compressor_pager_get(
45 memory_object_t mem_obj
,
46 memory_object_offset_t offset
,
51 #define C_DONT_BLOCK 0x01
54 extern void vm_compressor_pager_state_clr(
55 memory_object_t mem_obj
,
56 memory_object_offset_t offset
);
57 extern vm_external_state_t
vm_compressor_pager_state_get(
58 memory_object_t mem_obj
,
59 memory_object_offset_t offset
);
61 #define VM_COMPRESSOR_PAGER_STATE_GET(object, offset) \
62 (((COMPRESSED_PAGER_IS_ACTIVE || DEFAULT_FREEZER_COMPRESSED_PAGER_IS_ACTIVE) && \
63 (object)->internal && \
64 (object)->pager != NULL && \
65 !(object)->terminating && \
67 ? vm_compressor_pager_state_get((object)->pager, \
68 (offset) + (object)->paging_offset) \
69 : VM_EXTERNAL_STATE_UNKNOWN)
71 #define VM_COMPRESSOR_PAGER_STATE_CLR(object, offset) \
73 if ((COMPRESSED_PAGER_IS_ACTIVE || DEFAULT_FREEZER_COMPRESSED_PAGER_IS_ACTIVE) && \
74 (object)->internal && \
75 (object)->pager != NULL && \
76 !(object)->terminating && \
78 vm_compressor_pager_state_clr( \
80 (offset) + (object)->paging_offset); \
84 extern void vm_compressor_init(void);
85 extern int vm_compressor_put(ppnum_t pn
, int *slot
, void **current_chead
, char *scratch_buf
);
86 extern int vm_compressor_get(ppnum_t pn
, int *slot
, int flags
);
87 extern void vm_compressor_free(int *slot
);
89 #endif /* _VM_VM_COMPRESSOR_PAGER_H_ */
91 #endif /* XNU_KERNEL_PRIVATE */