Lines Matching defs:ndp
190 vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp)
194 return (vn_open_cred(ndp, flagp, cmode, 0, td->td_ucred, fp));
229 vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
247 ndp->ni_cnd.cn_nameiop = CREATE;
248 ndp->ni_cnd.cn_flags = open2nameif(fmode, vn_open_flags);
256 ndp->ni_cnd.cn_flags |= LOCKPARENT | NOCACHE | NC_KEEPPOSENTRY;
258 ndp->ni_cnd.cn_flags |= FOLLOW;
261 if ((error = namei(ndp)) != 0)
263 if (ndp->ni_vp == NULL) {
269 if (vn_start_write(ndp->ni_dvp, &mp, V_NOWAIT) != 0) {
270 NDFREE_PNBUF(ndp);
271 vput(ndp->ni_dvp);
275 NDREINIT(ndp);
279 ndp->ni_cnd.cn_flags |= MAKEENTRY;
281 error = mac_vnode_check_create(cred, ndp->ni_dvp,
282 &ndp->ni_cnd, vap);
285 error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
286 &ndp->ni_cnd, vap);
287 vp = ndp->ni_vp;
295 VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &vp : NULL,
299 NDFREE_PNBUF(ndp);
301 NDREINIT(ndp);
308 if (ndp->ni_dvp == ndp->ni_vp)
309 vrele(ndp->ni_dvp);
311 vput(ndp->ni_dvp);
312 ndp->ni_dvp = NULL;
313 vp = ndp->ni_vp;
325 ndp->ni_cnd.cn_nameiop = LOOKUP;
326 ndp->ni_cnd.cn_flags = open2nameif(fmode, vn_open_flags);
327 ndp->ni_cnd.cn_flags |= (fmode & O_NOFOLLOW) != 0 ? NOFOLLOW :
330 ndp->ni_cnd.cn_flags |= LOCKSHARED;
331 if ((error = namei(ndp)) != 0)
333 vp = ndp->ni_vp;
347 NDFREE_PNBUF(ndp);
350 ndp->ni_vp = NULL;