7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <strings.h>
31 #include <string.h>
32 #include <dirent.h>
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <sys/param.h>
36 #include <sys/errno.h>
37 #include <limits.h>
38 #include <libnvpair.h>
39 #include <dlfcn.h>
40 #include <libintl.h>
41 #include <sys/systeminfo.h>
42 #include <sys/fs_reparse.h>
43 #include "rp_plugin.h"
44
45 #define MAXISALEN 257 /* based on sysinfo(2) man page */
46
257 {
258 if (*name != '.')
259 return (B_FALSE);
260
261 if (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))
262 return (B_TRUE);
263
264 return (B_FALSE);
265 }
266
267 static void
268 proto_plugin_fini()
269 {
270 rp_proto_plugin_t *p;
271
272 /*
273 * Protocols may call this framework during _fini
274 */
275 for (p = rp_proto_list; p != NULL; p = p->plugin_next) {
276 if (p->plugin_ops->rpo_fini)
277 p->plugin_ops->rpo_fini();
278 }
279 while ((p = rp_proto_list) != NULL) {
280 rp_proto_list = p->plugin_next;
281 if (p->plugin_handle != NULL)
282 (void) dlclose(p->plugin_handle);
283 free(p);
284 }
285
286 if (rp_proto_handle.rp_ops != NULL) {
287 free(rp_proto_handle.rp_ops);
288 rp_proto_handle.rp_ops = NULL;
289 }
290 rp_proto_handle.rp_num_proto = 0;
291 }
292
293 /*
294 * rp_plugin_init()
295 *
296 * Initialize the service type specific plugin modules.
297 * For each reparse service type, there should be a plugin library for it.
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright (c) 2018, Joyent, Inc.
29 */
30
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <unistd.h>
34 #include <strings.h>
35 #include <string.h>
36 #include <dirent.h>
37 #include <sys/types.h>
38 #include <sys/stat.h>
39 #include <sys/param.h>
40 #include <sys/errno.h>
41 #include <limits.h>
42 #include <libnvpair.h>
43 #include <dlfcn.h>
44 #include <libintl.h>
45 #include <sys/systeminfo.h>
46 #include <sys/fs_reparse.h>
47 #include "rp_plugin.h"
48
49 #define MAXISALEN 257 /* based on sysinfo(2) man page */
50
261 {
262 if (*name != '.')
263 return (B_FALSE);
264
265 if (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))
266 return (B_TRUE);
267
268 return (B_FALSE);
269 }
270
271 static void
272 proto_plugin_fini()
273 {
274 rp_proto_plugin_t *p;
275
276 /*
277 * Protocols may call this framework during _fini
278 */
279 for (p = rp_proto_list; p != NULL; p = p->plugin_next) {
280 if (p->plugin_ops->rpo_fini)
281 (void) p->plugin_ops->rpo_fini();
282 }
283 while ((p = rp_proto_list) != NULL) {
284 rp_proto_list = p->plugin_next;
285 if (p->plugin_handle != NULL)
286 (void) dlclose(p->plugin_handle);
287 free(p);
288 }
289
290 if (rp_proto_handle.rp_ops != NULL) {
291 free(rp_proto_handle.rp_ops);
292 rp_proto_handle.rp_ops = NULL;
293 }
294 rp_proto_handle.rp_num_proto = 0;
295 }
296
297 /*
298 * rp_plugin_init()
299 *
300 * Initialize the service type specific plugin modules.
301 * For each reparse service type, there should be a plugin library for it.
|