49eb1f4806
Primary purpose of change: to support the mmap implementation, VM must know both (a) about some block metadata for FS cache blocks, i.e. inode numbers and inode offsets where applicable; and (b) know about *all* cache blocks, i.e. also of the FS primary caches and not just the blocks that spill into the secondary one. This changes the interface and VM data structures. This change is only for the interface (libminixfs) and VM data structures; the filesystem code is unmodified, so although the secondary cache will be used as normal, blocks will not be annotated with inode information until the FS is modified to provide this information. Until it is modified, mmap of files will fail gracefully on such filesystems. This is indicated to VFS/VM by returning ENOSYS for REQ_PEEK. Change-Id: I1d2df6c485e6c5e89eb28d9055076cc02629594e
86 lines
1.9 KiB
C
86 lines
1.9 KiB
C
|
|
#ifndef _REGION_H
|
|
#define _REGION_H 1
|
|
|
|
#include <minix/callnr.h>
|
|
#include <minix/com.h>
|
|
#include <minix/config.h>
|
|
#include <minix/const.h>
|
|
#include <minix/ds.h>
|
|
#include <minix/endpoint.h>
|
|
#include <minix/keymap.h>
|
|
#include <minix/minlib.h>
|
|
#include <minix/type.h>
|
|
#include <minix/ipc.h>
|
|
#include <minix/sysutil.h>
|
|
#include <minix/syslib.h>
|
|
#include <minix/const.h>
|
|
|
|
#include "phys_region.h"
|
|
#include "memtype.h"
|
|
#include "vm.h"
|
|
|
|
struct phys_block {
|
|
#if SANITYCHECKS
|
|
u32_t seencount;
|
|
#endif
|
|
phys_bytes phys; /* physical memory */
|
|
|
|
/* first in list of phys_regions that reference this block */
|
|
struct phys_region *firstregion;
|
|
u8_t refcount; /* Refcount of these pages */
|
|
u8_t flags;
|
|
};
|
|
|
|
#define PBF_INCACHE 0x01
|
|
|
|
typedef struct vir_region {
|
|
vir_bytes vaddr; /* virtual address, offset from pagetable */
|
|
vir_bytes length; /* length in bytes */
|
|
struct phys_region **physblocks;
|
|
u16_t flags;
|
|
struct vmproc *parent; /* Process that owns this vir_region. */
|
|
mem_type_t *def_memtype; /* Default instantiated memory type. */
|
|
int remaps;
|
|
u32_t id; /* unique id */
|
|
|
|
union {
|
|
phys_bytes phys; /* VR_DIRECT */
|
|
struct {
|
|
endpoint_t ep;
|
|
vir_bytes vaddr;
|
|
int id;
|
|
} shared;
|
|
struct phys_block *pb_cache;
|
|
struct {
|
|
int procfd; /* cloned fd in proc for mmap */
|
|
dev_t dev;
|
|
ino_t ino;
|
|
u64_t offset;
|
|
int inited;
|
|
u16_t clearend;
|
|
} file;
|
|
} param;
|
|
|
|
/* AVL fields */
|
|
struct vir_region *lower, *higher;
|
|
int factor;
|
|
} region_t;
|
|
|
|
/* Mapping flags: */
|
|
#define VR_WRITABLE 0x001 /* Process may write here. */
|
|
#define VR_PHYS64K 0x004 /* Physical memory must be 64k aligned. */
|
|
#define VR_LOWER16MB 0x008
|
|
#define VR_LOWER1MB 0x010
|
|
#define VR_SHARED 0x040
|
|
#define VR_UNINITIALIZED 0x080 /* Do not clear after allocation */
|
|
|
|
/* Mapping type: */
|
|
#define VR_ANON 0x100 /* Memory to be cleared and allocated */
|
|
#define VR_DIRECT 0x200 /* Mapped, but not managed by VM */
|
|
|
|
/* map_page_region flags */
|
|
#define MF_PREALLOC 0x01
|
|
|
|
#endif
|
|
|