Make the rootdir handling more consistent. Now, processes always

have a root vnode associated with them, and no special checks for
the null case are needed.
Submitted by:	terry@freebsd.org
This commit is contained in:
dyson 1998-02-15 04:17:09 +00:00
parent 09f4c25713
commit fbe6fe8df6
5 changed files with 13 additions and 18 deletions

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.82 1998/02/04 22:32:30 eivind Exp $
* $Id: init_main.c,v 1.83 1998/02/06 12:13:21 eivind Exp $
*/
#include "opt_devfs.h"
@ -498,7 +498,7 @@ xxx_vfs_root_fdtab(dummy)
fdp->fd_fd.fd_cdir = rootvnode;
VREF(fdp->fd_fd.fd_cdir);
VOP_UNLOCK(rootvnode, 0, &proc0);
fdp->fd_fd.fd_rdir = NULL;
fdp->fd_fd.fd_rdir = rootvnode;
}
SYSINIT(retrofit, SI_SUB_ROOT_FDTAB, SI_ORDER_FIRST, xxx_vfs_root_fdtab, NULL)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $Id: kern_descrip.c,v 1.49 1998/02/04 22:32:31 eivind Exp $
* $Id: kern_descrip.c,v 1.50 1998/02/06 12:13:22 eivind Exp $
*/
#include "opt_compat.h"
@ -709,8 +709,7 @@ fdinit(p)
newfdp->fd_fd.fd_cdir = fdp->fd_cdir;
VREF(newfdp->fd_fd.fd_cdir);
newfdp->fd_fd.fd_rdir = fdp->fd_rdir;
if (newfdp->fd_fd.fd_rdir)
VREF(newfdp->fd_fd.fd_rdir);
VREF(newfdp->fd_fd.fd_rdir);
/* Create the file descriptor table. */
newfdp->fd_fd.fd_refcnt = 1;
@ -757,8 +756,7 @@ fdcopy(p)
M_FILEDESC, M_WAITOK);
bcopy(fdp, newfdp, sizeof(struct filedesc));
VREF(newfdp->fd_cdir);
if (newfdp->fd_rdir)
VREF(newfdp->fd_rdir);
VREF(newfdp->fd_rdir);
newfdp->fd_refcnt = 1;
/*
@ -821,8 +819,7 @@ fdfree(p)
if (fdp->fd_nfiles > NDFILE)
FREE(fdp->fd_ofiles, M_FILEDESC);
vrele(fdp->fd_cdir);
if (fdp->fd_rdir)
vrele(fdp->fd_rdir);
vrele(fdp->fd_rdir);
FREE(fdp, M_FILEDESC);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.91 1998/02/06 12:13:32 eivind Exp $
* $Id: vfs_syscalls.c,v 1.92 1998/02/08 01:41:33 dyson Exp $
*/
/* For 4.3 integer FS ID compatibility */
@ -804,8 +804,7 @@ chroot(p, uap)
SCARG(uap, path), p);
if (error = change_dir(&nd, p))
return (error);
if (fdp->fd_rdir != NULL)
vrele(fdp->fd_rdir);
vrele(fdp->fd_rdir);
fdp->fd_rdir = nd.ni_vp;
return (0);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94
* $Id: vfs_lookup.c,v 1.24 1998/02/04 22:32:40 eivind Exp $
* $Id: vfs_lookup.c,v 1.25 1998/02/06 12:13:30 eivind Exp $
*/
#include "opt_ktrace.h"
@ -132,8 +132,8 @@ namei(ndp)
/*
* Get starting point for the translation.
*/
if ((ndp->ni_rootdir = fdp->fd_rdir) == NULL)
ndp->ni_rootdir = rootvnode;
ndp->ni_rootdir = fdp->fd_rdir;
dp = fdp->fd_cdir;
VREF(dp);
for (;;) {

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.91 1998/02/06 12:13:32 eivind Exp $
* $Id: vfs_syscalls.c,v 1.92 1998/02/08 01:41:33 dyson Exp $
*/
/* For 4.3 integer FS ID compatibility */
@ -804,8 +804,7 @@ chroot(p, uap)
SCARG(uap, path), p);
if (error = change_dir(&nd, p))
return (error);
if (fdp->fd_rdir != NULL)
vrele(fdp->fd_rdir);
vrele(fdp->fd_rdir);
fdp->fd_rdir = nd.ni_vp;
return (0);
}