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 */
15
16 #include <sys/types.h>
17 #include <sys/param.h>
18 #include <sys/systm.h>
19 #include <sys/cmn_err.h>
20 #include <sys/cred.h>
21 #include <sys/debug.h>
22 #include <sys/errno.h>
23 #include <sys/file.h>
24 #include <sys/kmem.h>
25 #include <sys/t_lock.h>
26 #include <sys/user.h>
27 #include <sys/uio.h>
28 #include <sys/pathname.h>
29 #include <sys/sysmacros.h>
30 #include <sys/vfs.h>
31 #include <sys/vnode.h>
32
33 #include <sys/acl.h>
34 #include <sys/nbmlock.h>
35 #include <sys/fcntl.h>
36
37 /*
38 * Are vp1 and vp2 the same vnode?
39 */
40 int
vn_compare(vnode_t * vp1,vnode_t * vp2)41 vn_compare(vnode_t *vp1, vnode_t *vp2)
42 {
43 vnode_t *realvp;
44
45 if (vp1 != NULL && VOP_REALVP(vp1, &realvp, NULL) == 0)
46 vp1 = realvp;
47 if (vp2 != NULL && VOP_REALVP(vp2, &realvp, NULL) == 0)
48 vp2 = realvp;
49 return (VN_CMP(vp1, vp2));
50 }
51
52 /* ARGSUSED */
53 vfs_t *
vn_mountedvfs(vnode_t * vp)54 vn_mountedvfs(vnode_t *vp)
55 {
56 return (NULL);
57 }
58
59 void
xva_init(xvattr_t * xvap)60 xva_init(xvattr_t *xvap)
61 {
62 bzero(xvap, sizeof (xvattr_t));
63 xvap->xva_mapsize = XVA_MAPSIZE;
64 xvap->xva_magic = XVA_MAGIC;
65 xvap->xva_vattr.va_mask = AT_XVATTR;
66 xvap->xva_rtnattrmapp = &(xvap->xva_rtnattrmap)[0];
67 }
68
69 /*
70 * If AT_XVATTR is set, returns a pointer to the embedded xoptattr_t
71 * structure. Otherwise, returns NULL.
72 */
73 xoptattr_t *
xva_getxoptattr(xvattr_t * xvap)74 xva_getxoptattr(xvattr_t *xvap)
75 {
76 xoptattr_t *xoap = NULL;
77 if (xvap->xva_vattr.va_mask & AT_XVATTR)
78 xoap = &xvap->xva_xoptattrs;
79 return (xoap);
80 }
81