]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/ubc.h
c20839194a54b71d19ac444d5c7cbb2250b658bf
2 * Copyright (c) 1999-2004 Apple Computer, 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 * Header file for Unified Buffer Cache.
36 #include <sys/appleapiopts.h>
37 #include <sys/cdefs.h>
38 #include <sys/kernel_types.h>
39 #include <kern/locks.h>
40 #include <mach/memory_object_types.h>
43 /* defns for ubc_sync_range() and ubc_msync */
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 */
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
);
57 struct ucred
*ubc_getcred(struct vnode
*);
58 int ubc_setcred(struct vnode
*, struct proc
*);
60 int ubc_setthreadcred(struct vnode
*, struct proc
*, struct thread
*);
62 int ubc_sync_range(vnode_t
, off_t
, off_t
, int);
63 errno_t
ubc_msync(vnode_t
, off_t
, off_t
, off_t
*, int);
64 int ubc_pages_resident(vnode_t
);
67 /* cluster IO routines */
68 int advisory_read(vnode_t
, off_t
, off_t
, int);
70 int cluster_read(vnode_t
, struct uio
*, off_t
, int);
71 int cluster_write(vnode_t
, struct uio
*, off_t
, off_t
, off_t
, off_t
, int);
72 int cluster_pageout(vnode_t
, upl_t
, vm_offset_t
, off_t
, int, off_t
, int);
73 int cluster_pagein(vnode_t
, upl_t
, vm_offset_t
, off_t
, int, off_t
, int);
74 int cluster_push(vnode_t
, int);
75 int cluster_bp(buf_t
);
76 void cluster_zero(upl_t
, vm_offset_t
, int, buf_t
);
80 int ubc_create_upl(vnode_t
, off_t
, long, upl_t
*, upl_page_info_t
**, int);
81 int ubc_upl_map(upl_t
, upl_offset_t
*);
82 int ubc_upl_unmap(upl_t
);
83 int ubc_upl_commit(upl_t
);
84 int ubc_upl_commit_range(upl_t
, upl_offset_t
, upl_size_t
, int);
85 int ubc_upl_abort(upl_t
, int);
86 int ubc_upl_abort_range(upl_t
, upl_offset_t
, upl_size_t
, int);
88 upl_page_info_t
*ubc_upl_pageinfo(upl_t
);
92 #endif /* _SYS_UBC_H_ */