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