vfs_vnops.c (d71e1a883c92b8b166eea59734850acd54048d72) vfs_vnops.c (b4a58fbf640409a1e507d9f7b411c83a3f83a2f3)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

--- 176 unchanged lines hidden (view full) ---

185};
186
187static int vn_io_fault1(struct vnode *vp, struct uio *uio,
188 struct vn_io_fault_args *args, struct thread *td);
189
190int
191vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp)
192{
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

--- 176 unchanged lines hidden (view full) ---

185};
186
187static int vn_io_fault1(struct vnode *vp, struct uio *uio,
188 struct vn_io_fault_args *args, struct thread *td);
189
190int
191vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp)
192{
193 struct thread *td = ndp->ni_cnd.cn_thread;
193 struct thread *td = curthread;
194
195 return (vn_open_cred(ndp, flagp, cmode, 0, td->td_ucred, fp));
196}
197
198static uint64_t
199open2nameif(int fmode, u_int vn_open_flags)
200{
201 uint64_t res;

--- 23 unchanged lines hidden (view full) ---

225 * due to the NDINIT being done elsewhere.
226 */
227int
228vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
229 struct ucred *cred, struct file *fp)
230{
231 struct vnode *vp;
232 struct mount *mp;
194
195 return (vn_open_cred(ndp, flagp, cmode, 0, td->td_ucred, fp));
196}
197
198static uint64_t
199open2nameif(int fmode, u_int vn_open_flags)
200{
201 uint64_t res;

--- 23 unchanged lines hidden (view full) ---

225 * due to the NDINIT being done elsewhere.
226 */
227int
228vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
229 struct ucred *cred, struct file *fp)
230{
231 struct vnode *vp;
232 struct mount *mp;
233 struct thread *td = ndp->ni_cnd.cn_thread;
234 struct vattr vat;
235 struct vattr *vap = &vat;
236 int fmode, error;
237 bool first_open;
238
239restart:
240 first_open = false;
241 fmode = *flagp;

--- 85 unchanged lines hidden (view full) ---

327 ndp->ni_cnd.cn_flags |= (fmode & O_NOFOLLOW) != 0 ? NOFOLLOW :
328 FOLLOW;
329 if ((fmode & FWRITE) == 0)
330 ndp->ni_cnd.cn_flags |= LOCKSHARED;
331 if ((error = namei(ndp)) != 0)
332 return (error);
333 vp = ndp->ni_vp;
334 }
233 struct vattr vat;
234 struct vattr *vap = &vat;
235 int fmode, error;
236 bool first_open;
237
238restart:
239 first_open = false;
240 fmode = *flagp;

--- 85 unchanged lines hidden (view full) ---

326 ndp->ni_cnd.cn_flags |= (fmode & O_NOFOLLOW) != 0 ? NOFOLLOW :
327 FOLLOW;
328 if ((fmode & FWRITE) == 0)
329 ndp->ni_cnd.cn_flags |= LOCKSHARED;
330 if ((error = namei(ndp)) != 0)
331 return (error);
332 vp = ndp->ni_vp;
333 }
335 error = vn_open_vnode(vp, fmode, cred, td, fp);
334 error = vn_open_vnode(vp, fmode, cred, curthread, fp);
336 if (first_open) {
337 VI_LOCK(vp);
338 vp->v_iflag &= ~VI_FOPENING;
339 wakeup(vp);
340 VI_UNLOCK(vp);
341 }
342 if (error)
343 goto bad;

--- 3366 unchanged lines hidden ---
335 if (first_open) {
336 VI_LOCK(vp);
337 vp->v_iflag &= ~VI_FOPENING;
338 wakeup(vp);
339 VI_UNLOCK(vp);
340 }
341 if (error)
342 goto bad;

--- 3366 unchanged lines hidden ---