]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/ubc.h
2 * Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Header file for Unified Buffer Cache.
38 #include <sys/appleapiopts.h>
39 #include <sys/cdefs.h>
40 #include <sys/kernel_types.h>
41 #include <kern/locks.h>
42 #include <mach/memory_object_types.h>
45 /* defns for ubc_sync_range() and ubc_msync */
47 #define UBC_PUSHDIRTY 0x01 /* clean any dirty pages in the specified range to the backing store */
48 #define UBC_PUSHALL 0x02 /* push both dirty and precious pages to the backing store */
49 #define UBC_INVALIDATE 0x04 /* invalidate pages in the specified range... may be used with UBC_PUSHDIRTY/ALL */
50 #define UBC_SYNC 0x08 /* wait for I/Os generated by UBC_PUSHDIRTY to complete */
54 off_t
ubc_blktooff(struct vnode
*, daddr64_t
);
55 daddr64_t
ubc_offtoblk(struct vnode
*, off_t
);
56 off_t
ubc_getsize(struct vnode
*);
57 int ubc_setsize(struct vnode
*, off_t
);
59 struct ucred
*ubc_getcred(struct vnode
*);
60 int ubc_setcred(struct vnode
*, struct proc
*);
62 int ubc_setthreadcred(struct vnode
*, struct proc
*, struct thread
*);
64 int ubc_sync_range(vnode_t
, off_t
, off_t
, int);
65 errno_t
ubc_msync(vnode_t
, off_t
, off_t
, off_t
*, int);
66 int ubc_pages_resident(vnode_t
);
69 /* cluster IO routines */
70 int advisory_read(vnode_t
, off_t
, off_t
, int);
72 int cluster_read(vnode_t
, struct uio
*, off_t
, int);
73 int cluster_write(vnode_t
, struct uio
*, off_t
, off_t
, off_t
, off_t
, int);
74 int cluster_pageout(vnode_t
, upl_t
, vm_offset_t
, off_t
, int, off_t
, int);
75 int cluster_pagein(vnode_t
, upl_t
, vm_offset_t
, off_t
, int, off_t
, int);
76 int cluster_push(vnode_t
, int);
77 int cluster_bp(buf_t
);
78 void cluster_zero(upl_t
, vm_offset_t
, int, buf_t
);
82 int ubc_create_upl(vnode_t
, off_t
, long, upl_t
*, upl_page_info_t
**, int);
83 int ubc_upl_map(upl_t
, upl_offset_t
*);
84 int ubc_upl_unmap(upl_t
);
85 int ubc_upl_commit(upl_t
);
86 int ubc_upl_commit_range(upl_t
, upl_offset_t
, upl_size_t
, int);
87 int ubc_upl_abort(upl_t
, int);
88 int ubc_upl_abort_range(upl_t
, upl_offset_t
, upl_size_t
, int);
90 upl_page_info_t
*ubc_upl_pageinfo(upl_t
);
94 #endif /* _SYS_UBC_H_ */