#ifndef _VM_VM_EXTERN_H_
#define _VM_VM_EXTERN_H_
#ifndef _SYS_TYPES_H_
#include <sys/types.h>
#endif
#ifndef _VM_VM_MAP_H_
#include <vm/vm_map.h>
#endif
#ifndef _VM_VM_KERN_H_
#include <vm/vm_kern.h>
#endif
#ifndef _MACHINE_TYPES_H_
#include <machine/types.h>
#endif
struct buf;
struct proc;
struct vmspace;
struct vmtotal;
struct mount;
struct vnode;
#ifdef _KERNEL
extern int vkernel_enable;
int grow(struct proc *, size_t);
int kernacc(c_caddr_t, int, int);
vm_offset_t kmem_alloc3(struct vm_map *, vm_size_t,
vm_subsys_t id, int flags);
vm_offset_t kmem_alloc_nofault(struct vm_map *, vm_size_t,
vm_subsys_t id, vm_size_t);
vm_offset_t kmem_alloc_pageable(struct vm_map *, vm_size_t,
vm_subsys_t id);
vm_offset_t kmem_alloc_wait(struct vm_map *, vm_size_t,
vm_subsys_t id);
vm_offset_t kmem_alloc_attr(struct vm_map *map, vm_size_t size,
vm_subsys_t id, int flags,
vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr);
void kmem_free(struct vm_map *, vm_offset_t, vm_size_t);
void kmem_free_wakeup(struct vm_map *, vm_offset_t, vm_size_t);
void kmem_init(void);
void kmem_suballoc(struct vm_map *, struct vm_map *,
vm_offset_t *, vm_offset_t *, vm_size_t);
void munmapfd(struct proc *, int);
int swaponvp(struct thread *, struct vnode *, u_quad_t);
int useracc(c_caddr_t, int, int);
int vm_fault(struct vm_map *, vm_offset_t, vm_prot_t, int);
int vm_fault_collapse(struct vm_map *, struct vm_map_entry *);
vm_page_t vm_fault_page(struct vm_map *, vm_offset_t,
vm_prot_t, int, int *, int *);
vm_page_t vm_fault_page_quick(vm_offset_t, vm_prot_t, int *, int *);
void vm_fault_copy_entry(struct vm_map *, struct vm_map *,
struct vm_map_entry *, struct vm_map_entry *);
void vm_fault_unwire(struct vm_map *, struct vm_map_entry *);
int vm_fault_wire(struct vm_map *, struct vm_map_entry *, boolean_t, int);
void vm_fork(struct proc *, struct proc *, struct lwp *, int);
int vm_test_nominal(void);
void vm_wait_nominal(void);
void vm_init_limits(struct proc *);
int vm_mmap(struct vm_map *, vm_offset_t *, vm_size_t,
vm_prot_t, vm_prot_t, int, void *, vm_ooffset_t,
struct file *fp);
int vm_mmap_to_errno(int rv);
vm_offset_t kmem_alloc_contig(vm_offset_t, vm_paddr_t,
vm_paddr_t, vm_offset_t);
void vm_set_page_size(void);
struct vmspace *vmspace_alloc(vm_offset_t, vm_offset_t);
void vmspace_initrefs(struct vmspace *);
int vmspace_getrefs(struct vmspace *);
void vmspace_hold(struct vmspace *);
void vmspace_drop(struct vmspace *);
void vmspace_ref(struct vmspace *);
void vmspace_rel(struct vmspace *);
void vmspace_relexit(struct vmspace *);
void vmspace_exitfree(struct proc *);
void *kmem_alloc_swapbacked(kmem_anon_desc_t *kp, vm_size_t size,
vm_subsys_t id);
void kmem_free_swapbacked(kmem_anon_desc_t *kp);
struct vmspace *vmspace_fork(struct vmspace *origvm,
struct proc *p2, struct lwp *lp2);
void vmspace_exec(struct proc *, struct vmspace *);
void vmspace_unshare(struct proc *);
void vslock(caddr_t, u_int);
void vsunlock(caddr_t, u_int);
void vm_object_print( long, boolean_t,
long, char *);
static __inline
vm_offset_t
kmem_alloc(struct vm_map *map, vm_size_t size, vm_subsys_t id)
{
return(kmem_alloc3(map, size, id, 0));
}
static __inline
vm_offset_t
kmem_alloc_stack(struct vm_map *map, vm_size_t size, int kmflags)
{
return(kmem_alloc3(map, size, VM_SUBSYS_STACK, kmflags|KM_STACK));
}
#endif
#endif