11.3Schristos/*	$NetBSD: compat_100_mod.c,v 1.3 2024/05/20 01:30:34 christos Exp $ */
21.1Spgoyette
31.1Spgoyette/*-
41.1Spgoyette * Copyright (c) 2019 The NetBSD Foundation, Inc.
51.1Spgoyette * All rights reserved.
61.1Spgoyette *
71.1Spgoyette * This code is derived from software developed for The NetBSD Foundation
81.1Spgoyette * by Paul Goyette
91.1Spgoyette *
101.1Spgoyette * Redistribution and use in source and binary forms, with or without
111.1Spgoyette * modification, are permitted provided that the following conditions
121.1Spgoyette * are met:
131.1Spgoyette * 1. Redistributions of source code must retain the above copyright
141.1Spgoyette *    notice, this list of conditions and the following disclaimer.
151.1Spgoyette * 2. Redistributions in binary form must reproduce the above copyright
161.1Spgoyette *    notice, this list of conditions and the following disclaimer in the
171.1Spgoyette *    documentation and/or other materials provided with the distribution.
181.1Spgoyette *
191.1Spgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Spgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Spgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Spgoyette * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Spgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Spgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Spgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Spgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Spgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Spgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Spgoyette * POSSIBILITY OF SUCH DAMAGE.
301.1Spgoyette */
311.1Spgoyette
321.1Spgoyette/*
331.1Spgoyette * Linkage for the compat module: spaghetti.
341.1Spgoyette */
351.1Spgoyette
361.1Spgoyette#if defined(_KERNEL_OPT)
371.1Spgoyette#include "opt_compat_netbsd.h"
381.1Spgoyette#endif
391.1Spgoyette
401.1Spgoyette#include <sys/cdefs.h>
411.3Schristos__KERNEL_RCSID(0, "$NetBSD: compat_100_mod.c,v 1.3 2024/05/20 01:30:34 christos Exp $");
421.1Spgoyette
431.1Spgoyette#include <sys/systm.h>
441.1Spgoyette#include <sys/module.h>
451.1Spgoyette
461.1Spgoyette#include <compat/common/compat_util.h>
471.1Spgoyette#include <compat/common/compat_mod.h>
481.1Spgoyette
491.1Spgoyetteint
501.1Spgoyettecompat_100_init(void)
511.1Spgoyette{
521.3Schristos	int error;
531.1Spgoyette
541.3Schristos	error = kern_event_100_init();
551.3Schristos	if (error)
561.3Schristos		return error;
571.3Schristos	return sys_descrip_100_init();
581.1Spgoyette}
591.1Spgoyette
601.1Spgoyetteint
611.1Spgoyettecompat_100_fini(void)
621.1Spgoyette{
631.3Schristos	int error;
641.1Spgoyette
651.3Schristos	error = kern_event_100_fini();
661.3Schristos	if (error)
671.3Schristos		return error;
681.3Schristos	return sys_descrip_100_fini();
691.1Spgoyette}
701.1Spgoyette
711.1SpgoyetteMODULE(MODULE_CLASS_EXEC, compat_100, NULL);
721.1Spgoyette
731.1Spgoyettestatic int
741.1Spgoyettecompat_100_modcmd(modcmd_t cmd, void *arg)
751.1Spgoyette{
761.1Spgoyette
771.1Spgoyette	switch (cmd) {
781.1Spgoyette	case MODULE_CMD_INIT:
791.1Spgoyette		return compat_100_init();
801.1Spgoyette
811.1Spgoyette	case MODULE_CMD_FINI:
821.1Spgoyette		return compat_100_fini();
831.1Spgoyette
841.1Spgoyette	default:
851.1Spgoyette		return ENOTTY;
861.1Spgoyette	}
871.1Spgoyette}
88