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



"Kamil Rytarowski" <n54%gmx.com@localhost> writes:

> Paul Goyette wrote:
>> 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 ...)
>
> There are two algorithms: naive and optimal. The naive one uses caching
> and the optimal check whether we are in the cycle: 4, 16, 37, 58, 89,
> 145, 42, 20. The claims comes from this statement that the largest number
> from the cycle is 3-digit.
>
> I can go for the the optimal one and cut the caching design in the code.
> In the module example the algorithm implementation shouldn't divert 
> attention from the important part - how to implement read(2).

My reaction to this is that this entire algorithm is a distraction to
the module example.

Also, "happy" doesn't seem like a useful name; examples should have
names that suggest the kinds of things they do with respect to the
module system, to guide people choosing which ones to read.

> I like it. Maybe place them in `share/examples/kmodules'?

share/examples/sys/modules would be better; kmodules is not the name of
a program in base and would be confusing to someone expecting examples
to be about programs in base.

There's already an example module in the kernel source tree, too.  I
don't follow why that just can't be improved.

Attachment: pgpnMzc6k50aN.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index