summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_lookup.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-04-05 08:58:49 +0000
committerjeff <jeff@FreeBSD.org>2005-04-05 08:58:49 +0000
commitd42252c15869835b05a5453280cdff3c5b98bb60 (patch)
treee55948af8921b2494b0ce8d1420e0a789ffe9d8b /sys/kern/vfs_lookup.c
parent01f6ce3a709610f8c57c9378b536a4f2a77f10ed (diff)
downloadFreeBSD-src-d42252c15869835b05a5453280cdff3c5b98bb60.zip
FreeBSD-src-d42252c15869835b05a5453280cdff3c5b98bb60.tar.gz
- Move NDFREE() from vfs_subr to vfs_lookup where namei() is.
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r--sys/kern/vfs_lookup.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 709282f..f17bb5e 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -880,6 +880,44 @@ bad:
}
/*
+ * Free data allocated by namei(); see namei(9) for details.
+ */
+void
+NDFREE(ndp, flags)
+ struct nameidata *ndp;
+ const u_int flags;
+{
+
+ if (!(flags & NDF_NO_FREE_PNBUF) &&
+ (ndp->ni_cnd.cn_flags & HASBUF)) {
+ uma_zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
+ ndp->ni_cnd.cn_flags &= ~HASBUF;
+ }
+ if (!(flags & NDF_NO_DVP_UNLOCK) &&
+ (ndp->ni_cnd.cn_flags & LOCKPARENT) &&
+ ndp->ni_dvp != ndp->ni_vp)
+ VOP_UNLOCK(ndp->ni_dvp, 0, ndp->ni_cnd.cn_thread);
+ if (!(flags & NDF_NO_DVP_RELE) &&
+ (ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) {
+ vrele(ndp->ni_dvp);
+ ndp->ni_dvp = NULL;
+ }
+ if (!(flags & NDF_NO_VP_UNLOCK) &&
+ (ndp->ni_cnd.cn_flags & LOCKLEAF) && ndp->ni_vp)
+ VOP_UNLOCK(ndp->ni_vp, 0, ndp->ni_cnd.cn_thread);
+ if (!(flags & NDF_NO_VP_RELE) &&
+ ndp->ni_vp) {
+ vrele(ndp->ni_vp);
+ ndp->ni_vp = NULL;
+ }
+ if (!(flags & NDF_NO_STARTDIR_RELE) &&
+ (ndp->ni_cnd.cn_flags & SAVESTART)) {
+ vrele(ndp->ni_startdir);
+ ndp->ni_startdir = NULL;
+ }
+}
+
+/*
* Determine if there is a suitable alternate filename under the specified
* prefix for the specified path. If the create flag is set, then the
* alternate prefix will be used so long as the parent directory exists.
OpenPOWER on IntegriCloud