From nobody Wed Nov 15 15:22:22 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SVn342RRVz50Pjq; Wed, 15 Nov 2023 15:22:24 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SVn34210Rz3Qs4; Wed, 15 Nov 2023 15:22:24 +0000 (UTC) (envelope-from mhorne@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700061744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=i7/rbzGqd6+0hYprJABHwNIVe2D8dP4ZKvHSznLGJcM=; b=qAYPcTuqLt4te+eDKYUyNycZ4bIoLQYPcI6SUU0OMqvqU/sC6TmpuF8w0fPX9kp9GlS5rK Jx+zZIiTkTRqo9nkp1dsPDEciRjcc/nT8M8GmbdMm33HnwU5Hf2Uaapjup87d87h3+uziY Ql9xuGeH0MfT3JXGAgJLdKtTrxR5ID0vCqzDd/HlOMuOVcPLWm7CKIoQEs7/uPkbp8TvQN 5GKpJZW6EQi1qREOHtOjPXWEGkCWEC1sr4XU6MNOj5n/kLrdeBeYsb4AuWmG1Z6Fb4QbTq OaJFK+XR2rGklSQvbnGZx/0t9YIjafI6YhDDKoqkklBaF7wS32l8t6yHPPI+pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700061744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=i7/rbzGqd6+0hYprJABHwNIVe2D8dP4ZKvHSznLGJcM=; b=TP4JPGgQOf/YAoPHaqvHFfFDhKH5CP7t43FxqJQzXFoYeR26dtWGpn6wfFonzD07IDlIkF vf3N44adtLpfUUARnDv6ysS5zFm6X0YN6tiZ3Tn4x7Z9nfrX+vxHGABDn0Q6lls4k2EUu5 3rnj0ddbFwzFsEMr8pfXe/hM6YoGpD01UPW3sclFR6WKZ3CmG37HN2eXufEuUmTQUBJqiV 2j3ezfAiScC+VAtvcyPL84XCwWnnOmaOjoT6SluYjVP3R7RjGUiJdEPP592QtW/kTHXfxF F/H57xZGnxYryb5UB8q5fR63zTVcjB8J7x3/GMtlbgHFxkXtBu+5DhU9F4h3LA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700061744; a=rsa-sha256; cv=none; b=LOCnSBMtH6B70nV7fOfFD+qk3A/GPb+PbX0apkFFZROeaE2u/jt6II8yxc7A8fbtvH889G qWLANLTg3lVftFxkCdKr+QPFo3rwyXb8UFvEaPlOl2muCriRm/tN1qYTZuRfIeEj1m+XBM 35f7TRQMEtQpQQofYYroegj2ifS0QCqt2fpi+EJWkUF9Iozmwc3IORsapWRGTUI14I46M7 uqU3IWc9MhtFBTBLODsH9DkU5WmZxFxKGWYQjoggbo+bX+O+bCTMOK+LczWHuMWDZGl3Z1 7wWs7KYHjJ7AFeHYv7Xs0qBYp+qDn/BzkEppgDhwg3GZAmERbur/h9TXai6hzg== Received: from [192.168.1.151] (host-173-212-76-127.public.eastlink.ca [173.212.76.127]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 4SVn336PLVz2nr; Wed, 15 Nov 2023 15:22:23 +0000 (UTC) (envelope-from mhorne@freebsd.org) Message-ID: Date: Wed, 15 Nov 2023 11:22:22 -0400 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: b2e41172bdc0 - main - A skeleton kernel module suitable for creating new such modules. Content-Language: en-CA To: "George V. Neville-Neil" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202311142111.3AELBWJn067834@gitrepo.freebsd.org> From: Mitchell Horne Autocrypt: addr=mhorne@freebsd.org; keydata= xsBNBFyS2dQBCADdiXBG8hBVLmYbxu7aSzbwLwUf3HkGFz3rooS1kwyy+SfmjZ4UKNnl9WMx WKrJ7OAZpiNH6bLQ5nsqfx09OnpWL8c/QuPbhNdUywQoqqYpRI0K8GEn//nS9Gs0KTYwVpWb XlrzP+jf3Uh/9L5mcQmStLIH4zaaqMYHW+pMuPrvBmLIHTvLj2QjOkxslrcUdord9uvxe5Ht LU8RuTpQpHOKz705Z9/v7twFdi2HtKzpLwO6SzVyu351di1J+GihsVpcT5josQV5cHbIP3Un x+kmtKBEEc/jl/zBglF7ruWUtwgbryID+2ZPEaO1Mj+RResX4LFVMusq3uUpWRb5WJXxABEB AAHNI01pdGNoZWxsIEhvcm5lIDxtaG9ybmVARnJlZUJTRC5vcmc+wsCUBBMBCgA+AhsDBQsJ CAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEkp/cYPcfabAiQvACi/gnTOdUid8FAmIyDpUFCQtC z0EACgkQi/gnTOdUid8IsQf+N8IptrrCg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DlXx7SYvTJcUNoNJjOKtQ0bYGVgGqYOB/y2mTjVuKeU0eOkN Uw== In-Reply-To: <202311142111.3AELBWJn067834@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/14/23 17:11, George V. Neville-Neil wrote: > The branch main has been updated by gnn: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b2e41172bdc00f177f7de4d4f4963cc4d99a3178 > > commit b2e41172bdc00f177f7de4d4f4963cc4d99a3178 > Author: George V. Neville-Neil > AuthorDate: 2023-10-05 20:05:31 +0000 > Commit: George V. Neville-Neil > CommitDate: 2023-11-14 21:08:13 +0000 > > A skeleton kernel module suitable for creating new such modules. I do not like to use my voice to squash the work of others, especially after it has hit the tree. But I dare to say that you didn't have to work very hard on this. So understand my honest question: what is the purpose of this addition? If it is well thought out then it is not clearly explained. Cheers, Mitchell > --- > share/examples/modules/Makefile | 6 +++ > share/examples/modules/skel.c | 87 +++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 93 insertions(+) > > diff --git a/share/examples/modules/Makefile b/share/examples/modules/Makefile > new file mode 100644 > index 000000000000..0f0a2fb01e8a > --- /dev/null > +++ b/share/examples/modules/Makefile > @@ -0,0 +1,6 @@ > +.PATH: ${SRCTOP}/sys/skel > + > +KMOD= skel > +SRCS= skel.c > + > +.include > diff --git a/share/examples/modules/skel.c b/share/examples/modules/skel.c > new file mode 100644 > index 000000000000..fc99e13ab444 > --- /dev/null > +++ b/share/examples/modules/skel.c > @@ -0,0 +1,87 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2023 George V. Neville-Neil > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + */ > + > +/* > + * SKEL Loadable Kernel Module for the FreeBSD Operating System > + * > + * The SKEL module is meant to act as a skeleton for creating new > + * kernel modules. > + * > + * This module can be loaded and unloaded from * FreeBSD and is for > + * use in teaching as well. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +/* > + * Every module can hav ea module specific piece of code that is > + * executed whenever the module is loaded or unloaded. The following > + * is a trivial example that prints a message on the console whenever > + * the module is loaded or unloaded. > + */ > + > +static int > +skel_mod_event(module_t mod, int type, void *data) > +{ > + > + switch (type) { > + case MOD_LOAD: > + printf("SKEL module loading.\n"); > + return (0); > + case MOD_UNLOAD: > + printf("SKEL module unloadin.\n"); > + return (0); > + } > + return (EOPNOTSUPP); > +} > + > +/* > + * Modules can have associated data and the module data also contains > + * an entry for the function called by the kernel on load and unload. > + */ > + > +static moduledata_t skel_mod = { > + "skel", > + skel_mod_event, > + NULL, > +}; > + > +/* > + * Each module is declared with its name and module data. The > + * ordering arguments at the end put this module into the device > + * driver class, which is sufficient for our needs. The complete list > + * of modules types and ording can be found in sys/kernel.h > + */ > + > +DECLARE_MODULE(skel, skel_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); > +