]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/ubc.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / sys / ubc.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ff6e181a
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
1c79356b 12 *
ff6e181a
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ff6e181a
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
1c79356b
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
1c79356b
A
24 * Header file for Unified Buffer Cache.
25 *
26 */
27
28#ifndef _SYS_UBC_H_
29#define _SYS_UBC_H_
30
9bccf70c 31#include <sys/appleapiopts.h>
1c79356b 32#include <sys/cdefs.h>
91447636
A
33#include <sys/kernel_types.h>
34#include <kern/locks.h>
1c79356b
A
35#include <mach/memory_object_types.h>
36
1c79356b 37
91447636 38/* defns for ubc_sync_range() and ubc_msync */
1c79356b 39
91447636
A
40#define UBC_PUSHDIRTY 0x01 /* clean any dirty pages in the specified range to the backing store */
41#define UBC_PUSHALL 0x02 /* push both dirty and precious pages to the backing store */
42#define UBC_INVALIDATE 0x04 /* invalidate pages in the specified range... may be used with UBC_PUSHDIRTY/ALL */
43#define UBC_SYNC 0x08 /* wait for I/Os generated by UBC_PUSHDIRTY to complete */
1c79356b
A
44
45__BEGIN_DECLS
0b4e3aa0 46
91447636
A
47off_t ubc_blktooff(struct vnode *, daddr64_t);
48daddr64_t ubc_offtoblk(struct vnode *, off_t);
49off_t ubc_getsize(struct vnode *);
50int ubc_setsize(struct vnode *, off_t);
0b4e3aa0 51
91447636
A
52struct ucred *ubc_getcred(struct vnode *);
53int ubc_setcred(struct vnode *, struct proc *);
1c79356b 54
91447636
A
55int ubc_sync_range(vnode_t, off_t, off_t, int);
56errno_t ubc_msync(vnode_t, off_t, off_t, off_t *, int);
57int ubc_pages_resident(vnode_t);
1c79356b 58
1c79356b 59
91447636
A
60/* cluster IO routines */
61int advisory_read(vnode_t, off_t, off_t, int);
1c79356b 62
91447636
A
63int cluster_read(vnode_t, struct uio *, off_t, int);
64int cluster_write(vnode_t, struct uio *, off_t, off_t, off_t, off_t, int);
65int cluster_pageout(vnode_t, upl_t, vm_offset_t, off_t, int, off_t, int);
66int cluster_pagein(vnode_t, upl_t, vm_offset_t, off_t, int, off_t, int);
67int cluster_push(vnode_t, int);
68int cluster_bp(buf_t);
69void cluster_zero(upl_t, vm_offset_t, int, buf_t);
1c79356b 70
1c79356b 71
91447636
A
72/* UPL routines */
73int ubc_create_upl(vnode_t, off_t, long, upl_t *, upl_page_info_t **, int);
74int ubc_upl_map(upl_t, upl_offset_t *);
75int ubc_upl_unmap(upl_t);
76int ubc_upl_commit(upl_t);
77int ubc_upl_commit_range(upl_t, upl_offset_t, upl_size_t, int);
78int ubc_upl_abort(upl_t, int);
79int ubc_upl_abort_range(upl_t, upl_offset_t, upl_size_t, int);
1c79356b 80
91447636 81upl_page_info_t *ubc_upl_pageinfo(upl_t);
1c79356b 82
91447636 83__END_DECLS
9bccf70c 84
1c79356b
A
85#endif /* _SYS_UBC_H_ */
86