1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
14 * Copyright 2019-2024 RackTop Systems, Inc.
15 */
16
17 #include <sys/types.h>
18 #include <sys/param.h>
19 #include <sys/systm.h>
20 #include <sys/cmn_err.h>
21 #include <sys/cred.h>
22 #include <sys/debug.h>
23 #include <sys/errno.h>
24 #include <sys/file.h>
25 #include <sys/kmem.h>
26 #include <sys/t_lock.h>
27 #include <sys/user.h>
28 #include <sys/uio.h>
29 #include <sys/pathname.h>
30 #include <sys/sysmacros.h>
31 #include <sys/vfs.h>
32 #include <sys/vnode.h>
33
34 #include <sys/acl.h>
35 #include <sys/nbmlock.h>
36 #include <sys/fcntl.h>
37
38 /*
39 * Are vp1 and vp2 the same vnode?
40 */
41 int
vn_compare(vnode_t * vp1,vnode_t * vp2)42 vn_compare(vnode_t *vp1, vnode_t *vp2)
43 {
44 vnode_t *realvp;
45
46 if (vp1 != NULL && VOP_REALVP(vp1, &realvp, NULL) == 0)
47 vp1 = realvp;
48 if (vp2 != NULL && VOP_REALVP(vp2, &realvp, NULL) == 0)
49 vp2 = realvp;
50 return (VN_CMP(vp1, vp2));
51 }
52
53 vnodeops_t *
vn_getops(vnode_t * vp)54 vn_getops(vnode_t *vp)
55 {
56 return (vp->v_op);
57 }
58
59 int
vn_ismntpt(vnode_t * vp __unused)60 vn_ismntpt(vnode_t *vp __unused)
61 {
62 return (0);
63 }
64
65 vfs_t *
vn_mountedvfs(vnode_t * vp __unused)66 vn_mountedvfs(vnode_t *vp __unused)
67 {
68 return (NULL);
69 }
70
71 void
xva_init(xvattr_t * xvap)72 xva_init(xvattr_t *xvap)
73 {
74 bzero(xvap, sizeof (xvattr_t));
75 xvap->xva_mapsize = XVA_MAPSIZE;
76 xvap->xva_magic = XVA_MAGIC;
77 xvap->xva_vattr.va_mask = AT_XVATTR;
78 xvap->xva_rtnattrmapp = &(xvap->xva_rtnattrmap)[0];
79 }
80
81 /*
82 * If AT_XVATTR is set, returns a pointer to the embedded xoptattr_t
83 * structure. Otherwise, returns NULL.
84 */
85 xoptattr_t *
xva_getxoptattr(xvattr_t * xvap)86 xva_getxoptattr(xvattr_t *xvap)
87 {
88 xoptattr_t *xoap = NULL;
89 if (xvap->xva_vattr.va_mask & AT_XVATTR)
90 xoap = &xvap->xva_xoptattrs;
91 return (xoap);
92 }
93