tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: (patch) Improved documentation and examples of dynamic modules



Le 11/05/2015 13:35, Paul Goyette a écrit :
On Mon, 11 May 2015, Kamil Rytarowski wrote:

I've attached new patch.

Thanks - I will review as soon as I can get to it.

For now I will schedule share/man pages for later.
After committing it please remove sys/modules/example.

I went for share/examples/sys/kmodule.

Well, I've done some more thinking on that topic!  Greg Troxel has a
good comment about continuing to build all the example modules as part
of normal 'build.sh release'.  In order to do that, and to get all the
build goop right (Makefiles, Makefiles.inc, etc.) it will actually be
easier to place them in the sys/modules/ hierarchy.  So, one might say
that I've "had second thoughts."

I would now propose that we remove the existing sys/modules/example/
code and place the several new example modules as subdirectories of
the
sys/modules/example/ directory.  Then the main sys/modules/Makefile
can descend into modules/examples, and a new Makefile there can
further descend into the multiple subdirectories.

I'll wait a few days (at least) before committing anything, to give
the rest of the community an opportunity to respond.

I like the idea. Having examples to work with for modules is quite helpful, I remember having a hard time writing my first driver due to a lack of proper examples.

One suggestion to your code: would it be possible to prefix (or suffix...) modules' name with "example" (MODULE(...) macro)? It emphasizes that the name should make sense, avoids confusion when someone(TM) writes later a module called "hello" or "happy" (meh), and also... helps spotting them out if they are erroneously loaded.

That and/or add a printf to each example in MODULE_CMD_INIT to warn about this.

--
Jean-Yves Migeon


Home | Main Index | Thread Index | Old Index