1247096Sattilio/*-
2247096Sattilio * Copyright (c) 2013 EMC Corp.
3247096Sattilio * All rights reserved.
4247096Sattilio *
5247096Sattilio * Redistribution and use in source and binary forms, with or without
6247096Sattilio * modification, are permitted provided that the following conditions
7247096Sattilio * are met:
8247096Sattilio * 1. Redistributions of source code must retain the above copyright
9247096Sattilio *    notice, this list of conditions and the following disclaimer.
10247096Sattilio * 2. Redistributions in binary form must reproduce the above copyright
11247096Sattilio *    notice, this list of conditions and the following disclaimer in the
12247096Sattilio *    documentation and/or other materials provided with the distribution.
13247096Sattilio *
14247096Sattilio * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15247096Sattilio * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16247096Sattilio * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17247096Sattilio * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18247096Sattilio * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19247096Sattilio * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20247096Sattilio * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21247096Sattilio * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22247096Sattilio * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23247096Sattilio * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24247096Sattilio * SUCH DAMAGE.
25247096Sattilio *
26247096Sattilio * $FreeBSD$
27247096Sattilio */
28247096Sattilio
29247096Sattilio#ifndef _OPENSOLARIS_SYS_VM_H_
30247096Sattilio#define	_OPENSOLARIS_SYS_VM_H_
31247096Sattilio
32247096Sattilio#ifdef _KERNEL
33247096Sattilio
34260786Savg#include <sys/sf_buf.h>
35260786Savg
36247191Sattilioextern const int zfs_vm_pagerret_bad;
37247191Sattilioextern const int zfs_vm_pagerret_error;
38247191Sattilioextern const int zfs_vm_pagerret_ok;
39260786Savgextern const int zfs_vm_pagerput_sync;
40260786Savgextern const int zfs_vm_pagerput_inval;
41247096Sattilio
42247096Sattiliovoid	zfs_vmobject_assert_wlocked(vm_object_t object);
43247096Sattiliovoid	zfs_vmobject_wlock(vm_object_t object);
44247096Sattiliovoid	zfs_vmobject_wunlock(vm_object_t object);
45247096Sattilio
46260786Savgstatic inline caddr_t
47260786Savgzfs_map_page(vm_page_t pp, struct sf_buf **sfp)
48260786Savg{
49260786Savg	*sfp = sf_buf_alloc(pp, 0);
50260786Savg	return ((caddr_t)sf_buf_kva(*sfp));
51260786Savg}
52260786Savg
53260786Savgstatic inline void
54260786Savgzfs_unmap_page(struct sf_buf *sf)
55260786Savg{
56260786Savg	sf_buf_free(sf);
57260786Savg}
58260786Savg
59247096Sattilio#endif	/* _KERNEL */
60247096Sattilio
61247096Sattilio#endif	/* _OPENSOLARIS_SYS_VM_H_ */
62