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 is of the CDDL is also available via the Internet
9 * at http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
14 * Copyright (c) 2012 by Delphix. All rights reserved.
15 */
16
17 /*
18 * NFS Lock Manager, server-side and common.
19 *
20 * This file contains all the external entry points of klmmod.
21 * Basically, this is the "glue" to the BSD nlm code.
22 */
23
24 #include <sys/types.h>
25 #include <sys/errno.h>
26 #include <sys/modctl.h>
27 #include <sys/flock.h>
28
29 #include <nfs/nfs.h>
30 #include <nfs/nfssys.h>
31 #include <nfs/lm.h>
32 #include <rpcsvc/nlm_prot.h>
33 #include "nlm_impl.h"
119
120
121
122 /*
123 * ****************************************************************
124 * module init, fini, info
125 */
126 int
127 _init()
128 {
129 int retval;
130
131 rw_init(&lm_lck, NULL, RW_DEFAULT, NULL);
132 nlm_init();
133
134 zone_key_create(&nlm_zone_key, lm_zone_init, NULL, lm_zone_fini);
135 /* Per-zone lockmgr data. See: os/flock.c */
136 zone_key_create(&flock_zone_key, flk_zone_init, NULL, flk_zone_fini);
137
138 retval = mod_install(&modlinkage);
139 if (retval == 0)
140 return (0);
141
142 /*
143 * mod_install failed! undo above, reverse order
144 */
145
146 (void) zone_key_delete(flock_zone_key);
147 flock_zone_key = ZONE_KEY_UNINITIALIZED;
148 (void) zone_key_delete(nlm_zone_key);
149 rw_destroy(&lm_lck);
150
151 return (retval);
152 }
153
154 int
155 _fini()
156 {
157 /* Don't unload. */
158 return (EBUSY);
159 }
160
|
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 is of the CDDL is also available via the Internet
9 * at http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
14 * Copyright (c) 2012 by Delphix. All rights reserved.
15 */
16
17 /*
18 * NFS Lock Manager, server-side and common.
19 *
20 * This file contains all the external entry points of klmmod.
21 * Basically, this is the "glue" to the BSD nlm code.
22 */
23
24 #include <sys/types.h>
25 #include <sys/errno.h>
26 #include <sys/modctl.h>
27 #include <sys/flock.h>
28
29 #include <nfs/nfs.h>
30 #include <nfs/nfssys.h>
31 #include <nfs/lm.h>
32 #include <rpcsvc/nlm_prot.h>
33 #include "nlm_impl.h"
119
120
121
122 /*
123 * ****************************************************************
124 * module init, fini, info
125 */
126 int
127 _init()
128 {
129 int retval;
130
131 rw_init(&lm_lck, NULL, RW_DEFAULT, NULL);
132 nlm_init();
133
134 zone_key_create(&nlm_zone_key, lm_zone_init, NULL, lm_zone_fini);
135 /* Per-zone lockmgr data. See: os/flock.c */
136 zone_key_create(&flock_zone_key, flk_zone_init, NULL, flk_zone_fini);
137
138 retval = mod_install(&modlinkage);
139 if (retval == 0) {
140 flk_add_sysid_to_host_translator(nlm_sysid_to_host);
141 return (0);
142 }
143
144 /*
145 * mod_install failed! undo above, reverse order
146 */
147
148 (void) zone_key_delete(flock_zone_key);
149 flock_zone_key = ZONE_KEY_UNINITIALIZED;
150 (void) zone_key_delete(nlm_zone_key);
151 rw_destroy(&lm_lck);
152
153 return (retval);
154 }
155
156 int
157 _fini()
158 {
159 /* Don't unload. */
160 return (EBUSY);
161 }
162
|