From 35b471ad942b55dad3b4c79c6a6a2b3c628b13e6 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 3 Feb 2010 13:35:17 +0000 Subject: [PATCH] removal of unused vm<->vfs code. --- include/minix/com.h | 17 ------ servers/vfs/Makefile | 2 +- servers/vfs/main.c | 25 -------- servers/vfs/mmap.c | 31 ---------- servers/vfs/open.c | 76 ----------------------- servers/vfs/proto.h | 3 - servers/vm/Makefile | 2 +- servers/vm/proto.h | 7 --- servers/vm/vfs.c | 139 ------------------------------------------- 9 files changed, 2 insertions(+), 300 deletions(-) delete mode 100644 servers/vfs/mmap.c delete mode 100644 servers/vm/vfs.c diff --git a/include/minix/com.h b/include/minix/com.h index c9f3d7f3b..8ff463d48 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -803,23 +803,6 @@ * implementations. See */ -/*===========================================================================* - * 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 * *===========================================================================*/ diff --git a/servers/vfs/Makefile b/servers/vfs/Makefile index 18d983ce6..27faf2f04 100644 --- a/servers/vfs/Makefile +++ b/servers/vfs/Makefile @@ -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 \ filedes.o stadir.o protect.o time.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 install all build: $(SERVER) diff --git a/servers/vfs/main.c b/servers/vfs/main.c index 8379173de..c984c2c4a 100644 --- a/servers/vfs/main.c +++ b/servers/vfs/main.c @@ -152,31 +152,6 @@ PUBLIC int main(void) 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; /* Other calls. */ diff --git a/servers/vfs/mmap.c b/servers/vfs/mmap.c deleted file mode 100644 index 4793c53dd..000000000 --- a/servers/vfs/mmap.c +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include "file.h" -#include "fproc.h" -#include "lock.h" -#include "param.h" -#include -#include -#include -#include "vnode.h" -#include "vmnt.h" - -/*===========================================================================* - * do_vm_mmap * - *===========================================================================*/ -PUBLIC int do_vm_mmap() -{ -} - diff --git a/servers/vfs/open.c b/servers/vfs/open.c index 705a770b8..b051cd0c0 100644 --- a/servers/vfs/open.c +++ b/servers/vfs/open.c @@ -659,79 +659,3 @@ PUBLIC void close_reply() /* 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); -} - diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index 1d8968e68..2145379b0 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -87,9 +87,6 @@ _PROTOTYPE( int do_svrctl, (void) ); _PROTOTYPE( int do_getsysinfo, (void) ); _PROTOTYPE( int pm_dumpcore, (int proc_e, struct mem_map *seg_ptr) ); -/* mmap.c */ -_PROTOTYPE( int do_vm_mmap, (void) ); - /* mount.c */ _PROTOTYPE( int do_fslogin, (void) ); _PROTOTYPE( int do_mount, (void) ); diff --git a/servers/vm/Makefile b/servers/vm/Makefile index b3dc8d5b3..5fc74c7b7 100644 --- a/servers/vm/Makefile +++ b/servers/vm/Makefile @@ -4,7 +4,7 @@ SERVER = vm include /etc/make.conf 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 ARCHOBJ = $(ARCH)/vm.o $(ARCH)/pagetable.o $(ARCH)/arch_pagefaults.o $(ARCH)/util.o diff --git a/servers/vm/proto.h b/servers/vm/proto.h index d7d296d84..56a0a67b8 100644 --- a/servers/vm/proto.h +++ b/servers/vm/proto.h @@ -72,13 +72,6 @@ _PROTOTYPE( int real_brk, (struct vmproc *vmp, vir_bytes v)); /* signal.c */ _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 */ _PROTOTYPE( int map_memory, (endpoint_t sour, endpoint_t dest, vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag)); diff --git a/servers/vm/vfs.c b/servers/vm/vfs.c deleted file mode 100644 index df2ec4e79..000000000 --- a/servers/vm/vfs.c +++ /dev/null @@ -1,139 +0,0 @@ - -#define _SYSTEM 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#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; -} - -- 2.44.0