Print this page
195 Need replacement for nfs/lockd+klm
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Jeremy Jones <jeremy@delphix.com>
Reviewed by: Jeff Biseda <jbiseda@delphix.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/nfs/lm.h
+++ new/usr/src/uts/common/nfs/lm.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 +/*
28 + * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
29 + */
30 +
27 31 #ifndef _NFS_LM_H
28 32 #define _NFS_LM_H
29 33
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 34 /*
33 35 * Interface definitions for the NFSv2/v3 lock manager.
34 36 */
35 37
36 38 #ifdef __cplusplus
37 39 extern "C" {
38 40 #endif
39 41
40 42 #include <sys/cred.h>
41 43 #include <sys/fcntl.h>
42 44 #include <sys/types.h>
43 45 #include <sys/vnode.h>
44 46 #include <rpc/rpc.h>
45 -#include <nfs/export.h>
46 47
47 48 #ifdef _KERNEL
48 49
49 50 /*
50 51 * Common interfaces.
51 52 */
52 53
54 +struct exportinfo;
55 +
53 56 /*
54 57 * The numeric sysid is used to identify a host and transport.
55 58 *
56 59 * The local locking code uses (pid, sysid) to uniquely identify a process.
57 60 * This means that the client-side code must doctor up the sysid before
58 61 * registering a lock, so that the local locking code doesn't confuse a
59 62 * remote process with a local process just because they have the same pid.
60 63 * We currently do this by ORing LM_SYSID_CLIENT into the sysid before
61 64 * registering a lock.
62 65 *
63 66 * If you change LM_SYSID and LM_SYSID_MAX, be sure to pick values so that
64 67 * LM_SYSID_MAX > LM_SYSID using signed arithmetic, and don't use zero.
65 68 * You may also need a different way to tag lock manager locks that are
66 69 * registered locally.
67 70 */
68 71 #define LM_SYSID ((sysid_t)0x0001)
69 72 #define LM_SYSID_MAX ((sysid_t)0x3FFF)
70 73 #define LM_SYSID_CLIENT ((sysid_t)0x4000)
71 74 #define LM_NOSYSID ((sysid_t)-1)
72 75
73 76 /*
74 77 * Struct used to represent a host.
75 78 */
76 79 struct lm_sysid;
77 80
78 81 /*
79 82 * Given a knetconfig and network address, returns a reference to the
80 83 * associated lm_sysid. The 3rd argument is the hostname to assign to the
81 84 * lm_sysid. The 4th argument is an output parameter. It is set non-zero
82 85 * if the returned lm_sysid has a different protocol
83 86 * (knetconfig::knc_proto) than what was requested.
84 87 */
85 88 extern struct lm_sysid *lm_get_sysid(struct knetconfig *, struct netbuf *,
86 89 char *, bool_t *);
87 90 extern void lm_rel_sysid(struct lm_sysid *);
88 91
89 92 /*
90 93 * Return the integer sysid for the given lm_sysid.
91 94 */
92 95 extern sysid_t lm_sysidt(struct lm_sysid *);
93 96
94 97 extern void lm_free_config(struct knetconfig *);
95 98
96 99 extern void lm_cprsuspend(void);
97 100 extern void lm_cprresume(void);
98 101
99 102 /*
100 103 * Client-side interfaces.
101 104 */
102 105
103 106 extern int lm_frlock(struct vnode *vp, int cmd,
104 107 struct flock64 *flk, int flag,
105 108 u_offset_t offset, struct cred *cr,
106 109 netobj *fh, struct flk_callback *);
107 110 extern int lm_has_sleep(const struct vnode *);
108 111 extern void lm_register_lock_locally(vnode_t *,
109 112 struct lm_sysid *, struct flock64 *, int,
110 113 u_offset_t);
111 114 extern int lm_safelock(vnode_t *, const struct flock64 *,
112 115 cred_t *);
113 116 extern int lm_safemap(const vnode_t *);
114 117 extern int lm_shrlock(struct vnode *vp, int cmd,
115 118 struct shrlock *shr, int flag, netobj *fh);
116 119 extern int lm4_frlock(struct vnode *vp, int cmd,
117 120 struct flock64 *flk, int flag,
118 121 u_offset_t offset, struct cred *cr,
119 122 netobj *fh, struct flk_callback *);
120 123 extern int lm4_shrlock(struct vnode *vp, int cmd,
121 124 struct shrlock *shr, int flag, netobj *fh);
122 125
123 126 /*
124 127 * Server-side interfaces.
125 128 */
126 129
127 130 extern void lm_unexport(struct exportinfo *);
128 131
129 132 /*
130 133 * Clustering: functions to encode the nlmid of the node where this NLM
131 134 * server is running in the l_sysid of the flock struct or the s_sysid
132 135 * field of the shrlock struct (respectively).
133 136 */
134 137 extern void lm_set_nlmid_flk(int *);
135 138 extern void lm_set_nlmid_shr(int32_t *);
136 139 /* Hook for deleting all mandatory NFSv4 file locks held by a remote client */
137 140 extern void (*lm_remove_file_locks)(int);
138 141
139 142 /*
140 143 * The following global variable is the node id of the node where this
141 144 * NLM server is running.
142 145 */
143 146 extern int lm_global_nlmid;
144 147
145 148 /*
146 149 * End of clustering hooks.
↓ open down ↓ |
84 lines elided |
↑ open up ↑ |
147 150 */
148 151
149 152 /*
150 153 * Return non-zero if the given local vnode is in use.
151 154 */
152 155 extern int lm_vp_active(const struct vnode *);
153 156
154 157 extern sysid_t lm_alloc_sysidt(void);
155 158 extern void lm_free_sysidt(sysid_t);
156 159
157 -#else /* _KERNEL */
160 +#endif /* _KERNEL */
158 161
159 162 #ifdef __STDC__
160 163 extern int lm_shutdown(void);
161 164 #else
162 165 extern int lm_shutdown();
163 166 #endif /* __STDC__ */
164 167
165 -#endif /* _KERNEL */
166 -
167 168 #ifdef __cplusplus
168 169 }
169 170 #endif
170 171
171 172 #endif /* _NFS_LM_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX