xref: /netbsd-src/sys/compat/common/compat_80_mod.c (revision 423739174a622ba00769149417addfbe4d36c76a)
1*42373917Spgoyette /*	$NetBSD: compat_80_mod.c,v 1.5 2019/10/03 19:56:16 pgoyette Exp $	*/
2d91f98a8Spgoyette 
3d91f98a8Spgoyette /*-
4d91f98a8Spgoyette  * Copyright (c) 2018 The NetBSD Foundation, Inc.
5d91f98a8Spgoyette  * All rights reserved.
6d91f98a8Spgoyette  *
7d91f98a8Spgoyette  * This code is derived from software developed for The NetBSD Foundation
8d91f98a8Spgoyette  * by Paul Goyette
9d91f98a8Spgoyette  *
10d91f98a8Spgoyette  * Redistribution and use in source and binary forms, with or without
11d91f98a8Spgoyette  * modification, are permitted provided that the following conditions
12d91f98a8Spgoyette  * are met:
13d91f98a8Spgoyette  * 1. Redistributions of source code must retain the above copyright
14d91f98a8Spgoyette  *    notice, this list of conditions and the following disclaimer.
15d91f98a8Spgoyette  * 2. Redistributions in binary form must reproduce the above copyright
16d91f98a8Spgoyette  *    notice, this list of conditions and the following disclaimer in the
17d91f98a8Spgoyette  *    documentation and/or other materials provided with the distribution.
18d91f98a8Spgoyette  *
19d91f98a8Spgoyette  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20d91f98a8Spgoyette  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21d91f98a8Spgoyette  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22d91f98a8Spgoyette  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23d91f98a8Spgoyette  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24d91f98a8Spgoyette  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25d91f98a8Spgoyette  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26d91f98a8Spgoyette  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27d91f98a8Spgoyette  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28d91f98a8Spgoyette  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29d91f98a8Spgoyette  * POSSIBILITY OF SUCH DAMAGE.
30d91f98a8Spgoyette  */
31d91f98a8Spgoyette 
32d91f98a8Spgoyette /*
33d91f98a8Spgoyette  * Linkage for the compat module: spaghetti.
34d91f98a8Spgoyette  */
35d91f98a8Spgoyette 
36d91f98a8Spgoyette #if defined(_KERNEL_OPT)
37d91f98a8Spgoyette #include "opt_compat_netbsd.h"
38d91f98a8Spgoyette #endif
39d91f98a8Spgoyette 
40d91f98a8Spgoyette #include <sys/cdefs.h>
41*42373917Spgoyette __KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.5 2019/10/03 19:56:16 pgoyette Exp $");
42d91f98a8Spgoyette 
43d91f98a8Spgoyette #include <sys/systm.h>
44d91f98a8Spgoyette #include <sys/module.h>
45d91f98a8Spgoyette 
46d91f98a8Spgoyette #include <compat/common/compat_util.h>
47d91f98a8Spgoyette #include <compat/common/compat_mod.h>
48d91f98a8Spgoyette 
492a1efa7bSmsaitoh int
compat_80_init(void)502a1efa7bSmsaitoh compat_80_init(void)
51d91f98a8Spgoyette {
52d91f98a8Spgoyette 
53d91f98a8Spgoyette 	kern_mod_80_init();
54bf354a07Smsaitoh 	ifmedia_80_init();
55d91f98a8Spgoyette 
56d91f98a8Spgoyette 	return 0;
57d91f98a8Spgoyette }
58d91f98a8Spgoyette 
592a1efa7bSmsaitoh int
compat_80_fini(void)602a1efa7bSmsaitoh compat_80_fini(void)
61d91f98a8Spgoyette {
62d91f98a8Spgoyette 
63bf354a07Smsaitoh 	ifmedia_80_fini();
64d91f98a8Spgoyette 	kern_mod_80_fini();
65d91f98a8Spgoyette 
66d91f98a8Spgoyette 	return 0;
67d91f98a8Spgoyette }
68d91f98a8Spgoyette 
69*42373917Spgoyette MODULE(MODULE_CLASS_EXEC, compat_80, "compat_90");
70d91f98a8Spgoyette 
71d91f98a8Spgoyette static int
compat_80_modcmd(modcmd_t cmd,void * arg)72d91f98a8Spgoyette compat_80_modcmd(modcmd_t cmd, void *arg)
73d91f98a8Spgoyette {
74d91f98a8Spgoyette 
75d91f98a8Spgoyette 	switch (cmd) {
76d91f98a8Spgoyette 	case MODULE_CMD_INIT:
77d91f98a8Spgoyette 		return compat_80_init();
78d91f98a8Spgoyette 
79d91f98a8Spgoyette 	case MODULE_CMD_FINI:
80d91f98a8Spgoyette 		return compat_80_fini();
81d91f98a8Spgoyette 
82d91f98a8Spgoyette 	default:
83d91f98a8Spgoyette 		return ENOTTY;
84d91f98a8Spgoyette 	}
85d91f98a8Spgoyette }
86