VFS: store m_out as part of worker thread state

There is no need to pass pointers around when there is a structure
available that already stores other similar state, such as m_in.

Change-Id: I3164c5c55c71f443688103d1f0756c086eb05974
This commit is contained in:
David van Moolenbroek 2013-10-29 23:15:15 +01:00 committed by Lionel Sambuc
parent d8106f7f1d
commit 2c8310fce6
22 changed files with 151 additions and 161 deletions

View File

@ -476,7 +476,7 @@ int cdev_close(dev_t dev)
/*===========================================================================* /*===========================================================================*
* do_ioctl * * do_ioctl *
*===========================================================================*/ *===========================================================================*/
int do_ioctl(message *UNUSED(m_out)) int do_ioctl(void)
{ {
/* Perform the ioctl(ls_fd, request, argx) system call */ /* Perform the ioctl(ls_fd, request, argx) system call */
unsigned long ioctlrequest; unsigned long ioctlrequest;

View File

@ -106,7 +106,7 @@ endpoint_t proc_nr_e; /* process number of the driver */
/*===========================================================================* /*===========================================================================*
* do_mapdriver * * do_mapdriver *
*===========================================================================*/ *===========================================================================*/
int do_mapdriver(message *UNUSED(m_out)) int do_mapdriver(void)
{ {
/* Create a device->driver mapping. RS will tell us which major is driven by /* Create a device->driver mapping. RS will tell us which major is driven by
* this driver, what type of device it is (regular, TTY, asynchronous, clone, * this driver, what type of device it is (regular, TTY, asynchronous, clone,

View File

@ -414,7 +414,7 @@ struct filp *f;
/*===========================================================================* /*===========================================================================*
* do_copyfd * * do_copyfd *
*===========================================================================*/ *===========================================================================*/
int do_copyfd(message *UNUSED(m_out)) int do_copyfd(void)
{ {
/* Copy a file descriptor between processes, or close a remote file descriptor. /* Copy a file descriptor between processes, or close a remote file descriptor.
* This call is used as back-call by device drivers (UDS, VND), and is expected * This call is used as back-call by device drivers (UDS, VND), and is expected

View File

@ -28,7 +28,8 @@ EXTERN message m_in; /* the input message itself */
# define fproc_addr(e) (&fproc[_ENDPOINT_P(e)]) # define fproc_addr(e) (&fproc[_ENDPOINT_P(e)])
# define who_e (self != NULL ? fp->fp_endpoint : m_in.m_source) # define who_e (self != NULL ? fp->fp_endpoint : m_in.m_source)
# define call_nr (m_in.m_type) # define call_nr (m_in.m_type)
# define job_m_in (self->w_msg) # define job_m_in (self->w_m_in)
# define job_m_out (self->w_m_out)
# define job_call_nr (job_m_in.m_type) # define job_call_nr (job_m_in.m_type)
# define super_user (fp->fp_effuid == SU_UID ? 1 : 0) # define super_user (fp->fp_effuid == SU_UID ? 1 : 0)
# define scratch(p) (scratchpad[((int) ((p) - fproc))]) # define scratch(p) (scratchpad[((int) ((p) - fproc))])
@ -42,8 +43,7 @@ EXTERN char mount_label[LABEL_MAX]; /* label of file system to mount */
EXTERN int err_code; /* temporary storage for error number */ EXTERN int err_code; /* temporary storage for error number */
/* Data initialized elsewhere. */ /* Data initialized elsewhere. */
extern int(*call_vec[]) (message *); extern int (*call_vec[])(void);
extern int(*pfs_call_vec[]) (message *m_out);
EXTERN struct kinfo kinfo; /* kernel information */ EXTERN struct kinfo kinfo; /* kernel information */

View File

@ -28,7 +28,7 @@
/*===========================================================================* /*===========================================================================*
* do_link * * do_link *
*===========================================================================*/ *===========================================================================*/
int do_link(message *UNUSED(m_out)) int do_link(void)
{ {
/* Perform the link(name1, name2) system call. */ /* Perform the link(name1, name2) system call. */
int r = OK; int r = OK;
@ -90,7 +90,7 @@ int do_link(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_unlink * * do_unlink *
*===========================================================================*/ *===========================================================================*/
int do_unlink(message *UNUSED(m_out)) int do_unlink(void)
{ {
/* Perform the unlink(name) or rmdir(name) system call. The code for these two /* Perform the unlink(name) or rmdir(name) system call. The code for these two
* is almost the same. They differ only in some condition testing. Unlink() * is almost the same. They differ only in some condition testing. Unlink()
@ -175,7 +175,7 @@ int do_unlink(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_rename * * do_rename *
*===========================================================================*/ *===========================================================================*/
int do_rename(message *UNUSED(m_out)) int do_rename(void)
{ {
/* Perform the rename(name1, name2) system call. */ /* Perform the rename(name1, name2) system call. */
int r = OK, r1; int r = OK, r1;
@ -282,7 +282,7 @@ int do_rename(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_truncate * * do_truncate *
*===========================================================================*/ *===========================================================================*/
int do_truncate(message *UNUSED(m_out)) int do_truncate(void)
{ {
/* truncate_vnode() does the actual work of do_truncate() and do_ftruncate(). /* truncate_vnode() does the actual work of do_truncate() and do_ftruncate().
* do_truncate() and do_ftruncate() have to get hold of the inode, either * do_truncate() and do_ftruncate() have to get hold of the inode, either
@ -333,7 +333,7 @@ int do_truncate(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_ftruncate * * do_ftruncate *
*===========================================================================*/ *===========================================================================*/
int do_ftruncate(message *UNUSED(m_out)) int do_ftruncate(void)
{ {
/* As with do_truncate(), truncate_vnode() does the actual work. */ /* As with do_truncate(), truncate_vnode() does the actual work. */
struct filp *rfilp; struct filp *rfilp;
@ -394,7 +394,7 @@ off_t newsize;
/*===========================================================================* /*===========================================================================*
* do_slink * * do_slink *
*===========================================================================*/ *===========================================================================*/
int do_slink(message *UNUSED(m_out)) int do_slink(void)
{ {
/* Perform the symlink(name1, name2) system call. */ /* Perform the symlink(name1, name2) system call. */
int r; int r;
@ -476,7 +476,7 @@ struct fproc *rfp;
/*===========================================================================* /*===========================================================================*
* do_rdlink * * do_rdlink *
*===========================================================================*/ *===========================================================================*/
int do_rdlink(message *UNUSED(m_out)) int do_rdlink(void)
{ {
/* Perform the readlink(name, buf, bufsize) system call. */ /* Perform the readlink(name, buf, bufsize) system call. */
int r; int r;

View File

@ -40,6 +40,7 @@ static void do_fs_reply(struct worker_thread *wp);
static void do_work(void); static void do_work(void);
static void do_init_root(void); static void do_init_root(void);
static void handle_work(void (*func)(void)); static void handle_work(void (*func)(void));
static void reply(message *m_out, endpoint_t whom, int result);
static void get_work(void); static void get_work(void);
static void service_pm(void); static void service_pm(void);
@ -229,9 +230,8 @@ static void do_pending_pipe(void)
static void do_work(void) static void do_work(void)
{ {
int error; int error;
message m_out;
memset(&m_out, 0, sizeof(m_out)); memset(&job_m_out, 0, sizeof(job_m_out));
/* At this point we assume that we're dealing with a call that has been /* At this point we assume that we're dealing with a call that has been
* made specifically to VFS. Typically it will be a POSIX call from a * made specifically to VFS. Typically it will be a POSIX call from a
@ -249,11 +249,11 @@ static void do_work(void)
#if ENABLE_SYSCALL_STATS #if ENABLE_SYSCALL_STATS
calls_stats[job_call_nr]++; calls_stats[job_call_nr]++;
#endif #endif
error = (*call_vec[job_call_nr])(&m_out); error = (*call_vec[job_call_nr])();
} }
/* Copy the results back to the user and send reply. */ /* Copy the results back to the user and send reply. */
if (error != SUSPEND) reply(&m_out, fp->fp_endpoint, error); if (error != SUSPEND) reply(&job_m_out, fp->fp_endpoint, error);
} }
/*===========================================================================* /*===========================================================================*
@ -520,7 +520,7 @@ static void get_work()
/*===========================================================================* /*===========================================================================*
* reply * * reply *
*===========================================================================*/ *===========================================================================*/
void reply(message *m_out, endpoint_t whom, int result) static void reply(message *m_out, endpoint_t whom, int result)
{ {
/* Send a reply to a user process. If the send fails, just ignore it. */ /* Send a reply to a user process. If the send fails, just ignore it. */
int r; int r;
@ -540,18 +540,11 @@ void reply(message *m_out, endpoint_t whom, int result)
void replycode(endpoint_t whom, int result) void replycode(endpoint_t whom, int result)
{ {
/* Send a reply to a user process. If the send fails, just ignore it. */ /* Send a reply to a user process. If the send fails, just ignore it. */
int r;
message m_out; message m_out;
memset(&m_out, 0, sizeof(m_out)); memset(&m_out, 0, sizeof(m_out));
m_out.reply_type = result; reply(&m_out, whom, result);
r = sendnb(whom, &m_out);
if (r != OK) {
printf("VFS: %d couldn't send reply %d to %d: %d\n", mthread_self(),
result, whom, r);
util_stacktrace();
}
} }
/*===========================================================================* /*===========================================================================*

View File

@ -51,7 +51,7 @@ static void free_proc(int flags);
/*===========================================================================* /*===========================================================================*
* do_getsysinfo * * do_getsysinfo *
*===========================================================================*/ *===========================================================================*/
int do_getsysinfo(message *UNUSED(m_out)) int do_getsysinfo(void)
{ {
vir_bytes src_addr, dst_addr; vir_bytes src_addr, dst_addr;
size_t len, buf_size; size_t len, buf_size;
@ -96,7 +96,7 @@ int do_getsysinfo(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_fcntl * * do_fcntl *
*===========================================================================*/ *===========================================================================*/
int do_fcntl(message *UNUSED(m_out)) int do_fcntl(void)
{ {
/* Perform the fcntl(fd, request, ...) system call. */ /* Perform the fcntl(fd, request, ...) system call. */
@ -232,8 +232,10 @@ int do_fcntl(message *UNUSED(m_out))
return(r); return(r);
} }
static int /*===========================================================================*
sync_fses(void) * do_sync *
*===========================================================================*/
int do_sync(void)
{ {
struct vmnt *vmp; struct vmnt *vmp;
int r = OK; int r = OK;
@ -251,18 +253,10 @@ sync_fses(void)
return(r); return(r);
} }
/*===========================================================================*
* do_sync *
*===========================================================================*/
int do_sync(message *UNUSED(m_out))
{
return sync_fses();
}
/*===========================================================================* /*===========================================================================*
* do_fsync * * do_fsync *
*===========================================================================*/ *===========================================================================*/
int do_fsync(message *UNUSED(m_out)) int do_fsync(void)
{ {
/* Perform the fsync() system call. */ /* Perform the fsync() system call. */
struct filp *rfilp; struct filp *rfilp;
@ -345,7 +339,7 @@ int dupvm(struct fproc *rfp, int pfd, int *vmfd, struct filp **newfilp)
/*===========================================================================* /*===========================================================================*
* do_vm_call * * do_vm_call *
*===========================================================================*/ *===========================================================================*/
int do_vm_call(message *m_out) int do_vm_call(void)
{ {
/* A call that VM does to VFS. /* A call that VM does to VFS.
* We must reply with the fixed type VM_VFS_REPLY (and put our result info * We must reply with the fixed type VM_VFS_REPLY (and put our result info
@ -397,18 +391,18 @@ int do_vm_call(message *m_out)
if(S_ISBLK(f->filp_vno->v_mode)) { if(S_ISBLK(f->filp_vno->v_mode)) {
assert(f->filp_vno->v_sdev != NO_DEV); assert(f->filp_vno->v_sdev != NO_DEV);
m_out->VMV_DEV = f->filp_vno->v_sdev; job_m_out.VMV_DEV = f->filp_vno->v_sdev;
m_out->VMV_INO = VMC_NO_INODE; job_m_out.VMV_INO = VMC_NO_INODE;
m_out->VMV_SIZE_PAGES = LONG_MAX; job_m_out.VMV_SIZE_PAGES = LONG_MAX;
} else { } else {
m_out->VMV_DEV = f->filp_vno->v_dev; job_m_out.VMV_DEV = f->filp_vno->v_dev;
m_out->VMV_INO = f->filp_vno->v_inode_nr; job_m_out.VMV_INO = f->filp_vno->v_inode_nr;
m_out->VMV_SIZE_PAGES = job_m_out.VMV_SIZE_PAGES =
roundup(f->filp_vno->v_size, roundup(f->filp_vno->v_size,
PAGE_SIZE)/PAGE_SIZE; PAGE_SIZE)/PAGE_SIZE;
} }
m_out->VMV_FD = procfd; job_m_out.VMV_FD = procfd;
result = OK; result = OK;
@ -425,10 +419,8 @@ int do_vm_call(message *m_out)
} }
case VMVFSREQ_FDIO: case VMVFSREQ_FDIO:
{ {
message dummy_out; result = actual_llseek(fp, req_fd, SEEK_SET, offset,
NULL);
result = actual_llseek(fp, &dummy_out, req_fd,
SEEK_SET, offset);
if(result == OK) { if(result == OK) {
result = actual_read_write_peek(fp, PEEKING, result = actual_read_write_peek(fp, PEEKING,
@ -448,16 +440,15 @@ reqdone:
/* fp is VM still. */ /* fp is VM still. */
assert(fp == vmf); assert(fp == vmf);
m_out->VMV_ENDPOINT = ep; job_m_out.VMV_ENDPOINT = ep;
m_out->VMV_RESULT = result; job_m_out.VMV_RESULT = result;
m_out->VMV_REQID = req_id; job_m_out.VMV_REQID = req_id;
/* reply asynchronously as VM may not be able to receive /* reply asynchronously as VM may not be able to receive
* a sendnb() message * a sendnb() message
*/ */
job_m_out.m_type = VM_VFS_REPLY;
m_out->m_type = VM_VFS_REPLY; r = asynsend3(VM_PROC_NR, &job_m_out, 0);
r = asynsend3(VM_PROC_NR, m_out, 0);
if(r != OK) printf("VFS: couldn't asynsend3() to VM\n"); if(r != OK) printf("VFS: couldn't asynsend3() to VM\n");
/* VFS does not reply any further */ /* VFS does not reply any further */
@ -478,7 +469,7 @@ void pm_reboot()
pmfp = fp; pmfp = fp;
sync_fses(); do_sync();
/* Do exit processing for all leftover processes and servers, but don't /* Do exit processing for all leftover processes and servers, but don't
* actually exit them (if they were really gone, PM will tell us about it). * actually exit them (if they were really gone, PM will tell us about it).
@ -507,7 +498,7 @@ void pm_reboot()
if (rfp != fp) unlock_proc(rfp); if (rfp != fp) unlock_proc(rfp);
} }
sync_fses(); do_sync();
unmount_all(0 /* Don't force */); unmount_all(0 /* Don't force */);
/* Try to exit all processes again including File Servers */ /* Try to exit all processes again including File Servers */
@ -525,7 +516,7 @@ void pm_reboot()
if (rfp != fp) unlock_proc(rfp); if (rfp != fp) unlock_proc(rfp);
} }
sync_fses(); do_sync();
unmount_all(1 /* Force */); unmount_all(1 /* Force */);
/* Reply to PM for synchronization */ /* Reply to PM for synchronization */
@ -767,7 +758,7 @@ void pm_setsid(endpoint_t proc_e)
/*===========================================================================* /*===========================================================================*
* do_svrctl * * do_svrctl *
*===========================================================================*/ *===========================================================================*/
int do_svrctl(message *UNUSED(m_out)) int do_svrctl(void)
{ {
unsigned int svrctl; unsigned int svrctl;
vir_bytes ptr; vir_bytes ptr;
@ -949,7 +940,7 @@ void panic_hook(void)
/*===========================================================================* /*===========================================================================*
* do_getrusage * * do_getrusage *
*===========================================================================*/ *===========================================================================*/
int do_getrusage(message *UNUSED(m_out)) int do_getrusage(void)
{ {
int res; int res;
struct rusage r_usage; struct rusage r_usage;

View File

@ -83,7 +83,7 @@ static void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e)
/*===========================================================================* /*===========================================================================*
* do_fsready * * do_fsready *
*===========================================================================*/ *===========================================================================*/
int do_fsready(message *UNUSED(m_out)) int do_fsready(void)
{ {
/* deprecated */ /* deprecated */
return(SUSPEND); return(SUSPEND);
@ -92,7 +92,7 @@ int do_fsready(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_mount * * do_mount *
*===========================================================================*/ *===========================================================================*/
int do_mount(message *UNUSED(m_out)) int do_mount(void)
{ {
/* Perform the mount(name, mfile, mount_flags) system call. */ /* Perform the mount(name, mfile, mount_flags) system call. */
endpoint_t fs_e; endpoint_t fs_e;
@ -425,7 +425,7 @@ void mount_pfs(void)
/*===========================================================================* /*===========================================================================*
* do_umount * * do_umount *
*===========================================================================*/ *===========================================================================*/
int do_umount(message *UNUSED(m_out)) int do_umount(void)
{ {
/* Perform the umount(name) system call. Return the label of the FS service. /* Perform the umount(name) system call. Return the label of the FS service.
*/ */

View File

@ -37,7 +37,7 @@ static int pipe_open(struct vnode *vp, mode_t bits, int oflags);
/*===========================================================================* /*===========================================================================*
* do_open * * do_open *
*===========================================================================*/ *===========================================================================*/
int do_open(message *UNUSED(m_out)) int do_open(void)
{ {
/* Perform the open(name, flags,...) system call. /* Perform the open(name, flags,...) system call.
* syscall might provide 'name' embedded in message when not creating file */ * syscall might provide 'name' embedded in message when not creating file */
@ -495,7 +495,7 @@ static int pipe_open(struct vnode *vp, mode_t bits, int oflags)
/*===========================================================================* /*===========================================================================*
* do_mknod * * do_mknod *
*===========================================================================*/ *===========================================================================*/
int do_mknod(message *UNUSED(m_out)) int do_mknod(void)
{ {
/* Perform the mknod(name, mode, addr) system call. */ /* Perform the mknod(name, mode, addr) system call. */
register mode_t bits, mode_bits; register mode_t bits, mode_bits;
@ -544,7 +544,7 @@ int do_mknod(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_mkdir * * do_mkdir *
*===========================================================================*/ *===========================================================================*/
int do_mkdir(message *UNUSED(m_out)) int do_mkdir(void)
{ {
/* Perform the mkdir(name, mode) system call. */ /* Perform the mkdir(name, mode) system call. */
mode_t bits; /* mode bits for the new inode */ mode_t bits; /* mode bits for the new inode */
@ -586,8 +586,8 @@ int do_mkdir(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* actual_llseek * * actual_llseek *
*===========================================================================*/ *===========================================================================*/
int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence, int actual_llseek(struct fproc *rfp, int seekfd, int seekwhence, off_t offset,
off_t offset) off_t *newposp)
{ {
/* Perform the llseek(ls_fd, offset, whence) system call. */ /* Perform the llseek(ls_fd, offset, whence) system call. */
register struct filp *rfilp; register struct filp *rfilp;
@ -621,9 +621,7 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence,
} else if ((offset < 0) && (newpos >= pos)) { } else if ((offset < 0) && (newpos >= pos)) {
r = EOVERFLOW; r = EOVERFLOW;
} else { } else {
/* insert the new position into the output message */ if (newposp != NULL) *newposp = newpos;
m_out->reply_l1 = ex64lo(newpos);
m_out->reply_l2 = ex64hi(newpos);
if (newpos != rfilp->filp_pos) { if (newpos != rfilp->filp_pos) {
rfilp->filp_pos = newpos; rfilp->filp_pos = newpos;
@ -641,16 +639,26 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence,
/*===========================================================================* /*===========================================================================*
* do_lseek * * do_lseek *
*===========================================================================*/ *===========================================================================*/
int do_lseek(message *m_out) int do_lseek(void)
{ {
return actual_llseek(fp, m_out, job_m_in.ls_fd, job_m_in.whence, off_t newpos;
make64(job_m_in.offset_lo, job_m_in.offset_high)); int r;
if ((r = actual_llseek(fp, job_m_in.ls_fd, job_m_in.whence,
make64(job_m_in.offset_lo, job_m_in.offset_high),
&newpos)) != OK)
return r;
/* insert the new position into the output message */
job_m_out.reply_l1 = ex64lo(newpos);
job_m_out.reply_l2 = ex64hi(newpos);
return OK;
} }
/*===========================================================================* /*===========================================================================*
* do_close * * do_close *
*===========================================================================*/ *===========================================================================*/
int do_close(message *UNUSED(m_out)) int do_close(void)
{ {
/* Perform the close(fd) system call. */ /* Perform the close(fd) system call. */
int thefd = job_m_in.fd; int thefd = job_m_in.fd;

View File

@ -867,7 +867,7 @@ size_t pathlen;
/*===========================================================================* /*===========================================================================*
* do_checkperms * * do_checkperms *
*===========================================================================*/ *===========================================================================*/
int do_checkperms(message *UNUSED(m_out)) int do_checkperms(void)
{ {
/* This should be replaced by an ACL check. */ /* This should be replaced by an ACL check. */
if (!super_user) return EPERM; if (!super_user) return EPERM;

View File

@ -38,7 +38,7 @@ static int create_pipe(int fil_des[2], int flags);
/*===========================================================================* /*===========================================================================*
* do_pipe * * do_pipe *
*===========================================================================*/ *===========================================================================*/
int do_pipe(message *m_out) int do_pipe(void)
{ {
/* Perform the pipe(fil_des[2]) system call. */ /* Perform the pipe(fil_des[2]) system call. */
@ -47,8 +47,8 @@ int do_pipe(message *m_out)
r = create_pipe(fil_des, 0 /* no flags */); r = create_pipe(fil_des, 0 /* no flags */);
if (r == OK) { if (r == OK) {
m_out->reply_i1 = fil_des[0]; job_m_out.reply_i1 = fil_des[0];
m_out->reply_i2 = fil_des[1]; job_m_out.reply_i2 = fil_des[1];
} }
return r; return r;
@ -57,7 +57,7 @@ int do_pipe(message *m_out)
/*===========================================================================* /*===========================================================================*
* do_pipe2 * * do_pipe2 *
*===========================================================================*/ *===========================================================================*/
int do_pipe2(message *m_out) int do_pipe2(void)
{ {
/* Perform the pipe2(fil_des[2], flags) system call. */ /* Perform the pipe2(fil_des[2], flags) system call. */
int r, flags; int r, flags;
@ -67,8 +67,8 @@ int do_pipe2(message *m_out)
r = create_pipe(fil_des, flags); r = create_pipe(fil_des, flags);
if (r == OK) { if (r == OK) {
m_out->reply_i1 = fil_des[0]; job_m_out.reply_i1 = fil_des[0];
m_out->reply_i2 = fil_des[1]; job_m_out.reply_i2 = fil_des[1];
} }
return r; return r;

View File

@ -23,7 +23,7 @@
/*===========================================================================* /*===========================================================================*
* do_chmod * * do_chmod *
*===========================================================================*/ *===========================================================================*/
int do_chmod(message *UNUSED(m_out)) int do_chmod(void)
{ {
/* Perform the chmod(name, mode) and fchmod(fd, mode) system calls. /* Perform the chmod(name, mode) and fchmod(fd, mode) system calls.
* syscall might provide 'name' embedded in the message. * syscall might provide 'name' embedded in the message.
@ -102,7 +102,7 @@ int do_chmod(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_chown * * do_chown *
*===========================================================================*/ *===========================================================================*/
int do_chown(message *UNUSED(m_out)) int do_chown(void)
{ {
/* Perform the chown(path, owner, group) and fchmod(fd, owner, group) system /* Perform the chown(path, owner, group) and fchmod(fd, owner, group) system
* calls. */ * calls. */
@ -184,7 +184,7 @@ int do_chown(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_umask * * do_umask *
*===========================================================================*/ *===========================================================================*/
int do_umask(message *UNUSED(m_out)) int do_umask(void)
{ {
/* Perform the umask(co_mode) system call. */ /* Perform the umask(co_mode) system call. */
mode_t complement, new_umask; mode_t complement, new_umask;
@ -200,7 +200,7 @@ int do_umask(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_access * * do_access *
*===========================================================================*/ *===========================================================================*/
int do_access(message *UNUSED(m_out)) int do_access(void)
{ {
/* Perform the access(name, mode) system call. /* Perform the access(name, mode) system call.
* syscall might provide 'name' embedded in the message. * syscall might provide 'name' embedded in the message.

View File

@ -39,12 +39,12 @@ int bdev_open(dev_t dev, int access);
int bdev_close(dev_t dev); int bdev_close(dev_t dev);
void bdev_reply(void); void bdev_reply(void);
void bdev_up(int major); void bdev_up(int major);
int do_ioctl(message *m_out); int do_ioctl(void);
/* dmap.c */ /* dmap.c */
void lock_dmap(struct dmap *dp); void lock_dmap(struct dmap *dp);
void unlock_dmap(struct dmap *dp); void unlock_dmap(struct dmap *dp);
int do_mapdriver(message *m_out); int do_mapdriver(void);
void init_dmap(void); void init_dmap(void);
int dmap_driver_match(endpoint_t proc, int major); int dmap_driver_match(endpoint_t proc, int major);
void dmap_endpt_up(endpoint_t proc_nr, int is_blk); void dmap_endpt_up(endpoint_t proc_nr, int is_blk);
@ -76,17 +76,17 @@ void invalidate_filp(struct filp *);
void invalidate_filp_by_endpt(endpoint_t proc_e); void invalidate_filp_by_endpt(endpoint_t proc_e);
void invalidate_filp_by_char_major(int major); void invalidate_filp_by_char_major(int major);
void close_filp(struct filp *fp); void close_filp(struct filp *fp);
int do_copyfd(message *m_out); int do_copyfd(void);
/* fscall.c */ /* fscall.c */
void nested_fs_call(message *m); void nested_fs_call(message *m);
/* link.c */ /* link.c */
int do_link(message *m_out); int do_link(void);
int do_unlink(message *m_out); int do_unlink(void);
int do_rename(message *m_out); int do_rename(void);
int do_truncate(message *m_out); int do_truncate(void);
int do_ftruncate(message *m_out); int do_ftruncate(void);
int truncate_vnode(struct vnode *vp, off_t newsize); int truncate_vnode(struct vnode *vp, off_t newsize);
int rdlink_direct(char *orig_path, char *link_path, struct fproc *rfp); int rdlink_direct(char *orig_path, char *link_path, struct fproc *rfp);
@ -98,34 +98,33 @@ void lock_revive(void);
int main(void); int main(void);
void lock_proc(struct fproc *rfp); void lock_proc(struct fproc *rfp);
void unlock_proc(struct fproc *rfp); void unlock_proc(struct fproc *rfp);
void reply(message *m_out, endpoint_t whom, int result);
void replycode(endpoint_t whom, int result); void replycode(endpoint_t whom, int result);
void service_pm_postponed(void); void service_pm_postponed(void);
void thread_cleanup(void); void thread_cleanup(void);
/* misc.c */ /* misc.c */
void pm_exit(void); void pm_exit(void);
int do_fcntl(message *m_out); int do_fcntl(void);
void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid); void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid);
void pm_setgid(endpoint_t proc_e, int egid, int rgid); void pm_setgid(endpoint_t proc_e, int egid, int rgid);
void pm_setuid(endpoint_t proc_e, int euid, int ruid); void pm_setuid(endpoint_t proc_e, int euid, int ruid);
void pm_setgroups(endpoint_t proc_e, int ngroups, gid_t *addr); void pm_setgroups(endpoint_t proc_e, int ngroups, gid_t *addr);
void pm_setsid(endpoint_t proc_e); void pm_setsid(endpoint_t proc_e);
int do_sync(message *m_out); int do_sync(void);
int do_fsync(message *m_out); int do_fsync(void);
void pm_reboot(void); void pm_reboot(void);
int do_svrctl(message *m_out); int do_svrctl(void);
int do_getsysinfo(message *m_out); int do_getsysinfo(void);
int do_vm_call(message *m_out); int do_vm_call(void);
int pm_dumpcore(int sig, vir_bytes exe_name); int pm_dumpcore(int sig, vir_bytes exe_name);
void ds_event(void); void ds_event(void);
int dupvm(struct fproc *fp, int pfd, int *vmfd, struct filp **f); int dupvm(struct fproc *fp, int pfd, int *vmfd, struct filp **f);
int do_getrusage(message *m_out); int do_getrusage(void);
/* mount.c */ /* mount.c */
int do_fsready(message *m_out); int do_fsready(void);
int do_mount(message *m_out); int do_mount(void);
int do_umount(message *m_out); int do_umount(void);
int is_nonedev(dev_t dev); int is_nonedev(dev_t dev);
void mount_pfs(void); void mount_pfs(void);
int mount_fs(dev_t dev, char mount_dev[PATH_MAX], char mount_path[PATH_MAX], int mount_fs(dev_t dev, char mount_dev[PATH_MAX], char mount_path[PATH_MAX],
@ -135,19 +134,17 @@ int unmount(dev_t dev, char label[LABEL_MAX]);
void unmount_all(int force); void unmount_all(int force);
/* open.c */ /* open.c */
int do_close(message *m_out); int do_close(void);
int close_fd(struct fproc *rfp, int fd_nr); int close_fd(struct fproc *rfp, int fd_nr);
int common_open(char path[PATH_MAX], int oflags, mode_t omode); int common_open(char path[PATH_MAX], int oflags, mode_t omode);
int do_creat(void); int do_creat(void);
int do_lseek(message *m_out); int do_lseek(void);
int do_mknod(message *m_out); int do_mknod(void);
int do_mkdir(message *m_out); int do_mkdir(void);
int do_open(message *m_out); int do_open(void);
int do_slink(message *m_out); int do_slink(void);
int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int actual_llseek(struct fproc *rfp, int seekfd, int seekwhence, off_t offset,
int seekwhence, off_t offset); off_t *newposp);
int do_vm_open(void);
int do_vm_close(void);
/* path.c */ /* path.c */
struct vnode *advance(struct vnode *dirp, struct lookup *resolve, struct struct vnode *advance(struct vnode *dirp, struct lookup *resolve, struct
@ -158,11 +155,11 @@ void lookup_init(struct lookup *resolve, char *path, int flags, struct
vmnt **vmp, struct vnode **vp); vmnt **vmp, struct vnode **vp);
int get_name(struct vnode *dirp, struct vnode *entry, char *_name); int get_name(struct vnode *dirp, struct vnode *entry, char *_name);
int canonical_path(char *orig_path, struct fproc *rfp); int canonical_path(char *orig_path, struct fproc *rfp);
int do_checkperms(message *m_out); int do_checkperms(void);
/* pipe.c */ /* pipe.c */
int do_pipe(message *m_out); int do_pipe(void);
int do_pipe2(message *m_out); int do_pipe2(void);
int map_vnode(struct vnode *vp, endpoint_t fs_e); int map_vnode(struct vnode *vp, endpoint_t fs_e);
void unpause(void); void unpause(void);
int pipe_check(struct filp *filp, int rw_flag, int oflags, int bytes, int pipe_check(struct filp *filp, int rw_flag, int oflags, int bytes,
@ -175,17 +172,17 @@ void unsuspend_by_endpt(endpoint_t proc_e);
void wait_for(endpoint_t proc_e); void wait_for(endpoint_t proc_e);
/* protect.c */ /* protect.c */
int do_access(message *m_out); int do_access(void);
int do_chmod(message *m_out); int do_chmod(void);
int do_chown(message *m_out); int do_chown(void);
int do_umask(message *m_out); int do_umask(void);
int forbidden(struct fproc *rfp, struct vnode *vp, mode_t int forbidden(struct fproc *rfp, struct vnode *vp, mode_t
access_desired); access_desired);
int read_only(struct vnode *vp); int read_only(struct vnode *vp);
/* read.c */ /* read.c */
int do_read(message *m_out); int do_read(void);
int do_getdents(message *m_out); int do_getdents(void);
void lock_bsf(void); void lock_bsf(void);
void unlock_bsf(void); void unlock_bsf(void);
void check_bsf_lock(void); void check_bsf_lock(void);
@ -249,21 +246,21 @@ int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actv,
int req_newdriver(endpoint_t fs_e, dev_t dev, char *label); int req_newdriver(endpoint_t fs_e, dev_t dev, char *label);
/* stadir.c */ /* stadir.c */
int do_chdir(message *m_out); int do_chdir(void);
int do_fchdir(message *m_out); int do_fchdir(void);
int do_chroot(message *m_out); int do_chroot(void);
int do_fstat(message *m_out); int do_fstat(void);
int do_stat(message *m_out); int do_stat(void);
int do_statvfs(message *m_out); int do_statvfs(void);
int do_fstatvfs(message *m_out); int do_fstatvfs(void);
int do_getvfsstat(message *m_out); int do_getvfsstat(void);
int do_rdlink(message *m_out); int do_rdlink(void);
int do_lstat(message *m_out); int do_lstat(void);
int update_statvfs(struct vmnt *vmp, struct statvfs *buf); int update_statvfs(struct vmnt *vmp, struct statvfs *buf);
/* time.c */ /* time.c */
int do_utime(message *); int do_utime(void);
int do_utimens(message *); int do_utimens(void);
/* tll.c */ /* tll.c */
void tll_downgrade(tll_t *tllp); void tll_downgrade(tll_t *tllp);
@ -282,7 +279,7 @@ unsigned conv2(int norm, int w);
long conv4(int norm, long x); long conv4(int norm, long x);
int copy_name(size_t len, char *dest); int copy_name(size_t len, char *dest);
int fetch_name(vir_bytes path, size_t len, char *dest); int fetch_name(vir_bytes path, size_t len, char *dest);
int no_sys(message *); int no_sys(void);
int isokendpt_f(const char *f, int l, endpoint_t e, int *p, int ft); int isokendpt_f(const char *f, int l, endpoint_t e, int *p, int ft);
int in_group(struct fproc *rfp, gid_t grp); int in_group(struct fproc *rfp, gid_t grp);
@ -319,7 +316,7 @@ void vnode_clean_refs(struct vnode *vp);
void upgrade_vnode_lock(struct vnode *vp); void upgrade_vnode_lock(struct vnode *vp);
/* write.c */ /* write.c */
int do_write(message *m_out); int do_write(void);
/* gcov.c */ /* gcov.c */
int do_gcov_flush(void); int do_gcov_flush(void);
@ -328,7 +325,7 @@ int do_gcov_flush(void);
#endif #endif
/* select.c */ /* select.c */
int do_select(message *m_out); int do_select(void);
void init_select(void); void init_select(void);
void select_callback(struct filp *, int ops); void select_callback(struct filp *, int ops);
void select_forget(void); void select_forget(void);

View File

@ -29,7 +29,7 @@
/*===========================================================================* /*===========================================================================*
* do_read * * do_read *
*===========================================================================*/ *===========================================================================*/
int do_read(message *UNUSED(m_out)) int do_read(void)
{ {
return(do_read_write_peek(READING, job_m_in.fd, return(do_read_write_peek(READING, job_m_in.fd,
job_m_in.buffer, (size_t) job_m_in.nbytes)); job_m_in.buffer, (size_t) job_m_in.nbytes));
@ -267,7 +267,7 @@ int read_write(struct fproc *rfp, int rw_flag, struct filp *f,
/*===========================================================================* /*===========================================================================*
* do_getdents * * do_getdents *
*===========================================================================*/ *===========================================================================*/
int do_getdents(message *UNUSED(m_out)) int do_getdents(void)
{ {
/* Perform the getdents(fd, buf, size) system call. */ /* Perform the getdents(fd, buf, size) system call. */
int r = OK; int r = OK;

View File

@ -80,7 +80,7 @@ static struct fdtype {
/*===========================================================================* /*===========================================================================*
* do_select * * do_select *
*===========================================================================*/ *===========================================================================*/
int do_select(message *UNUSED(m_out)) int do_select(void)
{ {
/* Implement the select(nfds, readfds, writefds, errorfds, timeout) system /* Implement the select(nfds, readfds, writefds, errorfds, timeout) system
* call. First we copy the arguments and verify their sanity. Then we check * call. First we copy the arguments and verify their sanity. Then we check

View File

@ -30,7 +30,7 @@ static int change_into(struct vnode **iip, struct vnode *vp);
/*===========================================================================* /*===========================================================================*
* do_fchdir * * do_fchdir *
*===========================================================================*/ *===========================================================================*/
int do_fchdir(message *UNUSED(m_out)) int do_fchdir(void)
{ {
/* Change directory on already-opened fd. */ /* Change directory on already-opened fd. */
struct filp *rfilp; struct filp *rfilp;
@ -48,7 +48,7 @@ int do_fchdir(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_chdir * * do_chdir *
*===========================================================================*/ *===========================================================================*/
int do_chdir(message *UNUSED(m_out)) int do_chdir(void)
{ {
/* Perform the chdir(name) system call. /* Perform the chdir(name) system call.
* syscall might provide 'name' embedded in the message. * syscall might provide 'name' embedded in the message.
@ -89,7 +89,7 @@ int do_chdir(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_chroot * * do_chroot *
*===========================================================================*/ *===========================================================================*/
int do_chroot(message *UNUSED(m_out)) int do_chroot(void)
{ {
/* Perform the chroot(name) system call. /* Perform the chroot(name) system call.
* syscall might provide 'name' embedded in the message. * syscall might provide 'name' embedded in the message.
@ -154,7 +154,7 @@ static int change_into(struct vnode **result, struct vnode *vp)
/*===========================================================================* /*===========================================================================*
* do_stat * * do_stat *
*===========================================================================*/ *===========================================================================*/
int do_stat(message *UNUSED(m_out)) int do_stat(void)
{ {
/* Perform the stat(name, buf) system call. */ /* Perform the stat(name, buf) system call. */
int r; int r;
@ -187,7 +187,7 @@ int do_stat(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_fstat * * do_fstat *
*===========================================================================*/ *===========================================================================*/
int do_fstat(message *UNUSED(m_out)) int do_fstat(void)
{ {
/* Perform the fstat(fd, buf) system call. */ /* Perform the fstat(fd, buf) system call. */
register struct filp *rfilp; register struct filp *rfilp;
@ -307,7 +307,7 @@ static int fill_statvfs(struct vmnt *vmp, endpoint_t endpt, vir_bytes buf_addr,
/*===========================================================================* /*===========================================================================*
* do_statvfs * * do_statvfs *
*===========================================================================*/ *===========================================================================*/
int do_statvfs(message *UNUSED(m_out)) int do_statvfs(void)
{ {
/* Perform the statvfs1(name, buf, flags) system call. */ /* Perform the statvfs1(name, buf, flags) system call. */
int r, flags; int r, flags;
@ -341,7 +341,7 @@ int do_statvfs(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_fstatvfs * * do_fstatvfs *
*===========================================================================*/ *===========================================================================*/
int do_fstatvfs(message *UNUSED(m_out)) int do_fstatvfs(void)
{ {
/* Perform the fstatvfs1(fd, buf, flags) system call. */ /* Perform the fstatvfs1(fd, buf, flags) system call. */
register struct filp *rfilp; register struct filp *rfilp;
@ -364,7 +364,7 @@ int do_fstatvfs(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_getvfsstat * * do_getvfsstat *
*===========================================================================*/ *===========================================================================*/
int do_getvfsstat(message *UNUSED(m_out)) int do_getvfsstat(void)
{ {
/* Perform the getvfsstat(buf, bufsize, flags) system call. */ /* Perform the getvfsstat(buf, bufsize, flags) system call. */
struct vmnt *vmp; struct vmnt *vmp;
@ -431,7 +431,7 @@ int do_getvfsstat(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_lstat * * do_lstat *
*===========================================================================*/ *===========================================================================*/
int do_lstat(message *UNUSED(m_out)) int do_lstat(void)
{ {
/* Perform the lstat(name, buf) system call. */ /* Perform the lstat(name, buf) system call. */
struct vnode *vp; struct vnode *vp;

View File

@ -13,7 +13,7 @@
#include "vnode.h" #include "vnode.h"
#include "vmnt.h" #include "vmnt.h"
int (*call_vec[])(message *m_out) = { int (*call_vec[])(void) = {
no_sys, /* 0 = unused */ no_sys, /* 0 = unused */
no_sys, /* 1 = (exit) */ no_sys, /* 1 = (exit) */
no_sys, /* 2 = (fork) */ no_sys, /* 2 = (fork) */

View File

@ -29,7 +29,8 @@ struct worker_thread {
mutex_t w_event_mutex; mutex_t w_event_mutex;
cond_t w_event; cond_t w_event;
struct fproc *w_fp; struct fproc *w_fp;
message w_msg; message w_m_in;
message w_m_out;
int w_err_code; int w_err_code;
message *w_fs_sendrec; message *w_fs_sendrec;
message *w_drv_sendrec; message *w_drv_sendrec;

View File

@ -25,7 +25,7 @@
/*===========================================================================* /*===========================================================================*
* do_utime * * do_utime *
*===========================================================================*/ *===========================================================================*/
int do_utime(message *UNUSED(m_out)) int do_utime(void)
{ {
/* Perform the utime(name, timep) system call. */ /* Perform the utime(name, timep) system call. */
int r; int r;
@ -83,7 +83,7 @@ int do_utime(message *UNUSED(m_out))
/*===========================================================================* /*===========================================================================*
* do_utimens * * do_utimens *
*===========================================================================*/ *===========================================================================*/
int do_utimens(message *UNUSED(m_out)) int do_utimens(void)
{ {
/* Perform the utimens(name, times, flag) system call, and its friends. /* Perform the utimens(name, times, flag) system call, and its friends.
* Implement a very large but not complete subset of the utimensat() * Implement a very large but not complete subset of the utimensat()

View File

@ -96,7 +96,7 @@ int fetch_name(vir_bytes path, size_t len, char *dest)
/*===========================================================================* /*===========================================================================*
* no_sys * * no_sys *
*===========================================================================*/ *===========================================================================*/
int no_sys(message *UNUSED(m_out)) int no_sys(void)
{ {
/* Somebody has used an illegal system call number */ /* Somebody has used an illegal system call number */
return(ENOSYS); return(ENOSYS);

View File

@ -122,7 +122,7 @@ static void *worker_main(void *arg)
/* Perform normal work, if any. */ /* Perform normal work, if any. */
if (fp->fp_func != NULL) { if (fp->fp_func != NULL) {
self->w_msg = fp->fp_msg; self->w_m_in = fp->fp_msg;
err_code = OK; err_code = OK;
fp->fp_func(); fp->fp_func();
@ -132,7 +132,7 @@ static void *worker_main(void *arg)
/* Perform postponed PM work, if any. */ /* Perform postponed PM work, if any. */
if (fp->fp_flags & FP_PM_WORK) { if (fp->fp_flags & FP_PM_WORK) {
self->w_msg = fp->fp_pm_msg; self->w_m_in = fp->fp_pm_msg;
service_pm_postponed(); service_pm_postponed();

View File

@ -13,7 +13,7 @@
/*===========================================================================* /*===========================================================================*
* do_write * * do_write *
*===========================================================================*/ *===========================================================================*/
int do_write(message *UNUSED(m_out)) int do_write(void)
{ {
/* Perform the write(fd, buffer, nbytes) system call. */ /* Perform the write(fd, buffer, nbytes) system call. */
return(do_read_write_peek(WRITING, job_m_in.fd, return(do_read_write_peek(WRITING, job_m_in.fd,