[syslinux] [PATCH 0/2] improve Lua API for files and initramfs objects
wferi at niif.hu
Thu Nov 10 01:01:02 PST 2016
"p.emmerich--- via Syslinux" <syslinux at zytor.com> writes:
> the new API for initramfs and files in master lacked the ability to build
> initramfs objects from files loaded via HTTP/TFTP in Lua.
Standard Lua file I/O should work for that. For example, I use
local function readAll (file)
local f = io.open ("/extlinux/" .. file)
if f == nil then return nil end
local content = f:read ("*a")
for reading configuration files from disk. Does it not work with HTTP/
TFTP for you? Using that, load_file could be implemented in Lua as:
function load_file (initrd, name, mkdir, mode)
local content = readAll (name)
initrd:add_file (name, content, mkdir, mode)
All in all, I can't see the need for new bindings for this task, but
maybe I miss something. At the same time, file:data() might
occasionally come useful.
> I've also changed the order of the do_mkdirs and mode arguments and changed
> the default of do_mkdirs to true (since that is more useful). This change
> is not backwards compatible, but it shouldn't be a big problem since the
> new API in the current master branch is not backwards compatible with the
> latest release anyways.
I've got no strong feelings about the argument order or backward
compatibility in the Lua bindings, though we shouldn't deliberately
break it more than necessary without adding some value in the process.
More information about the Syslinux