VFS: refactor req_ functions

req_ functions now take a struct vmnt * instead of an endpoint. This
prevents fs_sendrec to have to lookup the struct vmnt * belonging to
an endpoint while the callers in most cases already know it.

Also, every vnode in use now *must* have a valid v_vmnt field (i.e., not
NULL).

Change-Id: Id6380e28f56b378786ea9e5e0006da1f781bd06d
This commit is contained in:
Thomas Veerman 2013-04-23 10:14:35 +00:00
parent fd7bb1786e
commit 59421ed6eb
17 changed files with 228 additions and 228 deletions

View File

@ -121,15 +121,16 @@ int drv_sendrec(endpoint_t drv_e, message *reqmp)
/*===========================================================================* /*===========================================================================*
* fs_sendrec * * fs_sendrec *
*===========================================================================*/ *===========================================================================*/
int fs_sendrec(endpoint_t fs_e, message *reqmp) int fs_sendrec(struct vmnt *vmp, message *reqmp)
{ {
struct vmnt *vmp; endpoint_t fs_e;
int r; int r;
if ((vmp = find_vmnt(fs_e)) == NULL) { if (vmp == NULL) {
printf("Trying to talk to non-existent FS endpoint %d\n", fs_e); printf("Trying to talk to non-existent FS\n");
return(EIO); return(EIO);
} }
fs_e = vmp->m_fs_e;
if (fs_e == fp->fp_endpoint) return(EDEADLK); if (fs_e == fp->fp_endpoint) return(EDEADLK);
self->w_fs_sendrec = reqmp; /* Where to store request and reply */ self->w_fs_sendrec = reqmp; /* Where to store request and reply */

View File

@ -908,8 +908,9 @@ int clone_opcl(
dev = makedev(major(dev), minor(dev_mess.REP_STATUS)); dev = makedev(major(dev), minor(dev_mess.REP_STATUS));
/* Issue request */ /* Issue request */
r = req_newnode(PFS_PROC_NR, fp->fp_effuid, fp->fp_effgid, r = req_newnode(find_vmnt(PFS_PROC_NR), fp->fp_effuid,
ALL_MODES | I_CHAR_SPECIAL, dev, &res); fp->fp_effgid, ALL_MODES | I_CHAR_SPECIAL, dev,
&res);
if (r != OK) { if (r != OK) {
(void) clone_opcl(DEV_CLOSE, dev, proc_e, 0); (void) clone_opcl(DEV_CLOSE, dev, proc_e, 0);
return r; return r;
@ -925,9 +926,8 @@ int clone_opcl(
put_vnode(fp->fp_filp[scratch(fp).file.fd_nr]->filp_vno); put_vnode(fp->fp_filp[scratch(fp).file.fd_nr]->filp_vno);
vp->v_fs_e = res.fs_e; vp->v_fs_e = res.fs_e;
vp->v_vmnt = NULL; vp->v_vmnt = find_vmnt(vp->v_fs_e);
vp->v_dev = NO_DEV; vp->v_dev = NO_DEV;
vp->v_fs_e = res.fs_e;
vp->v_inode_nr = res.inode_nr; vp->v_inode_nr = res.inode_nr;
vp->v_mode = res.fmode; vp->v_mode = res.fmode;
vp->v_sdev = dev; vp->v_sdev = dev;
@ -985,7 +985,7 @@ void bdev_up(int maj)
if (major(vmp->m_dev) != maj) continue; if (major(vmp->m_dev) != maj) continue;
/* Send the driver label to the mounted file system. */ /* Send the driver label to the mounted file system. */
if (OK != req_newdriver(vmp->m_fs_e, vmp->m_dev, label)) if (OK != req_newdriver(vmp, vmp->m_dev, label))
printf("VFS dev_up: error sending new driver label to %d\n", printf("VFS dev_up: error sending new driver label to %d\n",
vmp->m_fs_e); vmp->m_fs_e);
} }
@ -996,7 +996,7 @@ void bdev_up(int maj)
* because it is more work to check for that case. * because it is more work to check for that case.
*/ */
if (found) { if (found) {
if (OK != req_newdriver(ROOT_FS_E, makedev(maj, 0), label)) if (OK != req_newdriver(find_vmnt(ROOT_FS_E), makedev(maj, 0), label))
printf("VFSdev_up: error sending new driver label to %d\n", printf("VFSdev_up: error sending new driver label to %d\n",
ROOT_FS_E); ROOT_FS_E);
} }

View File

@ -155,7 +155,7 @@ static int get_read_vp(struct vfs_exec_info *execi,
else if ((r = forbidden(fp, execi->vp, X_BIT)) != OK) else if ((r = forbidden(fp, execi->vp, X_BIT)) != OK)
return r; return r;
else else
r = req_stat(execi->vp->v_fs_e, execi->vp->v_inode_nr, r = req_stat(execi->vp->v_vmnt, execi->vp->v_inode_nr,
VFS_PROC_NR, (vir_bytes) &(execi->sb)); VFS_PROC_NR, (vir_bytes) &(execi->sb));
if (r != OK) return r; if (r != OK) return r;
@ -499,7 +499,7 @@ char path[PATH_MAX]; /* path to script file */
pos = 0; /* Read from the start of the file */ pos = 0; /* Read from the start of the file */
/* Issue request */ /* Issue request */
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(pos), READING, r = req_readwrite(vp->v_vmnt, vp->v_inode_nr, cvul64(pos), READING,
VFS_PROC_NR, buf, _MAX_BLOCK_SIZE, &new_pos, &cum_io); VFS_PROC_NR, buf, _MAX_BLOCK_SIZE, &new_pos, &cum_io);
if (r != OK) return(r); if (r != OK) return(r);
@ -624,11 +624,11 @@ static int read_seg(struct exec_info *execi, off_t off, off_t seg_addr, size_t s
if (off + seg_bytes > LONG_MAX) return(EIO); if (off + seg_bytes > LONG_MAX) return(EIO);
if ((unsigned long) vp->v_size < off+seg_bytes) return(EIO); if ((unsigned long) vp->v_size < off+seg_bytes) return(EIO);
if ((r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(off), READING, if ((r = req_readwrite(vp->v_vmnt, vp->v_inode_nr, cvul64(off), READING,
execi->proc_e, (char*)seg_addr, seg_bytes, execi->proc_e, (char*)seg_addr, seg_bytes,
&new_pos, &cum_io)) != OK) { &new_pos, &cum_io)) != OK) {
printf("VFS: read_seg: req_readwrite failed (data)\n"); printf("VFS: read_seg: req_readwrite failed (data)\n");
return(r); return(r);
} }
if (r == OK && cum_io != seg_bytes) if (r == OK && cum_io != seg_bytes)
@ -670,7 +670,7 @@ static int map_header(struct vfs_exec_info *execi)
execi->args.hdr_len = MIN(execi->vp->v_size, sizeof(hdr)); execi->args.hdr_len = MIN(execi->vp->v_size, sizeof(hdr));
execi->args.hdr = hdr; execi->args.hdr = hdr;
r = req_readwrite(execi->vp->v_fs_e, execi->vp->v_inode_nr, r = req_readwrite(execi->vp->v_vmnt, execi->vp->v_inode_nr,
cvul64(pos), READING, VFS_PROC_NR, hdr, cvul64(pos), READING, VFS_PROC_NR, hdr,
execi->args.hdr_len, &new_pos, &cum_io); execi->args.hdr_len, &new_pos, &cum_io);
if (r != OK) { if (r != OK) {

View File

@ -631,7 +631,7 @@ struct filp *f;
* mounted. Assume that the root filesystem's * mounted. Assume that the root filesystem's
* is open only for fsck. * is open only for fsck.
*/ */
req_flush(vp->v_bfs_e, dev); req_flush(find_vmnt(vp->v_bfs_e), dev);
} }
unlock_bsf(); unlock_bsf();

View File

@ -76,7 +76,7 @@ int do_link(message *UNUSED(m_out))
r = forbidden(fp, dirp, W_BIT | X_BIT); r = forbidden(fp, dirp, W_BIT | X_BIT);
if (r == OK) if (r == OK)
r = req_link(vp->v_fs_e, dirp->v_inode_nr, fullpath, r = req_link(vp->v_vmnt, dirp->v_inode_nr, fullpath,
vp->v_inode_nr); vp->v_inode_nr);
unlock_vnode(vp); unlock_vnode(vp);
@ -164,9 +164,10 @@ int do_unlink(message *UNUSED(m_out))
upgrade_vmnt_lock(vmp); upgrade_vmnt_lock(vmp);
if (job_call_nr == UNLINK) if (job_call_nr == UNLINK)
r = req_unlink(dirp->v_fs_e, dirp->v_inode_nr, fullpath); r = req_unlink(dirp->v_vmnt, dirp->v_inode_nr, fullpath);
else else
r = req_rmdir(dirp->v_fs_e, dirp->v_inode_nr, fullpath); r = req_rmdir(dirp->v_vmnt, dirp->v_inode_nr, fullpath);
unlock_vnode(dirp); unlock_vnode(dirp);
unlock_vmnt(vmp); unlock_vmnt(vmp);
put_vnode(dirp); put_vnode(dirp);
@ -265,7 +266,7 @@ int do_rename(message *UNUSED(m_out))
if (r == OK) { if (r == OK) {
upgrade_vmnt_lock(oldvmp); /* Upgrade to exclusive access */ upgrade_vmnt_lock(oldvmp); /* Upgrade to exclusive access */
r = req_rename(old_dirp->v_fs_e, old_dirp->v_inode_nr, old_name, r = req_rename(old_dirp->v_vmnt, old_dirp->v_inode_nr, old_name,
new_dirp->v_inode_nr, fullpath); new_dirp->v_inode_nr, fullpath);
} }
@ -386,7 +387,7 @@ off_t newsize;
* called for open(2), which requires an update to the file times if O_TRUNC * called for open(2), which requires an update to the file times if O_TRUNC
* is given, even if the file size remains the same. * is given, even if the file size remains the same.
*/ */
if ((r = req_ftrunc(vp->v_fs_e, vp->v_inode_nr, newsize, 0)) == OK) if ((r = req_ftrunc(vp->v_vmnt, vp->v_inode_nr, newsize, 0)) == OK)
vp->v_size = newsize; vp->v_size = newsize;
return(r); return(r);
} }
@ -422,7 +423,7 @@ int do_slink(message *UNUSED(m_out))
if (fetch_name(vname2, vname2_length, fullpath) != OK) return(err_code); if (fetch_name(vname2, vname2_length, fullpath) != OK) return(err_code);
if ((vp = last_dir(&resolve, fp)) == NULL) return(err_code); if ((vp = last_dir(&resolve, fp)) == NULL) return(err_code);
if ((r = forbidden(fp, vp, W_BIT|X_BIT)) == OK) { if ((r = forbidden(fp, vp, W_BIT|X_BIT)) == OK) {
r = req_slink(vp->v_fs_e, vp->v_inode_nr, fullpath, who_e, r = req_slink(vp->v_vmnt, vp->v_inode_nr, fullpath, who_e,
vname1, vname1_length - 1, fp->fp_effuid, vname1, vname1_length - 1, fp->fp_effuid,
fp->fp_effgid); fp->fp_effgid);
} }
@ -462,7 +463,7 @@ struct fproc *rfp;
if (!S_ISLNK(vp->v_mode)) if (!S_ISLNK(vp->v_mode))
r = EINVAL; r = EINVAL;
else else
r = req_rdlink(vp->v_fs_e, vp->v_inode_nr, NONE, (vir_bytes) link_path, r = req_rdlink(vp->v_vmnt, vp->v_inode_nr, NONE, (vir_bytes) link_path,
PATH_MAX - 1, 1); PATH_MAX - 1, 1);
if (r > 0) link_path[r] = '\0'; /* Terminate string when succesful */ if (r > 0) link_path[r] = '\0'; /* Terminate string when succesful */
@ -507,7 +508,7 @@ int do_rdlink(message *UNUSED(m_out))
if (!S_ISLNK(vp->v_mode)) if (!S_ISLNK(vp->v_mode))
r = EINVAL; r = EINVAL;
else else
r = req_rdlink(vp->v_fs_e, vp->v_inode_nr, who_e, buf, buf_size, 0); r = req_rdlink(vp->v_vmnt, vp->v_inode_nr, who_e, buf, buf_size, 0);
unlock_vnode(vp); unlock_vnode(vp);
unlock_vmnt(vmp); unlock_vmnt(vmp);

View File

@ -225,7 +225,7 @@ int do_fcntl(message *UNUSED(m_out))
} }
if (r != OK) break; if (r != OK) break;
r = req_ftrunc(f->filp_vno->v_fs_e, f->filp_vno->v_inode_nr,start,end); r = req_ftrunc(f->filp_vno->v_vmnt, f->filp_vno->v_inode_nr,start,end);
if (r == OK && flock_arg.l_len == 0) if (r == OK && flock_arg.l_len == 0)
f->filp_vno->v_size = start; f->filp_vno->v_size = start;
@ -261,7 +261,7 @@ sync_fses(void)
break; break;
if (vmp->m_dev != NO_DEV && vmp->m_fs_e != NONE && if (vmp->m_dev != NO_DEV && vmp->m_fs_e != NONE &&
vmp->m_root_node != NULL) { vmp->m_root_node != NULL) {
req_sync(vmp->m_fs_e); req_sync(vmp);
} }
unlock_vmnt(vmp); unlock_vmnt(vmp);
} }
@ -303,7 +303,7 @@ int do_fsync(message *UNUSED(m_out))
if (vmp->m_dev != NO_DEV && vmp->m_dev == dev && if (vmp->m_dev != NO_DEV && vmp->m_dev == dev &&
vmp->m_fs_e != NONE && vmp->m_root_node != NULL) { vmp->m_fs_e != NONE && vmp->m_root_node != NULL) {
req_sync(vmp->m_fs_e); req_sync(vmp);
} }
unlock_vmnt(vmp); unlock_vmnt(vmp);
} }

View File

@ -73,7 +73,7 @@ static void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e)
continue; continue;
} }
if ((r = req_newdriver(fs_e, vp->v_sdev, if ((r = req_newdriver(find_vmnt(fs_e), vp->v_sdev,
dp->dmap_label)) != OK) { dp->dmap_label)) != OK) {
printf("VFS: Failed to send new driver label" printf("VFS: Failed to send new driver label"
" for moved block special file to %d\n", " for moved block special file to %d\n",
@ -210,8 +210,14 @@ char mount_label[LABEL_MAX] )
} }
if ((r = lock_vmnt(new_vmp, VMNT_EXCL)) != OK) return(r); if ((r = lock_vmnt(new_vmp, VMNT_EXCL)) != OK) return(r);
/* Store some essential vmnt data first */
new_vmp->m_fs_e = fs_e;
new_vmp->m_dev = dev;
if (rdonly) new_vmp->m_flags |= VMNT_READONLY;
else new_vmp->m_flags &= ~VMNT_READONLY;
strlcpy(new_vmp->m_mount_path, mount_path, PATH_MAX); strlcpy(new_vmp->m_mount_path, mount_path, PATH_MAX);
strlcpy(new_vmp->m_mount_dev, mount_dev, PATH_MAX); strlcpy(new_vmp->m_mount_dev, mount_dev, PATH_MAX);
isroot = (strcmp(mount_path, "/") == 0); isroot = (strcmp(mount_path, "/") == 0);
mount_root = (isroot && have_root < 2); /* Root can be mounted twice: mount_root = (isroot && have_root < 2); /* Root can be mounted twice:
* 1: ramdisk * 1: ramdisk
@ -227,7 +233,7 @@ char mount_label[LABEL_MAX] )
r = err_code; r = err_code;
else if (vp->v_ref_count == 1) { else if (vp->v_ref_count == 1) {
/*Tell FS on which vnode it is mounted (glue into mount tree)*/ /*Tell FS on which vnode it is mounted (glue into mount tree)*/
r = req_mountpoint(vp->v_fs_e, vp->v_inode_nr); r = req_mountpoint(vp->v_vmnt, vp->v_inode_nr);
} else } else
r = EBUSY; r = EBUSY;
@ -271,15 +277,9 @@ char mount_label[LABEL_MAX] )
rfp = &fproc[slot]; rfp = &fproc[slot];
rfp->fp_flags |= FP_SRV_PROC; /* File Servers are also services */ rfp->fp_flags |= FP_SRV_PROC; /* File Servers are also services */
/* Store some essential vmnt data first */
new_vmp->m_fs_e = fs_e;
new_vmp->m_dev = dev;
if (rdonly) new_vmp->m_flags |= VMNT_READONLY;
else new_vmp->m_flags &= ~VMNT_READONLY;
/* Tell FS which device to mount */ /* Tell FS which device to mount */
new_vmp->m_flags |= VMNT_MOUNTING; new_vmp->m_flags |= VMNT_MOUNTING;
r = req_readsuper(fs_e, label, dev, rdonly, isroot, &res, &con_reqs); r = req_readsuper(new_vmp, label, dev, rdonly, isroot, &res, &con_reqs);
new_vmp->m_flags &= ~VMNT_MOUNTING; new_vmp->m_flags &= ~VMNT_MOUNTING;
if (r != OK) { if (r != OK) {
@ -505,7 +505,7 @@ int unmount(
* unmount request */ * unmount request */
/* Tell FS to unmount */ /* Tell FS to unmount */
if ((r = req_unmount(vmp->m_fs_e)) != OK) /* Not recoverable. */ if ((r = req_unmount(vmp)) != OK) /* Not recoverable. */
printf("VFS: ignoring failed umount attempt FS endpoint: %d (%d)\n", printf("VFS: ignoring failed umount attempt FS endpoint: %d (%d)\n",
vmp->m_fs_e, r); vmp->m_fs_e, r);

View File

@ -205,7 +205,7 @@ int common_open(char path[PATH_MAX], int oflags, mode_t omode)
break; break;
} }
if (req_newdriver(vp->v_bfs_e, vp->v_sdev, if (req_newdriver(find_vmnt(vp->v_bfs_e), vp->v_sdev,
dp->dmap_label) != OK) { dp->dmap_label) != OK) {
printf("VFS: error sending driver label\n"); printf("VFS: error sending driver label\n");
bdev_close(dev); bdev_close(dev);
@ -349,7 +349,7 @@ static struct vnode *new_node(struct lookup *resolve, int oflags, mode_t bits)
upgrade_vmnt_lock(dir_vmp); /* Creating file, need exclusive access */ upgrade_vmnt_lock(dir_vmp); /* Creating file, need exclusive access */
if ((r = forbidden(fp, dirp, W_BIT|X_BIT)) != OK || if ((r = forbidden(fp, dirp, W_BIT|X_BIT)) != OK ||
(r = req_create(dirp->v_fs_e, dirp->v_inode_nr,bits, fp->fp_effuid, (r = req_create(dirp->v_vmnt, dirp->v_inode_nr,bits, fp->fp_effuid,
fp->fp_effgid, path, &res)) != OK ) { fp->fp_effgid, path, &res)) != OK ) {
/* Can't create inode either due to permissions or some other /* Can't create inode either due to permissions or some other
* problem. In case r is EEXIST, we might be dealing with a * problem. In case r is EEXIST, we might be dealing with a
@ -371,7 +371,7 @@ static struct vnode *new_node(struct lookup *resolve, int oflags, mode_t bits)
if (S_ISLNK(slp->v_mode)) { if (S_ISLNK(slp->v_mode)) {
/* Get contents of link */ /* Get contents of link */
r = req_rdlink(slp->v_fs_e, r = req_rdlink(slp->v_vmnt,
slp->v_inode_nr, slp->v_inode_nr,
VFS_PROC_NR, VFS_PROC_NR,
(vir_bytes) path, (vir_bytes) path,
@ -535,7 +535,7 @@ int do_mknod(message *UNUSED(m_out))
if (!S_ISDIR(vp->v_mode)) { if (!S_ISDIR(vp->v_mode)) {
r = ENOTDIR; r = ENOTDIR;
} else if ((r = forbidden(fp, vp, W_BIT|X_BIT)) == OK) { } else if ((r = forbidden(fp, vp, W_BIT|X_BIT)) == OK) {
r = req_mknod(vp->v_fs_e, vp->v_inode_nr, fullpath, fp->fp_effuid, r = req_mknod(vp->v_vmnt, vp->v_inode_nr, fullpath, fp->fp_effuid,
fp->fp_effgid, bits, dev); fp->fp_effgid, bits, dev);
} }
@ -577,7 +577,7 @@ int do_mkdir(message *UNUSED(m_out))
if (!S_ISDIR(vp->v_mode)) { if (!S_ISDIR(vp->v_mode)) {
r = ENOTDIR; r = ENOTDIR;
} else if ((r = forbidden(fp, vp, W_BIT|X_BIT)) == OK) { } else if ((r = forbidden(fp, vp, W_BIT|X_BIT)) == OK) {
r = req_mkdir(vp->v_fs_e, vp->v_inode_nr, fullpath, fp->fp_effuid, r = req_mkdir(vp->v_vmnt, vp->v_inode_nr, fullpath, fp->fp_effuid,
fp->fp_effgid, bits); fp->fp_effgid, bits);
} }
@ -637,7 +637,7 @@ int do_lseek(message *m_out)
rfilp->filp_pos = newpos; rfilp->filp_pos = newpos;
/* Inhibit read ahead request */ /* Inhibit read ahead request */
r = req_inhibread(rfilp->filp_vno->v_fs_e, r = req_inhibread(rfilp->filp_vno->v_vmnt,
rfilp->filp_vno->v_inode_nr); rfilp->filp_vno->v_inode_nr);
} }
} }
@ -695,7 +695,7 @@ int do_llseek(message *m_out)
rfilp->filp_pos = newpos; rfilp->filp_pos = newpos;
/* Inhibit read ahead request */ /* Inhibit read ahead request */
r = req_inhibread(rfilp->filp_vno->v_fs_e, r = req_inhibread(rfilp->filp_vno->v_vmnt,
rfilp->filp_vno->v_inode_nr); rfilp->filp_vno->v_inode_nr);
} }
} }

View File

@ -280,7 +280,7 @@ struct fproc *rfp;
break; break;
} }
r = req_rdlink(sym_vp->v_fs_e, sym_vp->v_inode_nr, NONE, r = req_rdlink(sym_vp->v_vmnt, sym_vp->v_inode_nr, NONE,
(vir_bytes) resolve->l_path, PATH_MAX - 1, 1); (vir_bytes) resolve->l_path, PATH_MAX - 1, 1);
if (r < 0) { if (r < 0) {
@ -406,7 +406,7 @@ struct fproc *rfp;
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
struct vnode *dir_vp; struct vnode *dir_vp;
struct vmnt *vmp, *vmpres; struct vmnt *vmp, *vmpres, *sendvmp;
struct lookup_res res; struct lookup_res res;
tll_access_t mnt_lock_type; tll_access_t mnt_lock_type;
@ -428,7 +428,7 @@ struct fproc *rfp;
fs_e = start_node->v_fs_e; fs_e = start_node->v_fs_e;
dir_ino = start_node->v_inode_nr; dir_ino = start_node->v_inode_nr;
vmpres = find_vmnt(fs_e); sendvmp = vmpres = find_vmnt(fs_e);
if (vmpres == NULL) return(EIO); /* mountpoint vanished? */ if (vmpres == NULL) return(EIO); /* mountpoint vanished? */
@ -460,7 +460,7 @@ struct fproc *rfp;
*(resolve->l_vmp) = vmpres; *(resolve->l_vmp) = vmpres;
/* Issue the request */ /* Issue the request */
r = req_lookup(fs_e, dir_ino, root_ino, uid, gid, resolve, &res, rfp); r = req_lookup(sendvmp, dir_ino, root_ino, uid, gid, resolve, &res, rfp);
if (r != OK && r != EENTERMOUNT && r != ELEAVEMOUNT && r != ESYMLINK) { if (r != OK && r != EENTERMOUNT && r != ELEAVEMOUNT && r != ESYMLINK) {
if (vmpres) unlock_vmnt(vmpres); if (vmpres) unlock_vmnt(vmpres);
@ -546,7 +546,7 @@ struct fproc *rfp;
/* Unlock a previously locked vmnt if locked and lock new vmnt */ /* Unlock a previously locked vmnt if locked and lock new vmnt */
if (vmpres) unlock_vmnt(vmpres); if (vmpres) unlock_vmnt(vmpres);
vmpres = find_vmnt(fs_e); sendvmp = vmpres = find_vmnt(fs_e);
if (vmpres == NULL) return(EIO); /* mount point vanished? */ if (vmpres == NULL) return(EIO); /* mount point vanished? */
if ((r = lock_vmnt(vmpres, mnt_lock_type)) != OK) { if ((r = lock_vmnt(vmpres, mnt_lock_type)) != OK) {
if (r == EBUSY) if (r == EBUSY)
@ -556,7 +556,7 @@ struct fproc *rfp;
} }
*(resolve->l_vmp) = vmpres; *(resolve->l_vmp) = vmpres;
r = req_lookup(fs_e, dir_ino, root_ino, uid, gid, resolve, &res, rfp); r = req_lookup(sendvmp, dir_ino, root_ino, uid, gid, resolve, &res,rfp);
if (r != OK && r != EENTERMOUNT && r != ELEAVEMOUNT && r != ESYMLINK) { if (r != OK && r != EENTERMOUNT && r != ELEAVEMOUNT && r != ESYMLINK) {
if (vmpres) unlock_vmnt(vmpres); if (vmpres) unlock_vmnt(vmpres);
@ -625,7 +625,7 @@ char ename[NAME_MAX + 1];
if (!S_ISDIR(dirp->v_mode)) return(EBADF); if (!S_ISDIR(dirp->v_mode)) return(EBADF);
do { do {
r = req_getdents(dirp->v_fs_e, dirp->v_inode_nr, pos, buf, sizeof(buf), r = req_getdents(dirp->v_vmnt, dirp->v_inode_nr, pos, buf, sizeof(buf),
&new_pos, 1); &new_pos, 1);
if (r == 0) { if (r == 0) {

View File

@ -123,7 +123,7 @@ static int create_pipe(int fil_des[2], int flags)
fil_ptr1->filp_count = 1; fil_ptr1->filp_count = 1;
/* Create a named pipe inode on PipeFS */ /* Create a named pipe inode on PipeFS */
r = req_newnode(PFS_PROC_NR, fp->fp_effuid, fp->fp_effgid, I_NAMED_PIPE, r = req_newnode(vmp, fp->fp_effuid, fp->fp_effgid, I_NAMED_PIPE,
NO_DEV, &res); NO_DEV, &res);
if (r != OK) { if (r != OK) {
@ -150,7 +150,8 @@ static int create_pipe(int fil_des[2], int flags)
vp->v_mapfs_count = 1; vp->v_mapfs_count = 1;
vp->v_ref_count = 1; vp->v_ref_count = 1;
vp->v_size = 0; vp->v_size = 0;
vp->v_vmnt = NULL; vp->v_vmnt = find_vmnt(res.fs_e);
assert(vp->v_vmnt == find_vmnt(PFS_PROC_NR));
vp->v_dev = NO_DEV; vp->v_dev = NO_DEV;
/* Fill in filp objects */ /* Fill in filp objects */
@ -178,7 +179,7 @@ int map_vnode(vp, map_to_fs_e)
struct vnode *vp; struct vnode *vp;
endpoint_t map_to_fs_e; endpoint_t map_to_fs_e;
{ {
int r; int r, do_unlock = 1;
struct vmnt *vmp; struct vmnt *vmp;
struct node_details res; struct node_details res;
@ -188,7 +189,7 @@ endpoint_t map_to_fs_e;
panic("Can't map to unknown endpoint"); panic("Can't map to unknown endpoint");
if ((r = lock_vmnt(vmp, VMNT_WRITE)) != OK) { if ((r = lock_vmnt(vmp, VMNT_WRITE)) != OK) {
if (r == EBUSY) if (r == EBUSY)
vmp = NULL; /* Already locked, do not unlock */ do_unlock = 0; /* Already locked, do not unlock */
else else
return(r); return(r);
@ -197,14 +198,14 @@ endpoint_t map_to_fs_e;
/* Create a temporary mapping of this inode to another FS. Read and write /* Create a temporary mapping of this inode to another FS. Read and write
* operations on data will be handled by that FS. The rest by the 'original' * operations on data will be handled by that FS. The rest by the 'original'
* FS that holds the inode. */ * FS that holds the inode. */
if ((r = req_newnode(map_to_fs_e, fp->fp_effuid, fp->fp_effgid, I_NAMED_PIPE, if ((r = req_newnode(vmp, fp->fp_effuid, fp->fp_effgid, I_NAMED_PIPE,
vp->v_dev, &res)) == OK) { vp->v_dev, &res)) == OK) {
vp->v_mapfs_e = res.fs_e; vp->v_mapfs_e = res.fs_e;
vp->v_mapinode_nr = res.inode_nr; vp->v_mapinode_nr = res.inode_nr;
vp->v_mapfs_count = 1; vp->v_mapfs_count = 1;
} }
if (vmp) unlock_vmnt(vmp); if (do_unlock) unlock_vmnt(vmp);
return(r); return(r);
} }

View File

@ -83,7 +83,7 @@ int do_chmod(message *UNUSED(m_out))
if (fp->fp_effuid != SU_UID && vp->v_gid != fp->fp_effgid) if (fp->fp_effuid != SU_UID && vp->v_gid != fp->fp_effgid)
new_mode &= ~I_SET_GID_BIT; new_mode &= ~I_SET_GID_BIT;
r = req_chmod(vp->v_fs_e, vp->v_inode_nr, new_mode, &result_mode); r = req_chmod(vp->v_vmnt, vp->v_inode_nr, new_mode, &result_mode);
if (r == OK) if (r == OK)
vp->v_mode = result_mode; vp->v_mode = result_mode;
} }
@ -163,7 +163,7 @@ int do_chown(message *UNUSED(m_out))
if (new_uid > UID_MAX || new_gid > GID_MAX) if (new_uid > UID_MAX || new_gid > GID_MAX)
r = EINVAL; r = EINVAL;
else if ((r = req_chown(vp->v_fs_e, vp->v_inode_nr, new_uid, new_gid, else if ((r = req_chown(vp->v_vmnt, vp->v_inode_nr, new_uid, new_gid,
&new_mode)) == OK) { &new_mode)) == OK) {
vp->v_uid = new_uid; vp->v_uid = new_uid;
vp->v_gid = new_gid; vp->v_gid = new_gid;

View File

@ -24,7 +24,7 @@ typedef struct filp * filp_id_t;
/* comm.c */ /* comm.c */
int drv_sendrec(endpoint_t drv_e, message *reqm); int drv_sendrec(endpoint_t drv_e, message *reqm);
void fs_cancel(struct vmnt *vmp); void fs_cancel(struct vmnt *vmp);
int fs_sendrec(endpoint_t fs_e, message *reqm); int fs_sendrec(struct vmnt *vmp, message *reqm);
void fs_sendmore(struct vmnt *vmp); void fs_sendmore(struct vmnt *vmp);
void send_work(void); void send_work(void);
@ -219,53 +219,54 @@ int rw_pipe(int rw_flag, endpoint_t usr, struct filp *f, char *buf,
size_t req_size); size_t req_size);
/* request.c */ /* request.c */
int req_breadwrite(endpoint_t fs_e, endpoint_t user_e, dev_t dev, u64_t pos, int req_breadwrite(struct vmnt *vmp, endpoint_t user_e, dev_t dev, u64_t pos,
unsigned int num_of_bytes, char *user_addr, int rw_flag, unsigned int num_of_bytes, char *user_addr, int rw_flag,
u64_t *new_posp, unsigned int *cum_iop); u64_t *new_posp, unsigned int *cum_iop);
int req_chmod(int fs_e, ino_t inode_nr, mode_t rmode, mode_t *new_modep); int req_chmod(struct vmnt *vmp, ino_t inode_nr, mode_t rmode, mode_t *newmodep);
int req_chown(endpoint_t fs_e, ino_t inode_nr, uid_t newuid, gid_t newgid, int req_chown(struct vmnt *vmp, ino_t inode_nr, uid_t newuid, gid_t newgid,
mode_t *new_modep); mode_t *new_modep);
int req_create(int fs_e, ino_t inode_nr, int omode, uid_t uid, gid_t gid, int req_create(struct vmnt *vmp, ino_t inode_nr, int omode, uid_t uid,
char *path, node_details_t *res); gid_t gid, char *path, node_details_t *res);
int req_flush(endpoint_t fs_e, dev_t dev); int req_flush(struct vmnt *vmp, dev_t dev);
int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf); int req_fstatfs(struct vmnt *vmp, endpoint_t proc_e, vir_bytes buf);
int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf); int req_statvfs(struct vmnt *vmp, endpoint_t proc_e, vir_bytes buf);
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end); int req_ftrunc(struct vmnt *vmp, ino_t inode_nr, off_t start, off_t end);
int req_getdents(endpoint_t fs_e, ino_t inode_nr, u64_t pos, char *buf, int req_getdents(struct vmnt *vmp, ino_t inode_nr, u64_t pos, char *buf,
size_t size, u64_t *new_pos, int direct); size_t size, u64_t *new_pos, int direct);
int req_inhibread(endpoint_t fs_e, ino_t inode_nr); int req_inhibread(struct vmnt *vmp, ino_t inode_nr);
int req_link(endpoint_t fs_e, ino_t link_parent, char *lastc, int req_link(struct vmnt *vmp, ino_t link_parent, char *lastc,
ino_t linked_file); ino_t linked_file);
int req_lookup(endpoint_t fs_e, ino_t dir_ino, ino_t root_ino, uid_t uid, int req_lookup(struct vmnt *vmp, ino_t dir_ino, ino_t root_ino, uid_t uid,
gid_t gid, struct lookup *resolve, lookup_res_t *res, gid_t gid, struct lookup *resolve, lookup_res_t *res,
struct fproc *rfp); struct fproc *rfp);
int req_mkdir(endpoint_t fs_e, ino_t inode_nr, char *lastc, uid_t uid, int req_mkdir(struct vmnt *vmp, ino_t inode_nr, char *lastc, uid_t uid,
gid_t gid, mode_t dmode); gid_t gid, mode_t dmode);
int req_mknod(endpoint_t fs_e, ino_t inode_nr, char *lastc, uid_t uid, int req_mknod(struct vmnt *vmp, ino_t inode_nr, char *lastc, uid_t uid,
gid_t gid, mode_t dmode, dev_t dev); gid_t gid, mode_t dmode, dev_t dev);
int req_mountpoint(endpoint_t fs_e, ino_t inode_nr); int req_mountpoint(struct vmnt *vmp, ino_t inode_nr);
int req_newnode(endpoint_t fs_e, uid_t uid, gid_t gid, mode_t dmode, dev_t dev, int req_newnode(struct vmnt *vmp, uid_t uid, gid_t gid, mode_t dmode, dev_t dev,
struct node_details *res); struct node_details *res);
int req_putnode(int fs_e, ino_t inode_nr, int count); int req_putnode(struct vmnt *vmp, ino_t inode_nr, int count);
int req_rdlink(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, int req_rdlink(struct vmnt *vmp, ino_t inode_nr, endpoint_t proc_e,
vir_bytes buf, size_t len, int direct); vir_bytes buf, size_t len, int direct);
int req_readsuper(endpoint_t fs_e, char *driver_name, dev_t dev, int readonly, int req_readsuper(struct vmnt *vmp, char *driver_name, dev_t dev, int readonly,
int isroot, struct node_details *res_nodep, int *con_reqs); int isroot, struct node_details *res_nodep, int *con_reqs);
int req_readwrite(endpoint_t fs_e, ino_t inode_nr, u64_t pos, int rw_flag, int req_readwrite(struct vmnt *vmp, ino_t inode_nr, u64_t pos, int rw_flag,
endpoint_t user_e, char *user_addr, unsigned int num_of_bytes, endpoint_t user_e, char *user_addr, unsigned int num_of_bytes,
u64_t *new_posp, unsigned int *cum_iop); u64_t *new_posp, unsigned int *cum_iop);
int req_rename(endpoint_t fs_e, ino_t old_dir, char *old_name, ino_t new_dir, int req_rename(struct vmnt *vmp, ino_t old_dir, char *old_name, ino_t new_dir,
char *new_name); char *new_name);
int req_rmdir(endpoint_t fs_e, ino_t inode_nr, char *lastc); int req_rmdir(struct vmnt *vmp, ino_t inode_nr, char *lastc);
int req_slink(endpoint_t fs_e, ino_t inode_nr, char *lastc, endpoint_t proc_e, int req_slink(struct vmnt *vmp, ino_t inode_nr, char *lastc, endpoint_t proc_e,
vir_bytes path_addr, size_t path_length, uid_t uid, gid_t gid); vir_bytes path_addr, size_t path_length, uid_t uid, gid_t gid);
int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf); int req_stat(struct vmnt *vmp, ino_t inode_nr, endpoint_t proc_e,
int req_sync(endpoint_t fs_e); vir_bytes buf);
int req_unlink(endpoint_t fs_e, ino_t inode_nr, char *lastc); int req_sync(struct vmnt *vmp);
int req_unmount(endpoint_t fs_e); int req_unlink(struct vmnt *vmp, ino_t inode_nr, char *lastc);
int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actv, int req_unmount(struct vmnt *vmp);
int req_utime(struct vmnt *vmp, ino_t inode_nr, struct timespec * actv,
struct timespec * modtv); struct timespec * modtv);
int req_newdriver(endpoint_t fs_e, dev_t dev, char *label); int req_newdriver(struct vmnt *vmp, dev_t dev, char *label);
/* stadir.c */ /* stadir.c */
int do_chdir(message *m_out); int do_chdir(message *m_out);

View File

@ -174,8 +174,8 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
lock_bsf(); lock_bsf();
r = req_breadwrite(vp->v_bfs_e, for_e, vp->v_sdev, position, size, r = req_breadwrite(find_vmnt(vp->v_bfs_e), for_e, vp->v_sdev, position,
buf, rw_flag, &res_pos, &res_cum_io); size, buf, rw_flag, &res_pos, &res_cum_io);
if (r == OK) { if (r == OK) {
position = res_pos; position = res_pos;
cum_io += res_cum_io; cum_io += res_cum_io;
@ -189,7 +189,7 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
} }
/* Issue request */ /* Issue request */
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, position, rw_flag, for_e, r = req_readwrite(vp->v_vmnt, vp->v_inode_nr, position, rw_flag, for_e,
buf, size, &new_pos, &cum_io_incr); buf, size, &new_pos, &cum_io_incr);
if (r >= 0) { if (r >= 0) {
@ -257,7 +257,7 @@ int do_getdents(message *UNUSED(m_out))
if (ex64hi(rfilp->filp_pos) != 0) if (ex64hi(rfilp->filp_pos) != 0)
panic("do_getdents: can't handle large offsets"); panic("do_getdents: can't handle large offsets");
r = req_getdents(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr, r = req_getdents(rfilp->filp_vno->v_vmnt, rfilp->filp_vno->v_inode_nr,
rfilp->filp_pos, scratch(fp).io.io_buffer, rfilp->filp_pos, scratch(fp).io.io_buffer,
scratch(fp).io.io_nbytes, &new_pos,0); scratch(fp).io.io_nbytes, &new_pos,0);
@ -312,8 +312,8 @@ size_t req_size;
if (vp->v_mapfs_e == 0) if (vp->v_mapfs_e == 0)
panic("unmapped pipe"); panic("unmapped pipe");
r = req_readwrite(vp->v_mapfs_e, vp->v_mapinode_nr, position, rw_flag, usr_e, r = req_readwrite(find_vmnt(vp->v_mapfs_e), vp->v_mapinode_nr, position,
buf, size, &new_pos, &cum_io_incr); rw_flag, usr_e, buf, size, &new_pos, &cum_io_incr);
if (r != OK) { if (r != OK) {
return(r); return(r);

View File

@ -29,7 +29,7 @@
* req_breadwrite * * req_breadwrite *
*===========================================================================*/ *===========================================================================*/
int req_breadwrite( int req_breadwrite(
endpoint_t fs_e, struct vmnt *vmp,
endpoint_t user_e, endpoint_t user_e,
dev_t dev, dev_t dev,
u64_t pos, u64_t pos,
@ -44,8 +44,8 @@ int req_breadwrite(
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
message m; message m;
grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes, grant_id = cpf_grant_magic(vmp->m_fs_e, user_e, (vir_bytes) user_addr,
(rw_flag == READING ? CPF_WRITE : CPF_READ)); num_of_bytes, (rw_flag == READING ? CPF_WRITE : CPF_READ));
if(grant_id == -1) if(grant_id == -1)
panic("req_breadwrite: cpf_grant_magic failed"); panic("req_breadwrite: cpf_grant_magic failed");
@ -58,7 +58,7 @@ int req_breadwrite(
m.REQ_NBYTES = num_of_bytes; m.REQ_NBYTES = num_of_bytes;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if (r != OK) return(r); if (r != OK) return(r);
@ -74,7 +74,7 @@ int req_breadwrite(
* req_chmod * * req_chmod *
*===========================================================================*/ *===========================================================================*/
int req_chmod( int req_chmod(
int fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
mode_t rmode, mode_t rmode,
mode_t *new_modep mode_t *new_modep
@ -89,7 +89,7 @@ int req_chmod(
m.REQ_MODE = rmode; m.REQ_MODE = rmode;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
/* Copy back actual mode. */ /* Copy back actual mode. */
*new_modep = m.RES_MODE; *new_modep = m.RES_MODE;
@ -102,7 +102,7 @@ int req_chmod(
* req_chown * * req_chown *
*===========================================================================*/ *===========================================================================*/
int req_chown( int req_chown(
endpoint_t fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
uid_t newuid, uid_t newuid,
gid_t newgid, gid_t newgid,
@ -119,7 +119,7 @@ int req_chown(
m.REQ_GID = newgid; m.REQ_GID = newgid;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
/* Return new mode to caller. */ /* Return new mode to caller. */
*new_modep = m.RES_MODE; *new_modep = m.RES_MODE;
@ -132,7 +132,7 @@ int req_chown(
* req_create * * req_create *
*===========================================================================*/ *===========================================================================*/
int req_create( int req_create(
int fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
int omode, int omode,
uid_t uid, uid_t uid,
@ -150,7 +150,7 @@ int req_create(
panic("req_create: filename starts with '/'"); panic("req_create: filename starts with '/'");
len = strlen(path) + 1; len = strlen(path) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) path, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) path, len, CPF_READ);
if (grant_id == -1) if (grant_id == -1)
panic("req_create: cpf_grant_direct failed"); panic("req_create: cpf_grant_direct failed");
@ -164,7 +164,7 @@ int req_create(
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if (r != OK) return(r); if (r != OK) return(r);
@ -184,7 +184,7 @@ int req_create(
/*===========================================================================* /*===========================================================================*
* req_flush * * req_flush *
*===========================================================================*/ *===========================================================================*/
int req_flush(endpoint_t fs_e, dev_t dev) int req_flush(struct vmnt *vmp, dev_t dev)
{ {
message m; message m;
@ -193,20 +193,20 @@ int req_flush(endpoint_t fs_e, dev_t dev)
m.REQ_DEV = dev; m.REQ_DEV = dev;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
/*===========================================================================* /*===========================================================================*
* req_fstatfs * * req_fstatfs *
*===========================================================================*/ *===========================================================================*/
int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf) int req_fstatfs(struct vmnt *vmp, endpoint_t proc_e, vir_bytes buf)
{ {
int r; int r;
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
message m; message m;
grant_id = cpf_grant_magic(fs_e, proc_e, buf, sizeof(struct statfs), grant_id = cpf_grant_magic(vmp->m_fs_e, proc_e, buf, sizeof(struct statfs),
CPF_WRITE); CPF_WRITE);
if (grant_id == GRANT_INVALID) if (grant_id == GRANT_INVALID)
panic("req_fstatfs: cpf_grant_magic failed"); panic("req_fstatfs: cpf_grant_magic failed");
@ -216,7 +216,7 @@ int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
m.REQ_GRANT = grant_id; m.REQ_GRANT = grant_id;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -226,13 +226,13 @@ int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
/*===========================================================================* /*===========================================================================*
* req_statvfs * * req_statvfs *
*===========================================================================*/ *===========================================================================*/
int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf) int req_statvfs(struct vmnt *vmp, endpoint_t proc_e, vir_bytes buf)
{ {
int r; int r;
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
message m; message m;
grant_id = cpf_grant_magic(fs_e, proc_e, buf, sizeof(struct statvfs), grant_id = cpf_grant_magic(vmp->m_fs_e, proc_e, buf, sizeof(struct statvfs),
CPF_WRITE); CPF_WRITE);
if(grant_id == GRANT_INVALID) if(grant_id == GRANT_INVALID)
panic("req_statvfs: cpf_grant_magic failed"); panic("req_statvfs: cpf_grant_magic failed");
@ -242,7 +242,7 @@ int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
m.REQ_GRANT = grant_id; m.REQ_GRANT = grant_id;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -252,7 +252,7 @@ int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
/*===========================================================================* /*===========================================================================*
* req_ftrunc * * req_ftrunc *
*===========================================================================*/ *===========================================================================*/
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end) int req_ftrunc(struct vmnt *vmp, ino_t inode_nr, off_t start, off_t end)
{ {
message m; message m;
@ -265,7 +265,7 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
m.REQ_TRC_END_HI = 0; /* Not used for now, so clear it. */ m.REQ_TRC_END_HI = 0; /* Not used for now, so clear it. */
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
@ -273,7 +273,7 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
* req_getdents * * req_getdents *
*===========================================================================*/ *===========================================================================*/
int req_getdents( int req_getdents(
endpoint_t fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
u64_t pos, u64_t pos,
char *buf, char *buf,
@ -287,10 +287,10 @@ int req_getdents(
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
if (direct) { if (direct) {
grant_id = cpf_grant_direct(fs_e, (vir_bytes) buf, size, grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) buf, size,
CPF_WRITE); CPF_WRITE);
} else { } else {
grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, size, grant_id = cpf_grant_magic(vmp->m_fs_e, who_e, (vir_bytes) buf, size,
CPF_WRITE); CPF_WRITE);
} }
@ -305,7 +305,7 @@ int req_getdents(
m.REQ_SEEK_POS_LO = ex64lo(pos); m.REQ_SEEK_POS_LO = ex64lo(pos);
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */ m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if (r == OK) { if (r == OK) {
@ -319,7 +319,7 @@ int req_getdents(
/*===========================================================================* /*===========================================================================*
* req_inhibread * * req_inhibread *
*===========================================================================*/ *===========================================================================*/
int req_inhibread(endpoint_t fs_e, ino_t inode_nr) int req_inhibread(struct vmnt *vmp, ino_t inode_nr)
{ {
message m; message m;
@ -328,7 +328,7 @@ int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
m.REQ_INODE_NR = inode_nr; m.REQ_INODE_NR = inode_nr;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
@ -336,7 +336,7 @@ int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
* req_link * * req_link *
*===========================================================================*/ *===========================================================================*/
int req_link( int req_link(
endpoint_t fs_e, struct vmnt *vmp,
ino_t link_parent, ino_t link_parent,
char *lastc, char *lastc,
ino_t linked_file ino_t linked_file
@ -347,7 +347,7 @@ int req_link(
const size_t len = strlen(lastc) + 1; const size_t len = strlen(lastc) + 1;
message m; message m;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1) if(grant_id == -1)
panic("req_link: cpf_grant_direct failed"); panic("req_link: cpf_grant_direct failed");
@ -359,7 +359,7 @@ int req_link(
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -370,7 +370,7 @@ int req_link(
* req_lookup * * req_lookup *
*===========================================================================*/ *===========================================================================*/
int req_lookup( int req_lookup(
endpoint_t fs_e, struct vmnt *vmp,
ino_t dir_ino, ino_t dir_ino,
ino_t root_ino, ino_t root_ino,
uid_t uid, uid_t uid,
@ -387,8 +387,8 @@ int req_lookup(
vfs_ucred_t credentials; vfs_ucred_t credentials;
int flags; int flags;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) resolve->l_path, PATH_MAX, grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) resolve->l_path,
CPF_READ | CPF_WRITE); PATH_MAX, CPF_READ | CPF_WRITE);
if(grant_id == -1) if(grant_id == -1)
panic("req_lookup: cpf_grant_direct failed"); panic("req_lookup: cpf_grant_direct failed");
@ -413,7 +413,7 @@ int req_lookup(
for (i = 0; i < rfp->fp_ngroups; i++) for (i = 0; i < rfp->fp_ngroups; i++)
credentials.vu_sgroups[i] = rfp->fp_sgroups[i]; credentials.vu_sgroups[i] = rfp->fp_sgroups[i];
grant_id2 = cpf_grant_direct(fs_e, (vir_bytes) &credentials, grant_id2 = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) &credentials,
sizeof(credentials), CPF_READ); sizeof(credentials), CPF_READ);
if(grant_id2 == -1) if(grant_id2 == -1)
panic("req_lookup: cpf_grant_direct failed"); panic("req_lookup: cpf_grant_direct failed");
@ -431,7 +431,7 @@ int req_lookup(
m.REQ_FLAGS = flags; m.REQ_FLAGS = flags;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if(rfp->fp_ngroups > 0) cpf_revoke(grant_id2); if(rfp->fp_ngroups > 0) cpf_revoke(grant_id2);
@ -472,7 +472,7 @@ int req_lookup(
* req_mkdir * * req_mkdir *
*===========================================================================*/ *===========================================================================*/
int req_mkdir( int req_mkdir(
endpoint_t fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
char *lastc, char *lastc,
uid_t uid, uid_t uid,
@ -486,7 +486,7 @@ int req_mkdir(
message m; message m;
len = strlen(lastc) + 1; len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1) if(grant_id == -1)
panic("req_mkdir: cpf_grant_direct failed"); panic("req_mkdir: cpf_grant_direct failed");
@ -500,7 +500,7 @@ int req_mkdir(
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -511,7 +511,7 @@ int req_mkdir(
* req_mknod * * req_mknod *
*===========================================================================*/ *===========================================================================*/
int req_mknod( int req_mknod(
endpoint_t fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
char *lastc, char *lastc,
uid_t uid, uid_t uid,
@ -526,7 +526,7 @@ int req_mknod(
message m; message m;
len = strlen(lastc) + 1; len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1) if(grant_id == -1)
panic("req_mknod: cpf_grant_direct failed"); panic("req_mknod: cpf_grant_direct failed");
@ -541,7 +541,7 @@ int req_mknod(
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -551,7 +551,7 @@ int req_mknod(
/*===========================================================================* /*===========================================================================*
* req_mountpoint * * req_mountpoint *
*===========================================================================*/ *===========================================================================*/
int req_mountpoint(endpoint_t fs_e, ino_t inode_nr) int req_mountpoint(struct vmnt *vmp, ino_t inode_nr)
{ {
message m; message m;
@ -560,7 +560,7 @@ int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
m.REQ_INODE_NR = inode_nr; m.REQ_INODE_NR = inode_nr;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
@ -568,7 +568,7 @@ int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
* req_newnode * * req_newnode *
*===========================================================================*/ *===========================================================================*/
int req_newnode( int req_newnode(
endpoint_t fs_e, struct vmnt *vmp,
uid_t uid, uid_t uid,
gid_t gid, gid_t gid,
mode_t dmode, mode_t dmode,
@ -587,7 +587,7 @@ int req_newnode(
m.REQ_GID = gid; m.REQ_GID = gid;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
res->fs_e = m.m_source; res->fs_e = m.m_source;
res->inode_nr = m.RES_INODE_NR; res->inode_nr = m.RES_INODE_NR;
@ -605,7 +605,7 @@ int req_newnode(
* req_newdriver * * req_newdriver *
*===========================================================================*/ *===========================================================================*/
int req_newdriver( int req_newdriver(
endpoint_t fs_e, struct vmnt *vmp,
dev_t dev, dev_t dev,
char *label char *label
) )
@ -617,7 +617,7 @@ int req_newdriver(
/* Grant access to label */ /* Grant access to label */
len = strlen(label) + 1; len = strlen(label) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) label, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) label, len, CPF_READ);
if (grant_id == -1) if (grant_id == -1)
panic("req_newdriver: cpf_grant_direct failed"); panic("req_newdriver: cpf_grant_direct failed");
@ -628,7 +628,7 @@ int req_newdriver(
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Issue request */ /* Issue request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
@ -639,10 +639,7 @@ int req_newdriver(
/*===========================================================================* /*===========================================================================*
* req_putnode * * req_putnode *
*===========================================================================*/ *===========================================================================*/
int req_putnode(fs_e, inode_nr, count) int req_putnode(struct vmnt *vmp, ino_t inode_nr, int count)
int fs_e;
ino_t inode_nr;
int count;
{ {
message m; message m;
@ -652,29 +649,29 @@ int count;
m.REQ_COUNT = count; m.REQ_COUNT = count;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
/*===========================================================================* /*===========================================================================*
* req_rdlink * * req_rdlink *
*===========================================================================*/ *===========================================================================*/
int req_rdlink(fs_e, inode_nr, proc_e, buf, len, direct) int req_rdlink(
endpoint_t fs_e; struct vmnt *vmp,
ino_t inode_nr; ino_t inode_nr,
endpoint_t proc_e; endpoint_t proc_e,
vir_bytes buf; vir_bytes buf,
size_t len; size_t len,
int direct; /* set to 1 to use direct grants instead of magic grants */ int direct /* set to 1 to use direct grants instead of magic grants */
{ ) {
message m; message m;
int r; int r;
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
if (direct) { if (direct) {
grant_id = cpf_grant_direct(fs_e, buf, len, CPF_WRITE); grant_id = cpf_grant_direct(vmp->m_fs_e, buf, len, CPF_WRITE);
} else { } else {
grant_id = cpf_grant_magic(fs_e, proc_e, buf, len, CPF_WRITE); grant_id = cpf_grant_magic(vmp->m_fs_e, proc_e, buf, len, CPF_WRITE);
} }
if (grant_id == -1) if (grant_id == -1)
panic("req_rdlink: cpf_grant_magic failed"); panic("req_rdlink: cpf_grant_magic failed");
@ -686,7 +683,7 @@ int direct; /* set to 1 to use direct grants instead of magic grants */
m.REQ_MEM_SIZE = len; m.REQ_MEM_SIZE = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if (r == OK) r = m.RES_NBYTES; if (r == OK) r = m.RES_NBYTES;
@ -699,7 +696,7 @@ int direct; /* set to 1 to use direct grants instead of magic grants */
* req_readsuper * * req_readsuper *
*===========================================================================*/ *===========================================================================*/
int req_readsuper( int req_readsuper(
endpoint_t fs_e, struct vmnt *vmp,
char *label, char *label,
dev_t dev, dev_t dev,
int readonly, int readonly,
@ -714,7 +711,7 @@ int req_readsuper(
message m; message m;
len = strlen(label)+1; len = strlen(label)+1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) label, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) label, len, CPF_READ);
if (grant_id == -1) if (grant_id == -1)
panic("req_readsuper: cpf_grant_direct failed"); panic("req_readsuper: cpf_grant_direct failed");
@ -728,7 +725,7 @@ int req_readsuper(
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if(r == OK) { if(r == OK) {
@ -749,18 +746,17 @@ int req_readsuper(
/*===========================================================================* /*===========================================================================*
* req_readwrite * * req_readwrite *
*===========================================================================*/ *===========================================================================*/
int req_readwrite(fs_e, inode_nr, pos, rw_flag, user_e, int req_readwrite(
user_addr, num_of_bytes, new_posp, cum_iop) struct vmnt *vmp,
endpoint_t fs_e; ino_t inode_nr,
ino_t inode_nr; u64_t pos,
u64_t pos; int rw_flag,
int rw_flag; endpoint_t user_e,
endpoint_t user_e; char *user_addr,
char *user_addr; unsigned int num_of_bytes,
unsigned int num_of_bytes; u64_t *new_posp,
u64_t *new_posp; unsigned int *cum_iop
unsigned int *cum_iop; ) {
{
int r; int r;
cp_grant_id_t grant_id = -1; cp_grant_id_t grant_id = -1;
message m; message m;
@ -785,8 +781,8 @@ unsigned int *cum_iop;
/* fallthrough */ /* fallthrough */
case WRITING: case WRITING:
if(type < 0) { type = REQ_WRITE; grantflag = CPF_READ; } if(type < 0) { type = REQ_WRITE; grantflag = CPF_READ; }
grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, grant_id = cpf_grant_magic(vmp->m_fs_e, user_e,
num_of_bytes, grantflag); (vir_bytes) user_addr, num_of_bytes, grantflag);
if (grant_id == -1) if (grant_id == -1)
panic("req_readwrite: cpf_grant_magic failed"); panic("req_readwrite: cpf_grant_magic failed");
break; break;
@ -806,7 +802,7 @@ unsigned int *cum_iop;
m.REQ_NBYTES = num_of_bytes; m.REQ_NBYTES = num_of_bytes;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
if (r == OK) { if (r == OK) {
@ -822,25 +818,27 @@ unsigned int *cum_iop;
/*===========================================================================* /*===========================================================================*
* req_rename * * req_rename *
*===========================================================================*/ *===========================================================================*/
int req_rename(fs_e, old_dir, old_name, new_dir, new_name) int req_rename(
endpoint_t fs_e; struct vmnt *vmp,
ino_t old_dir; ino_t old_dir,
char *old_name; char *old_name,
ino_t new_dir; ino_t new_dir,
char *new_name; char *new_name
{ ) {
int r; int r;
cp_grant_id_t gid_old, gid_new; cp_grant_id_t gid_old, gid_new;
size_t len_old, len_new; size_t len_old, len_new;
message m; message m;
len_old = strlen(old_name) + 1; len_old = strlen(old_name) + 1;
gid_old = cpf_grant_direct(fs_e, (vir_bytes) old_name, len_old, CPF_READ); gid_old = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) old_name, len_old,
CPF_READ);
if(gid_old == -1) if(gid_old == -1)
panic("req_rename: cpf_grant_direct failed"); panic("req_rename: cpf_grant_direct failed");
len_new = strlen(new_name) + 1; len_new = strlen(new_name) + 1;
gid_new = cpf_grant_direct(fs_e, (vir_bytes) new_name, len_new, CPF_READ); gid_new = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) new_name, len_new,
CPF_READ);
if(gid_new == -1) if(gid_new == -1)
panic("req_rename: cpf_grant_direct failed"); panic("req_rename: cpf_grant_direct failed");
@ -854,7 +852,7 @@ char *new_name;
m.REQ_REN_LEN_NEW = len_new; m.REQ_REN_LEN_NEW = len_new;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(gid_old); cpf_revoke(gid_old);
cpf_revoke(gid_new); cpf_revoke(gid_new);
@ -865,18 +863,18 @@ char *new_name;
/*===========================================================================* /*===========================================================================*
* req_rmdir * * req_rmdir *
*===========================================================================*/ *===========================================================================*/
int req_rmdir(fs_e, inode_nr, lastc) int req_rmdir(
endpoint_t fs_e; struct vmnt *vmp,
ino_t inode_nr; ino_t inode_nr,
char *lastc; char *lastc
{ ) {
int r; int r;
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
size_t len; size_t len;
message m; message m;
len = strlen(lastc) + 1; len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) lastc, len, CPF_READ);
if(grant_id == -1) if(grant_id == -1)
panic("req_rmdir: cpf_grant_direct failed"); panic("req_rmdir: cpf_grant_direct failed");
@ -887,7 +885,7 @@ char *lastc;
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -898,7 +896,7 @@ char *lastc;
* req_slink * * req_slink *
*===========================================================================*/ *===========================================================================*/
int req_slink( int req_slink(
endpoint_t fs_e, struct vmnt *vmp,
ino_t inode_nr, ino_t inode_nr,
char *lastc, char *lastc,
endpoint_t proc_e, endpoint_t proc_e,
@ -914,11 +912,12 @@ int req_slink(
message m; message m;
len = strlen(lastc) + 1; len = strlen(lastc) + 1;
gid_name = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ); gid_name = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) lastc, len, CPF_READ);
if (gid_name == GRANT_INVALID) if (gid_name == GRANT_INVALID)
panic("req_slink: cpf_grant_direct failed"); panic("req_slink: cpf_grant_direct failed");
gid_buf = cpf_grant_magic(fs_e, proc_e, path_addr, path_length, CPF_READ); gid_buf = cpf_grant_magic(vmp->m_fs_e, proc_e, path_addr, path_length,
CPF_READ);
if (gid_buf == GRANT_INVALID) { if (gid_buf == GRANT_INVALID) {
cpf_revoke(gid_name); cpf_revoke(gid_name);
panic("req_slink: cpf_grant_magic failed"); panic("req_slink: cpf_grant_magic failed");
@ -935,7 +934,7 @@ int req_slink(
m.REQ_MEM_SIZE = path_length; m.REQ_MEM_SIZE = path_length;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(gid_name); cpf_revoke(gid_name);
cpf_revoke(gid_buf); cpf_revoke(gid_buf);
@ -946,14 +945,15 @@ int req_slink(
/*===========================================================================* /*===========================================================================*
* req_stat * * req_stat *
*===========================================================================*/ *===========================================================================*/
int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf) int req_stat(struct vmnt *vmp, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf)
{ {
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
int r; int r;
message m; message m;
/* Grant FS access to copy straight into user provided buffer */ /* Grant FS access to copy straight into user provided buffer */
grant_id = cpf_grant_magic(fs_e, proc_e, buf, sizeof(struct stat), CPF_WRITE); grant_id = cpf_grant_magic(vmp->m_fs_e, proc_e, buf, sizeof(struct stat),
CPF_WRITE);
if (grant_id < 0) if (grant_id < 0)
panic("req_stat: cpf_grant_* failed"); panic("req_stat: cpf_grant_* failed");
@ -964,7 +964,7 @@ int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf)
m.REQ_GRANT = grant_id; m.REQ_GRANT = grant_id;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -974,8 +974,7 @@ int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf)
/*===========================================================================* /*===========================================================================*
* req_sync * * req_sync *
*===========================================================================*/ *===========================================================================*/
int req_sync(fs_e) int req_sync(struct vmnt *vmp)
endpoint_t fs_e;
{ {
message m; message m;
@ -983,17 +982,14 @@ endpoint_t fs_e;
m.m_type = REQ_SYNC; m.m_type = REQ_SYNC;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
/*===========================================================================* /*===========================================================================*
* req_unlink * * req_unlink *
*===========================================================================*/ *===========================================================================*/
int req_unlink(fs_e, inode_nr, lastc) int req_unlink(struct vmnt *vmp, ino_t inode_nr, char *lastc)
endpoint_t fs_e;
ino_t inode_nr;
char *lastc;
{ {
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
size_t len; size_t len;
@ -1001,7 +997,7 @@ char *lastc;
message m; message m;
len = strlen(lastc) + 1; len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ); grant_id = cpf_grant_direct(vmp->m_fs_e, (vir_bytes) lastc, len, CPF_READ);
if(grant_id == -1) if(grant_id == -1)
panic("req_unlink: cpf_grant_direct failed"); panic("req_unlink: cpf_grant_direct failed");
@ -1012,7 +1008,7 @@ char *lastc;
m.REQ_PATH_LEN = len; m.REQ_PATH_LEN = len;
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(vmp, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
return(r); return(r);
@ -1022,8 +1018,7 @@ char *lastc;
/*===========================================================================* /*===========================================================================*
* req_unmount * * req_unmount *
*===========================================================================*/ *===========================================================================*/
int req_unmount(fs_e) int req_unmount(struct vmnt *vmp)
endpoint_t fs_e;
{ {
message m; message m;
@ -1031,14 +1026,14 @@ endpoint_t fs_e;
m.m_type = REQ_UNMOUNT; m.m_type = REQ_UNMOUNT;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }
/*===========================================================================* /*===========================================================================*
* req_utime * * req_utime *
*===========================================================================*/ *===========================================================================*/
int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec, int req_utime(struct vmnt *vmp, ino_t inode_nr, struct timespec * actimespec,
struct timespec * modtimespec) struct timespec * modtimespec)
{ {
message m; message m;
@ -1055,5 +1050,5 @@ int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec,
m.REQ_MODNSEC = modtimespec->tv_nsec; m.REQ_MODNSEC = modtimespec->tv_nsec;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); return fs_sendrec(vmp, &m);
} }

View File

@ -177,7 +177,7 @@ int do_stat(message *UNUSED(m_out))
if (fetch_name(vname1, vname1_length, fullpath) != OK) return(err_code); if (fetch_name(vname1, vname1_length, fullpath) != OK) return(err_code);
if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code); if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code);
r = req_stat(vp->v_fs_e, vp->v_inode_nr, who_e, statbuf); r = req_stat(vp->v_vmnt, vp->v_inode_nr, who_e, statbuf);
unlock_vnode(vp); unlock_vnode(vp);
unlock_vmnt(vmp); unlock_vmnt(vmp);
@ -202,7 +202,7 @@ int do_fstat(message *UNUSED(m_out))
/* Is the file descriptor valid? */ /* Is the file descriptor valid? */
if ((rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code); if ((rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code);
r = req_stat(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr, r = req_stat(rfilp->filp_vno->v_vmnt, rfilp->filp_vno->v_inode_nr,
who_e, statbuf); who_e, statbuf);
unlock_filp(rfilp); unlock_filp(rfilp);
@ -226,7 +226,7 @@ int do_fstatfs(message *UNUSED(m_out))
/* Is the file descriptor valid? */ /* Is the file descriptor valid? */
if( (rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code); if( (rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code);
r = req_fstatfs(rfilp->filp_vno->v_fs_e, who_e, statbuf); r = req_fstatfs(rfilp->filp_vno->v_vmnt, who_e, statbuf);
unlock_filp(rfilp); unlock_filp(rfilp);
@ -257,7 +257,7 @@ int do_statvfs(message *UNUSED(m_out))
if (fetch_name(vname1, vname1_length, fullpath) != OK) return(err_code); if (fetch_name(vname1, vname1_length, fullpath) != OK) return(err_code);
if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code); if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code);
r = req_statvfs(vp->v_fs_e, who_e, statbuf); r = req_statvfs(vp->v_vmnt, who_e, statbuf);
unlock_vnode(vp); unlock_vnode(vp);
unlock_vmnt(vmp); unlock_vmnt(vmp);
@ -281,7 +281,7 @@ int do_fstatvfs(message *UNUSED(m_out))
/* Is the file descriptor valid? */ /* Is the file descriptor valid? */
if ((rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code); if ((rfilp = get_filp(rfd, VNODE_READ)) == NULL) return(err_code);
r = req_statvfs(rfilp->filp_vno->v_fs_e, who_e, statbuf); r = req_statvfs(rfilp->filp_vno->v_vmnt, who_e, statbuf);
unlock_filp(rfilp); unlock_filp(rfilp);
@ -312,7 +312,7 @@ int do_lstat(message *UNUSED(m_out))
if (fetch_name(vname1, vname1_length, fullpath) != OK) return(err_code); if (fetch_name(vname1, vname1_length, fullpath) != OK) return(err_code);
if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code); if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code);
r = req_stat(vp->v_fs_e, vp->v_inode_nr, who_e, statbuf); r = req_stat(vp->v_vmnt, vp->v_inode_nr, who_e, statbuf);
unlock_vnode(vp); unlock_vnode(vp);
unlock_vmnt(vmp); unlock_vmnt(vmp);

View File

@ -70,7 +70,7 @@ int do_utime(message *UNUSED(m_out))
newactim = actim; newactim = actim;
newmodtim = modtim; newmodtim = modtim;
} }
r = req_utime(vp->v_fs_e, vp->v_inode_nr, &newactim, &newmodtim); r = req_utime(vp->v_vmnt, vp->v_inode_nr, &newactim, &newmodtim);
} }
unlock_vnode(vp); unlock_vnode(vp);
@ -201,7 +201,7 @@ int do_utimens(message *UNUSED(m_out))
if (r == OK) if (r == OK)
/* Issue request */ /* Issue request */
r = req_utime(vp->v_fs_e, vp->v_inode_nr, &newactim, &newmodtim); r = req_utime(vp->v_vmnt, vp->v_inode_nr, &newactim, &newmodtim);
if (kind == UTIMENS_STYLE) { if (kind == UTIMENS_STYLE) {
/* Close the temporary */ /* Close the temporary */

View File

@ -279,7 +279,7 @@ void put_vnode(struct vnode *vp)
panic("put_vnode failed: bad v_fs_count %d\n", vp->v_fs_count); panic("put_vnode failed: bad v_fs_count %d\n", vp->v_fs_count);
/* Tell FS we don't need this inode to be open anymore. */ /* Tell FS we don't need this inode to be open anymore. */
r = req_putnode(vp->v_fs_e, vp->v_inode_nr, vp->v_fs_count); r = req_putnode(vp->v_vmnt, vp->v_inode_nr, vp->v_fs_count);
if (r != OK) { if (r != OK) {
printf("VFS: putnode failed: %d\n", r); printf("VFS: putnode failed: %d\n", r);
@ -289,7 +289,8 @@ void put_vnode(struct vnode *vp)
/* This inode could've been mapped. If so, tell mapped FS to close it as /* This inode could've been mapped. If so, tell mapped FS to close it as
* well. If mapped onto same FS, this putnode is not needed. */ * well. If mapped onto same FS, this putnode is not needed. */
if (vp->v_mapfs_e != NONE && vp->v_mapfs_e != vp->v_fs_e) if (vp->v_mapfs_e != NONE && vp->v_mapfs_e != vp->v_fs_e)
req_putnode(vp->v_mapfs_e, vp->v_mapinode_nr, vp->v_mapfs_count); req_putnode(find_vmnt(vp->v_mapfs_e), vp->v_mapinode_nr,
vp->v_mapfs_count);
vp->v_fs_count = 0; vp->v_fs_count = 0;
vp->v_ref_count = 0; vp->v_ref_count = 0;
@ -310,7 +311,7 @@ void vnode_clean_refs(struct vnode *vp)
if (vp->v_fs_count <= 1) return; /* Nothing to do */ if (vp->v_fs_count <= 1) return; /* Nothing to do */
/* Drop all references except one */ /* Drop all references except one */
req_putnode(vp->v_fs_e, vp->v_inode_nr, vp->v_fs_count - 1); req_putnode(vp->v_vmnt, vp->v_inode_nr, vp->v_fs_count - 1);
vp->v_fs_count = 1; vp->v_fs_count = 1;
} }