11.1Spgoyette/*	$NetBSD: hello.c,v 1.1 2015/05/13 07:07:36 pgoyette Exp $	*/
21.1Spgoyette
31.1Spgoyette/*-
41.1Spgoyette * Copyright (c) 2015 The NetBSD Foundation, Inc.
51.1Spgoyette * All rights reserved.
61.1Spgoyette *
71.1Spgoyette * Redistribution and use in source and binary forms, with or without
81.1Spgoyette * modification, are permitted provided that the following conditions
91.1Spgoyette * are met:
101.1Spgoyette * 1. Redistributions of source code must retain the above copyright
111.1Spgoyette *    notice, this list of conditions and the following disclaimer.
121.1Spgoyette * 2. Redistributions in binary form must reproduce the above copyright
131.1Spgoyette *    notice, this list of conditions and the following disclaimer in the
141.1Spgoyette *    documentation and/or other materials provided with the distribution.
151.1Spgoyette *
161.1Spgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
171.1Spgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
181.1Spgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
191.1Spgoyette * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
201.1Spgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
211.1Spgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
221.1Spgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
231.1Spgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
241.1Spgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
251.1Spgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
261.1Spgoyette * POSSIBILITY OF SUCH DAMAGE.
271.1Spgoyette */
281.1Spgoyette
291.1Spgoyette#include <sys/cdefs.h>
301.1Spgoyette__KERNEL_RCSID(0, "$NetBSD: hello.c,v 1.1 2015/05/13 07:07:36 pgoyette Exp $");
311.1Spgoyette
321.1Spgoyette#include <sys/param.h>
331.1Spgoyette#include <sys/module.h>
341.1Spgoyette
351.1Spgoyette/*
361.1Spgoyette * Last parameter of MODULE macro is a list of names (as string; names are
371.1Spgoyette * separated by commas) of dependencies.  If module has no dependencies,
381.1Spgoyette * then NULL should be passed.
391.1Spgoyette */
401.1Spgoyette
411.1SpgoyetteMODULE(MODULE_CLASS_MISC, hello, NULL);
421.1Spgoyette
431.1Spgoyettestatic int
441.1Spgoyettehello_modcmd(modcmd_t cmd, void *arg __unused)
451.1Spgoyette{
461.1Spgoyette	switch (cmd) {
471.1Spgoyette	case MODULE_CMD_INIT:
481.1Spgoyette		printf("Example module loaded.\n");
491.1Spgoyette		break;
501.1Spgoyette
511.1Spgoyette	case MODULE_CMD_FINI:
521.1Spgoyette		printf("Example module unloaded.\n");
531.1Spgoyette		break;
541.1Spgoyette
551.1Spgoyette	case MODULE_CMD_STAT:
561.1Spgoyette		printf("Example module status queried.\n");
571.1Spgoyette		break;
581.1Spgoyette
591.1Spgoyette	default:
601.1Spgoyette		return ENOTTY;
611.1Spgoyette	}
621.1Spgoyette
631.1Spgoyette	return 0;
641.1Spgoyette}
65