xref: /illumos-gate/usr/src/uts/common/io/ppp/spppcomp/spppcomp_mod.c (revision ef8846857fcf954444cdc77e72249afef48377d2)
1 /*
2  * spppcomp_mod.c - modload support for PPP compression STREAMS module.
3  *
4  * Copyright (c) 2000 by Sun Microsystems, Inc.
5  * All rights reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation is hereby granted, provided that the above copyright
9  * notice appears in all copies.
10  *
11  * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
12  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
13  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  SUN SHALL NOT BE LIABLE FOR
15  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
16  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
17  *
18  * Copyright (c) 1994 The Australian National University.
19  * All rights reserved.
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.  This software is provided without any
24  * warranty, express or implied. The Australian National University
25  * makes no representations about the suitability of this software for
26  * any purpose.
27  *
28  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
29  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
30  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
31  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
32  * OF SUCH DAMAGE.
33  *
34  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
35  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
36  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
37  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
38  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
39  * OR MODIFICATIONS.
40  *
41  * This module is derived from the original SVR4 STREAMS PPP compression
42  * module originally written by Paul Mackerras <paul.mackerras@cs.anu.edu.au>.
43  *
44  * James Carlson <james.d.carlson@sun.com> and Adi Masputra
45  * <adi.masputra@sun.com> rewrote and restructured the code for improved
46  * performance and scalability.
47  */
48 
49 #pragma ident	"%Z%%M%	%I%	%E% SMI"
50 #define	RCSID	"$Id: spppcomp_mod.c,v 1.0 2000/05/08 01:10:12 masputra Exp $"
51 
52 #include <sys/types.h>
53 #include <sys/syslog.h>
54 #include <sys/conf.h>
55 #include <sys/errno.h>
56 #include <sys/ddi.h>
57 #include <sys/conf.h>
58 #include <sys/modctl.h>
59 #include <net/pppio.h>
60 
61 #include "s_common.h"
62 
63 /*
64  * Globals for PPP compression loadable module wrapper
65  */
66 char _depends_on[] = "drv/sppp";	/* we need some helper routines */
67 extern struct streamtab spppcomp_tab;
68 extern const char spppcomp_module_description[];
69 
70 static struct fmodsw fsw = {
71 	COMP_MOD_NAME,				/* f_name */
72 	&spppcomp_tab,				/* f_str */
73 	D_NEW | D_MP | D_MTPERQ			/* f_flag */
74 };
75 
76 static struct modlstrmod modlstrmod = {
77 	&mod_strmodops,				/* strmod_modops */
78 	(char *)spppcomp_module_description,	/* strmod_linkinfo */
79 	&fsw					/* strmod_fmodsw */
80 };
81 
82 static struct modlinkage modlinkage = {
83 	MODREV_1,			/* ml_rev, has to be MODREV_1 */
84 	(void *) &modlstrmod,		/* ml_linkage, NULL-terminated list */
85 	NULL				/*  of linkage structures */
86 };
87 
88 int
89 _init(void)
90 {
91 	return (mod_install(&modlinkage));
92 }
93 
94 int
95 _fini(void)
96 {
97 	return (mod_remove(&modlinkage));
98 }
99 
100 int
101 _info(struct modinfo *modinfop)
102 {
103 	return (mod_info(&modlinkage, modinfop));
104 }
105