]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 1999-2007 Apple Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
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. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
1c79356b A |
29 | * Header file for Unified Buffer Cache. |
30 | * | |
31 | */ | |
32 | ||
33 | #ifndef _SYS_UBC_H_ | |
34 | #define _SYS_UBC_H_ | |
35 | ||
9bccf70c | 36 | #include <sys/appleapiopts.h> |
1c79356b | 37 | #include <sys/cdefs.h> |
91447636 A |
38 | #include <sys/kernel_types.h> |
39 | #include <kern/locks.h> | |
1c79356b A |
40 | #include <mach/memory_object_types.h> |
41 | ||
1c79356b | 42 | |
91447636 | 43 | /* defns for ubc_sync_range() and ubc_msync */ |
1c79356b | 44 | |
91447636 A |
45 | #define UBC_PUSHDIRTY 0x01 /* clean any dirty pages in the specified range to the backing store */ |
46 | #define UBC_PUSHALL 0x02 /* push both dirty and precious pages to the backing store */ | |
47 | #define UBC_INVALIDATE 0x04 /* invalidate pages in the specified range... may be used with UBC_PUSHDIRTY/ALL */ | |
48 | #define UBC_SYNC 0x08 /* wait for I/Os generated by UBC_PUSHDIRTY to complete */ | |
1c79356b A |
49 | |
50 | __BEGIN_DECLS | |
0b4e3aa0 | 51 | |
91447636 A |
52 | off_t ubc_blktooff(struct vnode *, daddr64_t); |
53 | daddr64_t ubc_offtoblk(struct vnode *, off_t); | |
54 | off_t ubc_getsize(struct vnode *); | |
55 | int ubc_setsize(struct vnode *, off_t); | |
0b4e3aa0 | 56 | |
2d21ac55 | 57 | kauth_cred_t ubc_getcred(struct vnode *); |
13fec989 A |
58 | struct thread; |
59 | int ubc_setthreadcred(struct vnode *, struct proc *, struct thread *); | |
1c79356b | 60 | |
91447636 A |
61 | int ubc_sync_range(vnode_t, off_t, off_t, int); |
62 | errno_t ubc_msync(vnode_t, off_t, off_t, off_t *, int); | |
63 | int ubc_pages_resident(vnode_t); | |
b0d623f7 A |
64 | int ubc_page_op(vnode_t, off_t, int, ppnum_t *, int *); |
65 | int ubc_range_op(vnode_t, off_t, off_t, int, int *); | |
1c79356b | 66 | |
b0d623f7 A |
67 | #ifdef KERNEL_PRIVATE |
68 | /* This API continues to exist only until <rdar://4714366> is resolved */ | |
69 | int ubc_setcred(struct vnode *, struct proc *) __deprecated; | |
2d21ac55 A |
70 | /* code signing */ |
71 | struct cs_blob; | |
2d21ac55 | 72 | struct cs_blob *ubc_cs_blob_get(vnode_t, cpu_type_t, off_t); |
6d2010ae | 73 | int cs_entitlements_blob_get(proc_t p, void **, size_t *); |
b0d623f7 | 74 | #endif |
1c79356b | 75 | |
91447636 A |
76 | /* cluster IO routines */ |
77 | int advisory_read(vnode_t, off_t, off_t, int); | |
2d21ac55 | 78 | int advisory_read_ext(vnode_t, off_t, off_t, int, int (*)(buf_t, void *), void *, int); |
1c79356b | 79 | |
91447636 | 80 | int cluster_read(vnode_t, struct uio *, off_t, int); |
2d21ac55 A |
81 | int cluster_read_ext(vnode_t, struct uio *, off_t, int, int (*)(buf_t, void *), void *); |
82 | ||
91447636 | 83 | int cluster_write(vnode_t, struct uio *, off_t, off_t, off_t, off_t, int); |
2d21ac55 A |
84 | int cluster_write_ext(vnode_t, struct uio *, off_t, off_t, off_t, off_t, int, int (*)(buf_t, void *), void *); |
85 | ||
b0d623f7 A |
86 | int cluster_pageout(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int); |
87 | int cluster_pageout_ext(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int, int (*)(buf_t, void *), void *); | |
2d21ac55 | 88 | |
b0d623f7 A |
89 | int cluster_pagein(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int); |
90 | int cluster_pagein_ext(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int, int (*)(buf_t, void *), void *); | |
2d21ac55 | 91 | |
91447636 | 92 | int cluster_push(vnode_t, int); |
2d21ac55 A |
93 | int cluster_push_ext(vnode_t, int, int (*)(buf_t, void *), void *); |
94 | ||
95 | int cluster_bp(buf_t); | |
96 | int cluster_bp_ext(buf_t, int (*)(buf_t, void *), void *); | |
97 | ||
b0d623f7 | 98 | void cluster_zero(upl_t, upl_offset_t, int, buf_t); |
2d21ac55 A |
99 | |
100 | int cluster_copy_upl_data(uio_t, upl_t, int, int *); | |
101 | int cluster_copy_ubc_data(vnode_t, uio_t, int *, int); | |
1c79356b | 102 | |
1c79356b | 103 | |
91447636 | 104 | /* UPL routines */ |
b0d623f7 A |
105 | int ubc_create_upl(vnode_t, off_t, int, upl_t *, upl_page_info_t **, int); |
106 | int ubc_upl_map(upl_t, vm_offset_t *); | |
91447636 A |
107 | int ubc_upl_unmap(upl_t); |
108 | int ubc_upl_commit(upl_t); | |
109 | int ubc_upl_commit_range(upl_t, upl_offset_t, upl_size_t, int); | |
110 | int ubc_upl_abort(upl_t, int); | |
111 | int ubc_upl_abort_range(upl_t, upl_offset_t, upl_size_t, int); | |
316670eb | 112 | void ubc_upl_range_needed(upl_t, int, int); |
1c79356b | 113 | |
91447636 | 114 | upl_page_info_t *ubc_upl_pageinfo(upl_t); |
2d21ac55 | 115 | upl_size_t ubc_upl_maxbufsize(void); |
1c79356b | 116 | |
b0d623f7 A |
117 | int is_file_clean(vnode_t, off_t); |
118 | ||
91447636 | 119 | __END_DECLS |
9bccf70c | 120 | |
1c79356b A |
121 | #endif /* _SYS_UBC_H_ */ |
122 |