removal of unused vm<->vfs code.
This commit is contained in:
parent
3bcfb76e45
commit
35b471ad94
9 changed files with 2 additions and 300 deletions
|
@ -803,23 +803,6 @@
|
||||||
* implementations. See <minix/vfsif.h>
|
* implementations. See <minix/vfsif.h>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* Messages used from VM to VFS *
|
|
||||||
*===========================================================================*/
|
|
||||||
|
|
||||||
/* Requests sent by VM to VFS, done on behalf of a user process. */
|
|
||||||
#define VM_VFS_BASE 0xB00
|
|
||||||
#define VM_VFS_OPEN (VM_VFS_BASE+0) /* open() on behalf of user process. */
|
|
||||||
# define VMVO_NAME_GRANT m2_i1 /* 0-terminated */
|
|
||||||
# define VMVO_NAME_LENGTH m2_i2 /* name length including 0 */
|
|
||||||
# define VMVO_FLAGS m2_i3
|
|
||||||
# define VMVO_MODE m2_l1
|
|
||||||
# define VMVO_ENDPOINT m2_l2
|
|
||||||
#define VM_VFS_MMAP (VM_VFS_BASE+1) /* mmap() */
|
|
||||||
#define VM_VFS_CLOSE (VM_VFS_BASE+2) /* close() */
|
|
||||||
# define VMVC_FD m1_i1
|
|
||||||
# define VMVC_ENDPOINT m1_i2
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* Miscellaneous field names *
|
* Miscellaneous field names *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -17,7 +17,7 @@ OBJ = main.o open.o read.o write.o pipe.o dmap.o \
|
||||||
path.o device.o mount.o link.o exec.o \
|
path.o device.o mount.o link.o exec.o \
|
||||||
filedes.o stadir.o protect.o time.o \
|
filedes.o stadir.o protect.o time.o \
|
||||||
lock.o misc.o utility.o select.o timers.o table.o \
|
lock.o misc.o utility.o select.o timers.o table.o \
|
||||||
vnode.o vmnt.o request.o mmap.o fscall.o
|
vnode.o vmnt.o request.o fscall.o
|
||||||
|
|
||||||
# build local binary
|
# build local binary
|
||||||
install all build: $(SERVER)
|
install all build: $(SERVER)
|
||||||
|
|
|
@ -152,31 +152,6 @@ PUBLIC int main(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calls from VM. */
|
|
||||||
if(who_e == VM_PROC_NR) {
|
|
||||||
int caught = 1;
|
|
||||||
switch(call_nr)
|
|
||||||
{
|
|
||||||
case VM_VFS_OPEN:
|
|
||||||
error = do_vm_open();
|
|
||||||
break;
|
|
||||||
case VM_VFS_CLOSE:
|
|
||||||
error = do_vm_close();
|
|
||||||
break;
|
|
||||||
case VM_VFS_MMAP:
|
|
||||||
error = do_vm_mmap();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
caught = 0;
|
|
||||||
error = 0; /* To satisfy lints. */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(caught) {
|
|
||||||
reply(who_e, error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SANITYCHECK;
|
SANITYCHECK;
|
||||||
|
|
||||||
/* Other calls. */
|
/* Other calls. */
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* mmap implementation in VFS
|
|
||||||
*
|
|
||||||
* The entry points into this file are
|
|
||||||
* do_vm_mmap: VM calls VM_VFS_MMAP
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fs.h"
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <minix/callnr.h>
|
|
||||||
#include <minix/com.h>
|
|
||||||
#include <minix/u64.h>
|
|
||||||
#include "file.h"
|
|
||||||
#include "fproc.h"
|
|
||||||
#include "lock.h"
|
|
||||||
#include "param.h"
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <minix/vfsif.h>
|
|
||||||
#include "vnode.h"
|
|
||||||
#include "vmnt.h"
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_vm_mmap *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int do_vm_mmap()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -659,79 +659,3 @@ PUBLIC void close_reply()
|
||||||
/* No need to do anything */
|
/* No need to do anything */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_vm_open *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int do_vm_open()
|
|
||||||
{
|
|
||||||
int len, r, n;
|
|
||||||
endpoint_t ep;
|
|
||||||
|
|
||||||
len = m_in.VMVO_NAME_LENGTH;
|
|
||||||
m_out.VMV_ENDPOINT = ep = m_in.VMVO_ENDPOINT;
|
|
||||||
|
|
||||||
/* Do open() call on behalf of any process, performed by VM. */
|
|
||||||
if(len < 2 || len > sizeof(user_fullpath)) {
|
|
||||||
printf("do_vm_open: strange length %d\n", len);
|
|
||||||
m_out.VMVRO_FD = EINVAL;
|
|
||||||
return(VM_VFS_REPLY_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do open on behalf of which process? */
|
|
||||||
if(isokendpt(ep, &n) != OK) {
|
|
||||||
printf("do_vm_open: strange endpoint %d\n", ep);
|
|
||||||
m_out.VMVRO_FD = EINVAL;
|
|
||||||
return(VM_VFS_REPLY_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX - do open on behalf of this process */
|
|
||||||
fp = &fproc[n];
|
|
||||||
|
|
||||||
/* Get path name from VM address space. */
|
|
||||||
if((r=sys_safecopyfrom(VM_PROC_NR, m_in.VMVO_NAME_GRANT, 0,
|
|
||||||
(vir_bytes) user_fullpath, len, D)) != OK) {
|
|
||||||
printf("do_vm_open: sys_safecopyfrom failed: %d\n", r);
|
|
||||||
m_out.VMVRO_FD = EPERM;
|
|
||||||
return(VM_VFS_REPLY_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if path is null-terminated. */
|
|
||||||
if(user_fullpath[len-1] != '\0') {
|
|
||||||
printf("do_vm_open: name (len %d) not 0-terminated\n", len);
|
|
||||||
m_out.VMVRO_FD = EINVAL;
|
|
||||||
return(VM_VFS_REPLY_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform open(). */
|
|
||||||
m_out.VMVRO_FD = common_open(m_in.VMVO_FLAGS, m_in.VMVO_MODE);
|
|
||||||
m_out.VMV_ENDPOINT = ep;
|
|
||||||
|
|
||||||
/* Send open() reply. */
|
|
||||||
return(VM_VFS_REPLY_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_vm_close *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int do_vm_close()
|
|
||||||
{
|
|
||||||
int len, r, n;
|
|
||||||
endpoint_t ep;
|
|
||||||
|
|
||||||
len = m_in.VMVO_NAME_LENGTH;
|
|
||||||
|
|
||||||
/* Do close() call on behalf of any process, performed by VM. */
|
|
||||||
m_out.VMV_ENDPOINT = ep = m_in.VMVC_ENDPOINT;
|
|
||||||
if(isokendpt(ep, &n) != OK) {
|
|
||||||
printf("do_vm_close: strange endpoint %d\n", ep);
|
|
||||||
return(VM_VFS_REPLY_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform close(). */
|
|
||||||
r = close_fd(&fproc[n], m_in.VMVC_FD);
|
|
||||||
|
|
||||||
return(VM_VFS_REPLY_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,6 @@ _PROTOTYPE( int do_svrctl, (void) );
|
||||||
_PROTOTYPE( int do_getsysinfo, (void) );
|
_PROTOTYPE( int do_getsysinfo, (void) );
|
||||||
_PROTOTYPE( int pm_dumpcore, (int proc_e, struct mem_map *seg_ptr) );
|
_PROTOTYPE( int pm_dumpcore, (int proc_e, struct mem_map *seg_ptr) );
|
||||||
|
|
||||||
/* mmap.c */
|
|
||||||
_PROTOTYPE( int do_vm_mmap, (void) );
|
|
||||||
|
|
||||||
/* mount.c */
|
/* mount.c */
|
||||||
_PROTOTYPE( int do_fslogin, (void) );
|
_PROTOTYPE( int do_fslogin, (void) );
|
||||||
_PROTOTYPE( int do_mount, (void) );
|
_PROTOTYPE( int do_mount, (void) );
|
||||||
|
|
|
@ -4,7 +4,7 @@ SERVER = vm
|
||||||
include /etc/make.conf
|
include /etc/make.conf
|
||||||
|
|
||||||
OBJ = main.o alloc.o utility.o exec.o exit.o fork.o break.o \
|
OBJ = main.o alloc.o utility.o exec.o exit.o fork.o break.o \
|
||||||
signal.o vfs.o mmap.o slaballoc.o region.o pagefaults.o addravl.o \
|
signal.o mmap.o slaballoc.o region.o pagefaults.o addravl.o \
|
||||||
physravl.o rs.o queryexit.o map_mem.o
|
physravl.o rs.o queryexit.o map_mem.o
|
||||||
ARCHOBJ = $(ARCH)/vm.o $(ARCH)/pagetable.o $(ARCH)/arch_pagefaults.o $(ARCH)/util.o
|
ARCHOBJ = $(ARCH)/vm.o $(ARCH)/pagetable.o $(ARCH)/arch_pagefaults.o $(ARCH)/util.o
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,6 @@ _PROTOTYPE( int real_brk, (struct vmproc *vmp, vir_bytes v));
|
||||||
/* signal.c */
|
/* signal.c */
|
||||||
_PROTOTYPE( int do_push_sig, (message *msg) );
|
_PROTOTYPE( int do_push_sig, (message *msg) );
|
||||||
|
|
||||||
/* vfs.c */
|
|
||||||
_PROTOTYPE( int do_vfs_reply, (message *msg) );
|
|
||||||
_PROTOTYPE( int vfs_open, (struct vmproc *for_who, callback_t callback,
|
|
||||||
cp_grant_id_t filename_gid, int filename_len, int flags, int mode));
|
|
||||||
_PROTOTYPE( int vfs_close, (struct vmproc *for_who, callback_t callback,
|
|
||||||
int fd));
|
|
||||||
|
|
||||||
/* map_mem.c */
|
/* map_mem.c */
|
||||||
_PROTOTYPE( int map_memory, (endpoint_t sour, endpoint_t dest,
|
_PROTOTYPE( int map_memory, (endpoint_t sour, endpoint_t dest,
|
||||||
vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag));
|
vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag));
|
||||||
|
|
139
servers/vm/vfs.c
139
servers/vm/vfs.c
|
@ -1,139 +0,0 @@
|
||||||
|
|
||||||
#define _SYSTEM 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/safecopies.h>
|
|
||||||
#include <minix/bitmap.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <env.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "glo.h"
|
|
||||||
#include "proto.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* register_callback *
|
|
||||||
*===========================================================================*/
|
|
||||||
PRIVATE void register_callback(struct vmproc *for_who, callback_t callback,
|
|
||||||
int callback_type)
|
|
||||||
{
|
|
||||||
if(for_who->vm_callback) {
|
|
||||||
vm_panic("register_callback: callback already registered",
|
|
||||||
for_who->vm_callback_type);
|
|
||||||
}
|
|
||||||
for_who->vm_callback = callback;
|
|
||||||
for_who->vm_callback_type = callback_type;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* vfs_open *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int vfs_open(struct vmproc *for_who, callback_t callback,
|
|
||||||
cp_grant_id_t filename_gid, int filename_len, int flags, int mode)
|
|
||||||
{
|
|
||||||
static message m;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
register_callback(for_who, callback, VM_VFS_REPLY_OPEN);
|
|
||||||
|
|
||||||
m.m_type = VM_VFS_OPEN;
|
|
||||||
m.VMVO_NAME_GRANT = filename_gid;
|
|
||||||
m.VMVO_NAME_LENGTH = filename_len;
|
|
||||||
m.VMVO_FLAGS = flags;
|
|
||||||
m.VMVO_MODE = mode;
|
|
||||||
m.VMVO_ENDPOINT = for_who->vm_endpoint;
|
|
||||||
|
|
||||||
if((r=asynsend(VFS_PROC_NR, &m)) != OK) {
|
|
||||||
vm_panic("vfs_open: asynsend failed", r);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* vfs_close *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int vfs_close(struct vmproc *for_who, callback_t callback, int fd)
|
|
||||||
{
|
|
||||||
static message m;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
register_callback(for_who, callback, VM_VFS_REPLY_CLOSE);
|
|
||||||
|
|
||||||
m.m_type = VM_VFS_CLOSE;
|
|
||||||
m.VMVC_ENDPOINT = for_who->vm_endpoint;
|
|
||||||
m.VMVC_FD = fd;
|
|
||||||
|
|
||||||
if((r=asynsend(VFS_PROC_NR, &m)) != OK) {
|
|
||||||
vm_panic("vfs_close: asynsend failed", r);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_vfs_reply *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int do_vfs_reply(message *m)
|
|
||||||
{
|
|
||||||
/* Reply to a request has been received from vfs. Handle it. First verify
|
|
||||||
* and look up which process, identified by endpoint, this is about.
|
|
||||||
* Then call the callback function that was registered when the request
|
|
||||||
* was done. Return result to vfs.
|
|
||||||
*/
|
|
||||||
endpoint_t ep;
|
|
||||||
struct vmproc *vmp;
|
|
||||||
int procno;
|
|
||||||
callback_t cb;
|
|
||||||
ep = m->VMV_ENDPOINT;
|
|
||||||
if(vm_isokendpt(ep, &procno) != OK) {
|
|
||||||
printf("VM:do_vfs_reply: reply %d about invalid endpoint %d\n",
|
|
||||||
m->m_type, ep);
|
|
||||||
vm_panic("do_vfs_reply: invalid endpoint from vfs", NO_NUM);
|
|
||||||
}
|
|
||||||
vmp = &vmproc[procno];
|
|
||||||
if(!vmp->vm_callback) {
|
|
||||||
printf("VM:do_vfs_reply: reply %d: endpoint %d not waiting\n",
|
|
||||||
m->m_type, ep);
|
|
||||||
vm_panic("do_vfs_reply: invalid endpoint from vfs", NO_NUM);
|
|
||||||
}
|
|
||||||
if(vmp->vm_callback_type != m->m_type) {
|
|
||||||
printf("VM:do_vfs_reply: reply %d unexpected for endpoint %d\n"
|
|
||||||
" (expecting %d)\n", m->m_type, ep, vmp->vm_callback_type);
|
|
||||||
vm_panic("do_vfs_reply: invalid reply from vfs", NO_NUM);
|
|
||||||
}
|
|
||||||
if(vmp->vm_flags & VMF_EXITING) {
|
|
||||||
/* This is not fatal or impossible, but the callback
|
|
||||||
* function has to realize it shouldn't do any PM or
|
|
||||||
* VFS calls for this process.
|
|
||||||
*/
|
|
||||||
printf("VM:do_vfs_reply: reply %d for EXITING endpoint %d\n",
|
|
||||||
m->m_type, ep);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All desired callback state has been used, so save and reset
|
|
||||||
* the callback. This allows the callback to register another
|
|
||||||
* one.
|
|
||||||
*/
|
|
||||||
cb = vmp->vm_callback;
|
|
||||||
vmp->vm_callback = NULL;
|
|
||||||
cb(vmp, m);
|
|
||||||
return SUSPEND;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue