xref: /illumos-gate/usr/src/uts/common/io/ppp/spppasyn/spppasyn_mod.c (revision 8c69cc8fbe729fa7b091e901c4b50508ccc6bb33)
1 /*
2  * spppasyn_mod.c - modload support for PPP AHDLC STREAMS module
3  *
4  * Copyright (c) 2011 Bayard G. Bell. All rights reserved.
5  * Use is subject to license terms.
6  *
7  * CONTRIBUTOR MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY
8  * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
9  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
10  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  CONTRIBUTOR SHALL NOT BE LIABLE
11  * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
12  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
13  *
14  * Permission to use, copy, modify, and distribute this software and its
15  * documentation is hereby granted, provided that the above copyright
16  * notice appears in all copies.
17  *
18  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
19  * Use is subject to license terms.
20  *
21  * Permission to use, copy, modify, and distribute this software and its
22  * documentation is hereby granted, provided that the above copyright
23  * notice appears in all copies.
24  *
25  * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
26  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
27  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
28  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  SUN SHALL NOT BE LIABLE FOR
29  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
31  *
32  * Copyright (c) 1994 The Australian National University.
33  * All rights reserved.
34  *
35  * Permission to use, copy, modify, and distribute this software and its
36  * documentation is hereby granted, provided that the above copyright
37  * notice appears in all copies.  This software is provided without any
38  * warranty, express or implied. The Australian National University
39  * makes no representations about the suitability of this software for
40  * any purpose.
41  *
42  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
43  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
44  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
45  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
46  * OF SUCH DAMAGE.
47  *
48  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
49  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
50  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
51  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
52  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
53  * OR MODIFICATIONS.
54  *
55  * $Id: ppp_mod.c,v 1.3 1999/02/26 10:53:28 paulus Exp $
56  */
57 
58 #include <sys/types.h>
59 #include <sys/conf.h>
60 #include <sys/ddi.h>
61 #include <sys/conf.h>
62 #include <sys/modctl.h>
63 #include <net/pppio.h>
64 
65 /*
66  * Globals for PPP AHDLC loadable module wrapper
67  */
68 extern struct streamtab spppasyn_tab;
69 extern const char spppasyn_module_description[];
70 
71 /*
72  * Module linkage information for the kernel.
73  */
74 static struct fmodsw mod_fsw = {
75 	AHDLC_MOD_NAME,					/* f_name */
76 	&spppasyn_tab,					/* f_str */
77 	D_MP | D_MTPERQ					/* f_flag */
78 };
79 
80 static struct modlstrmod modlstrmod = {
81 	&mod_strmodops,				/* strmod_modops */
82 	(char *)spppasyn_module_description,	/* strmod_linkinfo */
83 	&mod_fsw				/* strmod_fmodsw */
84 };
85 
86 static struct modlinkage modlinkage = {
87 	MODREV_1,			/* ml_rev, has to be MODREV_1 */
88 	&modlstrmod,			/* ml_linkage, NULL-terminated list */
89 	NULL				/*  of linkage structures */
90 };
91 
92 int
93 _init(void)
94 {
95 	return (mod_install(&modlinkage));
96 }
97 
98 int
99 _fini(void)
100 {
101 	return (mod_remove(&modlinkage));
102 }
103 
104 int
105 _info(struct modinfo *modinfop)
106 {
107 	return (mod_info(&modlinkage, modinfop));
108 }
109