xref: /titanic_41/usr/src/uts/common/inet/ip/keysockddi.c (revision 22337b4b3c8a2b9db615e524e0e9e1fbd3dc71bf)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <sys/types.h>
29 #include <sys/conf.h>
30 #include <sys/errno.h>
31 #include <sys/modctl.h>
32 #include <inet/common.h>
33 #include <inet/ipsec_impl.h>
34 
35 #define	INET_NAME	"keysock"
36 #define	INET_MODSTRTAB	keysockinfo
37 #define	INET_DEVSTRTAB	keysockinfo
38 #define	INET_MODDESC	"PF_KEY socket STREAMS module %I%"
39 #define	INET_DEVDESC	"PF_KEY socket STREAMS driver %I%"
40 #define	INET_DEVMINOR	0
41 #define	INET_DEVMTFLAGS	(D_MP|D_MTPERMOD|D_MTPUTSHARED)
42 #define	INET_MODMTFLAGS	INET_DEVMTFLAGS
43 
44 #include "../inetddi.c"
45 
46 
47 struct modlinkage *keysock_modlp = NULL;
48 
49 int
50 _init(void)
51 {
52 	int	error;
53 
54 	if (!keysock_ddi_init())
55 		return (ENOMEM);
56 	error = mod_install(&modlinkage);
57 	if (error != 0)
58 		keysock_ddi_destroy();
59 	else
60 		keysock_modlp = &modlinkage;
61 
62 	return (error);
63 }
64 
65 int
66 _fini(void)
67 {
68 	int	error;
69 
70 	error = mod_remove(&modlinkage);
71 	if (error != 0)
72 		return (error);
73 
74 	keysock_ddi_destroy();
75 	keysock_modlp = NULL;
76 	return (0);
77 }
78 
79 int
80 _info(struct modinfo *modinfop)
81 {
82 	return (mod_info(&modlinkage, modinfop));
83 }
84