8815 mega_sas: variable set but not used
[unleashed.git] / usr / src / uts / common / klm / klmops.c
blob2036ead94d2f9d90020ab72f42c480ec281550a3
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.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy is of the CDDL is also available via the Internet
9 * at http://www.illumos.org/license/CDDL.
13 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
17 * NFS Lock Manager, client-side
18 * Note: depends on (links with) klmmod
20 * This file contains all the external entry points of klmops.
21 * Basically, this is the "glue" to the BSD nlm code.
24 #include <sys/types.h>
25 #include <sys/errno.h>
26 #include <sys/modctl.h>
27 #include <sys/flock.h>
29 #include <nfs/lm.h>
30 #include <rpcsvc/nlm_prot.h>
31 #include "nlm_impl.h"
34 static struct modlmisc modlmisc = {
35 &mod_miscops, "lock mgr calls"
38 static struct modlinkage modlinkage = {
39 MODREV_1, &modlmisc, NULL
45 * ****************************************************************
46 * module init, fini, info
48 int
49 _init()
51 return (mod_install(&modlinkage));
54 int
55 _fini()
57 /* Don't unload. */
58 return (EBUSY);
61 int
62 _info(struct modinfo *modinfop)
64 return (mod_info(&modlinkage, modinfop));
70 * ****************************************************************
71 * Stubs listed in modstubs.s
72 * These are called from fs/nfs
76 * NFSv2 lock/unlock. Called by nfs_frlock()
77 * Uses NLM version 1 (NLM_VERS)
79 int
80 lm_frlock(struct vnode *vp, int cmd, struct flock64 *flk, int flags,
81 u_offset_t off, struct cred *cr, struct netobj *fh,
82 struct flk_callback *flcb)
84 return (nlm_frlock(vp, cmd, flk, flags, off,
85 cr, fh, flcb, NLM_VERS));
89 * NFSv3 lock/unlock. Called by nfs3_frlock()
90 * Uses NLM version 4 (NLM4_VERS)
92 int
93 lm4_frlock(struct vnode *vp, int cmd, struct flock64 *flk, int flags,
94 u_offset_t off, struct cred *cr, struct netobj *fh,
95 struct flk_callback *flcb)
97 int err;
98 err = nlm_frlock(vp, cmd, flk, flags, off,
99 cr, fh, flcb, NLM4_VERS);
100 return (err);
104 * NFSv2 shrlk/unshrlk. See nfs_shrlock
105 * Uses NLM version 3 (NLM_VERSX)
108 lm_shrlock(struct vnode *vp, int cmd,
109 struct shrlock *shr, int flags, struct netobj *fh)
111 return (nlm_shrlock(vp, cmd, shr, flags, fh, NLM_VERSX));
115 * NFSv3 shrlk/unshrlk. See nfs3_shrlock
116 * Uses NLM version 4 (NLM4_VERS)
119 lm4_shrlock(struct vnode *vp, int cmd,
120 struct shrlock *shr, int flags, struct netobj *fh)
122 return (nlm_shrlock(vp, cmd, shr, flags, fh, NLM4_VERS));
126 * Helper for nfs_lockrelease.
128 void
129 lm_register_lock_locally(struct vnode *vp, struct lm_sysid *ls,
130 struct flock64 *flk, int flags, u_offset_t offset)
132 nlm_register_lock_locally(vp, (struct nlm_host *)ls,
133 flk, flags, offset);
137 * Old RPC service dispatch functions, no longer used.
138 * Here only to satisfy modstubs.s references.
140 void
141 lm_nlm_dispatch(struct svc_req *req, SVCXPRT *xprt)
143 _NOTE(ARGUNUSED(req, xprt))
146 void
147 lm_nlm4_dispatch(struct svc_req *req, SVCXPRT *xprt)
149 _NOTE(ARGUNUSED(req, xprt))
153 * Old internal functions used for reclaiming locks
154 * our NFS client holds after some server restarts.
155 * The new NLM code does this differently, so these
156 * are here only to satisfy modstubs.s references.
158 void
159 lm_nlm_reclaim(struct vnode *vp, struct flock64 *flkp)
161 _NOTE(ARGUNUSED(vp, flkp))
164 void
165 lm_nlm4_reclaim(struct vnode *vp, struct flock64 *flkp)
167 _NOTE(ARGUNUSED(vp, flkp))