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