tech-kern archive

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

Re: lua(4), non-invasive and invasive parts



Am 28.12.2012 um 00:50 schrieb David Young <dyoung%pobox.com@localhost>:

> On Mon, Dec 24, 2012 at 10:43:03AM +0100, Marc Balmer wrote:
>> For such more invasive changes, I foresee to use a kernel option, 'options 
>> LUA' which will compile such code only when the option is enabled.  It will 
>> be commented out by default, besides maybe the ALL kernels.
> 
> Why not use a kernel module?

Using a kernel module is not possible in all cases.

When you call existing kernel functions from Lua, then it's "modules only":  
lua(4) is a module and the needed Lua binding to the software being called is 
also a kernel module.  The source code of the existing software does not need 
to be modified, which is why I call this scenario "non-invaisve".

If, however, existing software is to use Lua as part of its implementation, it 
needs to be made lua(4) aware, because it is going to use the lua(4) API. If 
the existing software is a kernel module, it needs to record a dependency on 
the lua(4) kernel module. The source code of software using lua(4) needs to be 
modified, which is why I called this scenario "invasive".  The "lua(4) aware" 
parts can be put into #ifdef LUA/#endif sections if a LUA configuration option 
is being used.

An example of the latter scenario is gpiosim(4), which could use Lua scripts to 
emulate I2C or 1-Wire devices.


Home | Main Index | Thread Index | Old Index