VFS: remove support for sync FS communication

This commit is contained in:
Thomas Veerman 2012-07-17 10:12:34 +00:00
parent 06f49fe167
commit fd60f03129
3 changed files with 13 additions and 177 deletions

View file

@ -6,7 +6,7 @@ SRCS= main.c open.c read.c write.c pipe.c dmap.c \
path.c device.c mount.c link.c exec.c \
filedes.c stadir.c protect.c time.c \
lock.c misc.c utility.c select.c table.c \
vnode.c vmnt.c request.c fscall.c \
vnode.c vmnt.c request.c \
tll.c comm.c worker.c coredump.c
.if ${MKCOVERAGE} != "no"

View file

@ -100,53 +100,21 @@ int fs_sendrec(endpoint_t fs_e, message *reqmp)
}
if (fs_e == fp->fp_endpoint) return(EDEADLK);
if (!force_sync) {
fp->fp_sendrec = reqmp; /* Where to store request and reply */
fp->fp_sendrec = reqmp; /* Where to store request and reply */
/* Find out whether we can send right away or have to enqueue */
if ( !(vmp->m_flags & VMNT_CALLBACK) &&
vmp->m_comm.c_cur_reqs < vmp->m_comm.c_max_reqs) {
/* There's still room to send more and no proc is queued */
r = sendmsg(vmp, fp);
} else {
r = queuemsg(vmp);
}
self->w_next = NULL; /* End of list */
if (r != OK) return(r);
worker_wait(); /* Yield execution until we've received the reply. */
} else if (force_sync == 1) {
int r;
if (OK != (r = sendrec(fs_e, reqmp))) {
printf("VFS: sendrec failed: %d\n", r);
util_stacktrace();
return(r);
}
} else if (force_sync == 2) {
int r, status;
if (OK != (r = asynsend(fs_e, reqmp)) ||
OK != (r = receive(fs_e, reqmp, &status))) {
printf("VFS: asynrec failed: %d\n", r);
util_stacktrace();
return(r);
}
} else if (force_sync == 3) {
int r, status;
if (OK != (r = send(fs_e, reqmp)) ||
OK != (r = receive(fs_e, reqmp, &status))) {
printf("VFS: sendreceive failed: %d\n", r);
util_stacktrace();
return(r);
}
/* Find out whether we can send right away or have to enqueue */
if ( !(vmp->m_flags & VMNT_CALLBACK) &&
vmp->m_comm.c_cur_reqs < vmp->m_comm.c_max_reqs) {
/* There's still room to send more and no proc is queued */
r = sendmsg(vmp, fp);
} else {
r = queuemsg(vmp);
}
self->w_next = NULL; /* End of list */
if (force_sync != 0 && reqmp->m_type > 0) {
/* XXX: Keep this as long as we're interested in having support
* for synchronous communication. */
nested_fs_call(reqmp);
return fs_sendrec(fs_e, reqmp);
}
if (r != OK) return(r);
worker_wait(); /* Yield execution until we've received the reply. */
return(reqmp->m_type);
}

View file

@ -1,132 +0,0 @@
/* This file handles nested counter-request calls to VFS sent by file system
* (FS) servers in response to VFS requests.
*
* The entry points into this file are
* nested_fs_call perform a nested call from a file system server
* nested_dev_call perform a nested call from a device driver server
*
*/
#include "fs.h"
#include "fproc.h"
#include <string.h>
#include <assert.h>
#include <minix/callnr.h>
#include <minix/endpoint.h>
#include <minix/vfsif.h>
/* maximum nested call stack depth */
#define MAX_DEPTH 1
/* global variables stack */
static struct {
struct fproc *g_fp; /* pointer to caller process */
message g_m_in; /* request message */
message g_m_out; /* reply message */
int g_who_e; /* endpoint of caller process */
int g_who_p; /* slot number of caller process */
int g_call_nr; /* call number */
int g_super_user; /* is the caller root? */
char g_user_fullpath[PATH_MAX]; /* path to look up */
} globals[MAX_DEPTH];
static int depth = 0; /* current globals stack level */
static int push_globals(void);
static void pop_globals(void);
static void set_globals(message *m);
/*===========================================================================*
* push_globals *
*===========================================================================*/
static int push_globals()
{
/* Save the global variables of the current call onto the globals stack.
*/
if (depth == MAX_DEPTH)
return(EPERM);
globals[depth].g_fp = fp;
globals[depth].g_m_in = job_m_in;
globals[depth].g_m_out = m_out;
globals[depth].g_super_user = super_user;
/* err_code is not used across blocking calls */
depth++;
return(OK);
}
/*===========================================================================*
* pop_globals *
*===========================================================================*/
static void pop_globals()
{
/* Restore the global variables of a call from the globals stack.
*/
if (depth == 0)
panic("Popping from empty globals stack!");
depth--;
fp = globals[depth].g_fp;
job_m_in = globals[depth].g_m_in;
m_out = globals[depth].g_m_out;
}
/*===========================================================================*
* set_globals *
*===========================================================================*/
static void set_globals(m)
message *m; /* request message */
{
/* Initialize global variables based on a request message.
*/
int proc_p;
m_in = *m;
proc_p = _ENDPOINT_P(m_in.m_source);
fp = &fproc[proc_p];
/* the rest need not be initialized */
}
/*===========================================================================*
* nested_fs_call *
*===========================================================================*/
void nested_fs_call(m)
message *m; /* request/reply message pointer */
{
/* Handle a nested call from a file system server.
*/
int r;
/* Save global variables of the current call */
if ((r = push_globals()) != OK) {
printf("VFS: error saving global variables in call %d from FS %d\n",
m->m_type, m->m_source);
} else {
/* Initialize global variables for the nested call */
set_globals(m);
/* Perform the nested call - only getsysinfo() is allowed right now */
if (job_call_nr == COMMON_GETSYSINFO) {
r = do_getsysinfo();
} else {
printf("VFS: invalid nested call %d from FS %d\n", job_call_nr,
who_e);
r = ENOSYS;
}
/* Store the result, and restore original global variables */
*m = m_out;
pop_globals();
}
m->m_type = r;
}