xref: /illumos-gate/usr/src/lib/smbsrv/libfksmbsrv/common/fake_vnode.c (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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 RackTop Systems.
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
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 int
54 vn_ismntpt(vnode_t *vp __unused)
55 {
56 	return (0);
57 }
58 
59 vfs_t *
60 vn_mountedvfs(vnode_t *vp __unused)
61 {
62 	return (NULL);
63 }
64 
65 void
66 xva_init(xvattr_t *xvap)
67 {
68 	bzero(xvap, sizeof (xvattr_t));
69 	xvap->xva_mapsize = XVA_MAPSIZE;
70 	xvap->xva_magic = XVA_MAGIC;
71 	xvap->xva_vattr.va_mask = AT_XVATTR;
72 	xvap->xva_rtnattrmapp = &(xvap->xva_rtnattrmap)[0];
73 }
74 
75 /*
76  * If AT_XVATTR is set, returns a pointer to the embedded xoptattr_t
77  * structure.  Otherwise, returns NULL.
78  */
79 xoptattr_t *
80 xva_getxoptattr(xvattr_t *xvap)
81 {
82 	xoptattr_t *xoap = NULL;
83 	if (xvap->xva_vattr.va_mask & AT_XVATTR)
84 		xoap = &xvap->xva_xoptattrs;
85 	return (xoap);
86 }
87