xref: /onnv-gate/usr/src/uts/common/inet/ip/ipddi.c (revision 5240:e7599510dd03)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51633Srs200217  * Common Development and Distribution License (the "License").
61633Srs200217  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*5240Snordmark  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/types.h>
300Sstevel@tonic-gate #include <sys/conf.h>
310Sstevel@tonic-gate #include <sys/modctl.h>
320Sstevel@tonic-gate #include <inet/common.h>
330Sstevel@tonic-gate #include <inet/ip.h>
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #define	INET_NAME	"ip"
36*5240Snordmark #define	INET_DEVSTRTAB	ipinfov4
37*5240Snordmark #define	INET_MODSTRTAB	ipinfov4
380Sstevel@tonic-gate #define	INET_MODDESC	"IP STREAMS module 1.47"
390Sstevel@tonic-gate #define	INET_DEVDESC	"IP STREAMS driver 1.47"
40*5240Snordmark #define	INET_DEVMINOR	0
41*5240Snordmark #define	INET_DEVMTFLAGS	IP_DEVMTFLAGS	/* since we're really ip */
420Sstevel@tonic-gate #define	INET_MODMTFLAGS D_MP
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #include "../inetddi.c"
450Sstevel@tonic-gate 
460Sstevel@tonic-gate extern void ip_ddi_init(void);
470Sstevel@tonic-gate extern void ip_ddi_destroy(void);
480Sstevel@tonic-gate 
490Sstevel@tonic-gate int
_init(void)500Sstevel@tonic-gate _init(void)
510Sstevel@tonic-gate {
520Sstevel@tonic-gate 	int error;
530Sstevel@tonic-gate 
540Sstevel@tonic-gate 	/*
550Sstevel@tonic-gate 	 * Note: After mod_install succeeds, another thread can enter
560Sstevel@tonic-gate 	 * therefore all initialization is done before it and any
570Sstevel@tonic-gate 	 * de-initialization needed done if it fails.
580Sstevel@tonic-gate 	 */
590Sstevel@tonic-gate 	ip_ddi_init();
600Sstevel@tonic-gate 	error = mod_install(&modlinkage);
610Sstevel@tonic-gate 	if (error != 0)
620Sstevel@tonic-gate 		ip_ddi_destroy();
630Sstevel@tonic-gate 
640Sstevel@tonic-gate 	return (error);
650Sstevel@tonic-gate }
660Sstevel@tonic-gate 
670Sstevel@tonic-gate int
_fini(void)680Sstevel@tonic-gate _fini(void)
690Sstevel@tonic-gate {
700Sstevel@tonic-gate 	int error;
710Sstevel@tonic-gate 
720Sstevel@tonic-gate 	error = mod_remove(&modlinkage);
730Sstevel@tonic-gate 	if (error == 0)
740Sstevel@tonic-gate 		ip_ddi_destroy();
750Sstevel@tonic-gate 
760Sstevel@tonic-gate 	return (error);
770Sstevel@tonic-gate }
780Sstevel@tonic-gate 
790Sstevel@tonic-gate int
_info(struct modinfo * modinfop)800Sstevel@tonic-gate _info(struct modinfo *modinfop)
810Sstevel@tonic-gate {
820Sstevel@tonic-gate 	return (mod_info(&modlinkage, modinfop));
830Sstevel@tonic-gate }
84