Home | History | Annotate | Line # | Download | only in common
compat_70_mod.c revision 1.3.4.2
      1  1.3.4.2  christos /*	$NetBSD: compat_70_mod.c,v 1.3.4.2 2019/06/10 22:06:58 christos Exp $	*/
      2  1.3.4.2  christos 
      3  1.3.4.2  christos /*-
      4  1.3.4.2  christos  * Copyright (c) 2018 The NetBSD Foundation, Inc.
      5  1.3.4.2  christos  * All rights reserved.
      6  1.3.4.2  christos  *
      7  1.3.4.2  christos  * This code is derived from software developed for The NetBSD Foundation
      8  1.3.4.2  christos  * by Paul Goyette
      9  1.3.4.2  christos  *
     10  1.3.4.2  christos  * Redistribution and use in source and binary forms, with or without
     11  1.3.4.2  christos  * modification, are permitted provided that the following conditions
     12  1.3.4.2  christos  * are met:
     13  1.3.4.2  christos  * 1. Redistributions of source code must retain the above copyright
     14  1.3.4.2  christos  *    notice, this list of conditions and the following disclaimer.
     15  1.3.4.2  christos  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.3.4.2  christos  *    notice, this list of conditions and the following disclaimer in the
     17  1.3.4.2  christos  *    documentation and/or other materials provided with the distribution.
     18  1.3.4.2  christos  *
     19  1.3.4.2  christos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.3.4.2  christos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.3.4.2  christos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.3.4.2  christos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.3.4.2  christos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.3.4.2  christos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.3.4.2  christos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.3.4.2  christos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.3.4.2  christos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.3.4.2  christos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.3.4.2  christos  * POSSIBILITY OF SUCH DAMAGE.
     30  1.3.4.2  christos  */
     31  1.3.4.2  christos 
     32  1.3.4.2  christos /*
     33  1.3.4.2  christos  * Linkage for the compat module: spaghetti.
     34  1.3.4.2  christos  */
     35  1.3.4.2  christos 
     36  1.3.4.2  christos #if defined(_KERNEL_OPT)
     37  1.3.4.2  christos #include "opt_compat_netbsd.h"
     38  1.3.4.2  christos #endif
     39  1.3.4.2  christos 
     40  1.3.4.2  christos #include <sys/cdefs.h>
     41  1.3.4.2  christos __KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.3.4.2 2019/06/10 22:06:58 christos Exp $");
     42  1.3.4.2  christos 
     43  1.3.4.2  christos #include <sys/systm.h>
     44  1.3.4.2  christos #include <sys/module.h>
     45  1.3.4.2  christos 
     46  1.3.4.2  christos #include <net/if.h>
     47  1.3.4.2  christos #include <net/route.h>
     48  1.3.4.2  christos 
     49  1.3.4.2  christos #include <compat/common/compat_util.h>
     50  1.3.4.2  christos #include <compat/common/compat_mod.h>
     51  1.3.4.2  christos #include <compat/sys/sockio.h>
     52  1.3.4.2  christos #include <compat/sys/socket.h>
     53  1.3.4.2  christos 
     54  1.3.4.2  christos #include <compat/net/route.h>
     55  1.3.4.2  christos #include <compat/net/route_70.h>
     56  1.3.4.2  christos 
     57  1.3.4.2  christos int
     58  1.3.4.2  christos compat_70_init(void)
     59  1.3.4.2  christos {
     60  1.3.4.2  christos 
     61  1.3.4.2  christos 	compat70_ocreds_valid = true;
     62  1.3.4.2  christos 	rtsock_70_init();
     63  1.3.4.2  christos 	uipc_usrreq_70_init();
     64  1.3.4.2  christos 
     65  1.3.4.2  christos 	return 0;
     66  1.3.4.2  christos }
     67  1.3.4.2  christos 
     68  1.3.4.2  christos int
     69  1.3.4.2  christos compat_70_fini(void)
     70  1.3.4.2  christos {
     71  1.3.4.2  christos 
     72  1.3.4.2  christos 	uipc_usrreq_70_fini();
     73  1.3.4.2  christos 	rtsock_70_fini();
     74  1.3.4.2  christos 	compat70_ocreds_valid = false;
     75  1.3.4.2  christos 
     76  1.3.4.2  christos 	return 0;
     77  1.3.4.2  christos }
     78  1.3.4.2  christos 
     79  1.3.4.2  christos MODULE(MODULE_CLASS_EXEC, compat_70, "compat_80");
     80  1.3.4.2  christos 
     81  1.3.4.2  christos static int
     82  1.3.4.2  christos compat_70_modcmd(modcmd_t cmd, void *arg)
     83  1.3.4.2  christos {
     84  1.3.4.2  christos 
     85  1.3.4.2  christos 	switch (cmd) {
     86  1.3.4.2  christos 	case MODULE_CMD_INIT:
     87  1.3.4.2  christos 		return compat_70_init();
     88  1.3.4.2  christos 
     89  1.3.4.2  christos 	case MODULE_CMD_FINI:
     90  1.3.4.2  christos 		return compat_70_fini();
     91  1.3.4.2  christos 
     92  1.3.4.2  christos 	default:
     93  1.3.4.2  christos 		return ENOTTY;
     94  1.3.4.2  christos 	}
     95  1.3.4.2  christos }
     96