xref: /minix3/minix/servers/vm/memtype.h (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc 
2*433d6423SLionel Sambuc #ifndef _MEMTYPE_H
3*433d6423SLionel Sambuc #define _MEMTYPE_H 1
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc struct vmproc;
6*433d6423SLionel Sambuc struct vir_region;
7*433d6423SLionel Sambuc struct phys_region;
8*433d6423SLionel Sambuc 
9*433d6423SLionel Sambuc typedef void (*vfs_callback_t)(struct vmproc *vmp, message *m,
10*433d6423SLionel Sambuc         void *, void *);
11*433d6423SLionel Sambuc 
12*433d6423SLionel Sambuc typedef struct mem_type {
13*433d6423SLionel Sambuc 	const char *name;	/* human-readable name */
14*433d6423SLionel Sambuc 	int (*ev_new)(struct vir_region *region);
15*433d6423SLionel Sambuc 	void (*ev_delete)(struct vir_region *region);
16*433d6423SLionel Sambuc 	int (*ev_reference)(struct phys_region *pr, struct phys_region *newpr);
17*433d6423SLionel Sambuc 	int (*ev_unreference)(struct phys_region *pr);
18*433d6423SLionel Sambuc 	int (*ev_pagefault)(struct vmproc *vmp, struct vir_region *region,
19*433d6423SLionel Sambuc 	 struct phys_region *ph, int write, vfs_callback_t cb, void *state,
20*433d6423SLionel Sambuc 	 int len, int *io);
21*433d6423SLionel Sambuc 	int (*ev_resize)(struct vmproc *vmp, struct vir_region *vr, vir_bytes len);
22*433d6423SLionel Sambuc 	void (*ev_split)(struct vmproc *vmp, struct vir_region *vr,
23*433d6423SLionel Sambuc 		struct vir_region *r1, struct vir_region *r2);
24*433d6423SLionel Sambuc 	int (*writable)(struct phys_region *pr);
25*433d6423SLionel Sambuc 	int (*ev_sanitycheck)(struct phys_region *pr, const char *file, int line);
26*433d6423SLionel Sambuc         int (*ev_copy)(struct vir_region *vr, struct vir_region *newvr);
27*433d6423SLionel Sambuc         int (*ev_lowshrink)(struct vir_region *vr, vir_bytes len);
28*433d6423SLionel Sambuc 	u32_t (*regionid)(struct vir_region *vr);
29*433d6423SLionel Sambuc         int (*refcount)(struct vir_region *vr);
30*433d6423SLionel Sambuc         int (*pt_flags)(struct vir_region *vr); /* page table flags */
31*433d6423SLionel Sambuc } mem_type_t;
32*433d6423SLionel Sambuc 
33*433d6423SLionel Sambuc #endif
34*433d6423SLionel Sambuc 
35