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



OK, I looked at all of the examples, except for the lua one (I am lua-clueless). Everything looks OK to me, and I don't see any reason not to commit these.

I do, however, have a request...

The "happy" module makes a claim that "4 digit numbers cannot cycle", and uses a cache[] table for all numbers below 1000. Can you please provide a reference to back up the "cannot cycle" claim? :) And please initialize (or reinitialize) the entire cache[] array in your modcmd's INIT routine, rather than a single static initialization. (It could make a difference if the module were ever "built-in" to a kernel ...)

Also, for all tests that create a cdevsw, please insert a comment to ensure that the reader should verify that the number should be changed if needed to avoid conflict with "real" devices. And maybe also note this in the README file? Definitely include a comment that these modules should not be used on a "production" machine, just in case...

Finally, I would appreciate it if other folks would weigh in on the question of the directory hierarchy into which these examples should be placed...



On Sat, 9 May 2015, Paul Goyette wrote:

I'd like to suggest that perhaps the example modules should belong in /usr/share/examples/ or similar?

Yes, I understand that these are examples of kernel code, but still I think they belong with all the other examples. :)

BTW, I have not reviewed the sample modules code in detail. I will try to have a more in-depth look in the next couple of days.




On Fri, 8 May 2015, Kamil Rytarowski wrote:

I'm attaching a patch with enhanced documentation of modules(9).
Please see the attached patch. Feel free to tweak it for your needs.
I know that the example modules aren't MPSAFE just to not overkill the examples.

In the place of the original example (properties) I have added the following list:
    * hello           - the simplest `hello world' module
    * properties      - handle incoming properties during the module load
    * happy           - basic implementation of read(9) with happy numbers
    * ping            - basic ioctl(9)
    * hellolua        - the simplest `hello world' Lua module

I would like to see more examples!

Approved please commit.

-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index