The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1dd350fce0aad85c559b962654f71d1449f21727

commit 1dd350fce0aad85c559b962654f71d1449f21727
Author:     Warner Losh <[email protected]>
AuthorDate: 2023-04-20 22:15:57 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2023-04-20 22:17:25 +0000

    makesyscalls.lua: Make more luaish
    
    x["y"] can be written as x.y, which looks better and is a more typical
    lua idiom.
    
    Sponsored by:           Netflix
    Reviewed by:            kevans
    Differential Revision:  https://reviews.freebsd.org/D39709
---
 sys/tools/makesyscalls.lua | 248 ++++++++++++++++++++++-----------------------
 1 file changed, 124 insertions(+), 124 deletions(-)

diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua
index ec79ae30d130..564551a47ed3 100644
--- a/sys/tools/makesyscalls.lua
+++ b/sys/tools/makesyscalls.lua
@@ -352,66 +352,66 @@ local function process_compat()
 
        nval = nval << 1
        for _, v in pairs(compat_options) do
-               if v["stdcompat"] ~= nil then
-                       local stdcompat = v["stdcompat"]
-                       v["definition"] = "COMPAT_" .. stdcompat:upper()
-                       v["compatlevel"] = 
tonumber(stdcompat:match("([0-9]+)$"))
-                       v["flag"] = stdcompat:gsub("FREEBSD", "COMPAT")
-                       v["prefix"] = stdcompat:lower() .. "_"
-                       v["descr"] = stdcompat:lower()
+               if v.stdcompat ~= nil then
+                       local stdcompat = v.stdcompat
+                       v.definition = "COMPAT_" .. stdcompat:upper()
+                       v.compatlevel = tonumber(stdcompat:match("([0-9]+)$"))
+                       v.flag = stdcompat:gsub("FREEBSD", "COMPAT")
+                       v.prefix = stdcompat:lower() .. "_"
+                       v.descr = stdcompat:lower()
                end
 
-               local tmpname = "sys" .. v["flag"]:lower()
+               local tmpname = "sys" .. v.flag:lower()
                local dcltmpname = tmpname .. "dcl"
                files[tmpname] = io.tmpfile()
                files[dcltmpname] = io.tmpfile()
-               v["tmp"] = tmpname
-               v["dcltmp"] = dcltmpname
+               v.tmp = tmpname
+               v.dcltmp = dcltmpname
 
-               known_flags[v["flag"]] = nval
-               v["mask"] = nval
+               known_flags[v.flag] = nval
+               v.mask = nval
                nval = nval << 1
 
-               v["count"] = 0
+               v.count = 0
        end
 end
 
 local function process_abi_flags()
-       local flags, mask = config["abi_flags"], 0
+       local flags, mask = config.abi_flags, 0
        for txtflag in flags:gmatch("([^|]+)") do
                if known_abi_flags[txtflag] == nil then
                        abort(1, "Unknown abi_flag: " .. txtflag)
                end
 
-               mask = mask | known_abi_flags[txtflag]["value"]
+               mask = mask | known_abi_flags[txtflag].value
        end
 
-       config["abi_flags_mask"] = mask
+       config.abi_flags_mask = mask
 end
 
 local function process_obsol()
-       local obsol = config["obsol"]
+       local obsol = config.obsol
        for syscall in obsol:gmatch("([^ ]+)") do
-               config["obsol_dict"][syscall] = true
+               config.obsol_dict[syscall] = true
        end
 end
 
 local function process_unimpl()
-       local unimpl = config["unimpl"]
+       local unimpl = config.unimpl
        for syscall in unimpl:gmatch("([^ ]+)") do
-               config["unimpl_dict"][syscall] = true
+               config.unimpl_dict[syscall] = true
        end
 end
 
 local function process_syscall_abi_change()
-       local changes_abi = config["syscall_abi_change"]
+       local changes_abi = config.syscall_abi_change
        for syscall in changes_abi:gmatch("([^ ]+)") do
-               config["sys_abi_change"][syscall] = true
+               config.sys_abi_change[syscall] = true
        end
 
-       local no_changes = config["syscall_no_abi_change"]
+       local no_changes = config.syscall_no_abi_change
        for syscall in no_changes:gmatch("([^ ]+)") do
-               config["sys_no_abi_change"][syscall] = true
+               config.sys_no_abi_change[syscall] = true
        end
 end
 
@@ -420,11 +420,11 @@ local function abi_changes(name)
                abort(1, "abi_changes: unknown flag: " .. name)
        end
 
-       return config["abi_flags_mask"] & known_abi_flags[name]["value"] ~= 0
+       return config.abi_flags_mask & known_abi_flags[name].value ~= 0
 end
 
 local function strip_abi_prefix(funcname)
-       local abiprefix = config["abi_func_prefix"]
+       local abiprefix = config.abi_func_prefix
        local stripped_name
        if funcname == nil then
                return nil
@@ -469,7 +469,7 @@ end
 -- to work both before and after the substitution
 local function isptrtype(type)
        return type:find("*") or type:find("caddr_t") or
-           type:find("intptr_t") or type:find(config['abi_intptr_t'])
+           type:find("intptr_t") or type:find(config.abi_intptr_t)
 end
 
 local function isptrarraytype(type)
@@ -486,7 +486,7 @@ local process_syscall_def
 -- These patterns are processed in order on any line that isn't empty.
 local pattern_table = {
        {
-               pattern = "%s*$" .. config['os_id_keyword'],
+               pattern = "%s*$" .. config.os_id_keyword,
                process = function(_, _)
                        -- Ignore... ID tag
                end,
@@ -521,8 +521,8 @@ local pattern_table = {
                dump_prevline = true,
                pattern = "%%ABI_HEADERS%%",
                process = function()
-                       if config['abi_headers'] ~= "" then
-                               line = config['abi_headers'] .. "\n"
+                       if config.abi_headers ~= "" then
+                               line = config.abi_headers .. "\n"
                                write_line('sysinc', line)
                        end
                end,
@@ -572,9 +572,9 @@ local function process_sysfile(file)
        local function do_match(nextline, prevline)
                local pattern, handler, dump
                for _, v in pairs(pattern_table) do
-                       pattern = v['pattern']
-                       handler = v['process']
-                       dump = v['dump_prevline']
+                       pattern = v.pattern
+                       handler = v.process
+                       dump = v.dump_prevline
                        if nextline:match(pattern) then
                                if dump and prevline then
                                        process_syscall_def(prevline)
@@ -648,7 +648,7 @@ end
 
 local function check_abi_changes(arg)
        for k, v in pairs(known_abi_flags) do
-               local exprs = v["exprs"]
+               local exprs = v.exprs
                if abi_changes(k) and exprs ~= nil then
                        for _, e in pairs(exprs) do
                                if arg:find(e) then
@@ -684,26 +684,26 @@ local function process_args(args)
                -- is removed
                changes_abi = changes_abi or (abi_changes("pair_64bit") and 
is64bittype(argtype))
 
-               argtype = argtype:gsub("intptr_t", config["abi_intptr_t"])
-               argtype = argtype:gsub("semid_t", config["abi_semid_t"])
+               argtype = argtype:gsub("intptr_t", config.abi_intptr_t)
+               argtype = argtype:gsub("semid_t", config.abi_semid_t)
                if isptrtype(argtype) then
-                       argtype = argtype:gsub("size_t", config["abi_size_t"])
-                       argtype = argtype:gsub("^long", config["abi_long"]);
-                       argtype = argtype:gsub("^u_long", config["abi_u_long"]);
-                       argtype = argtype:gsub("^const u_long", "const " .. 
config["abi_u_long"]);
+                       argtype = argtype:gsub("size_t", config.abi_size_t)
+                       argtype = argtype:gsub("^long", config.abi_long);
+                       argtype = argtype:gsub("^u_long", config.abi_u_long);
+                       argtype = argtype:gsub("^const u_long", "const " .. 
config.abi_u_long);
                elseif argtype:find("^long$") then
-                       argtype = config["abi_long"]
+                       argtype = config.abi_long
                end
-               if isptrarraytype(argtype) and config["abi_ptr_array_t"] ~= "" 
then
+               if isptrarraytype(argtype) and config.abi_ptr_array_t ~= "" then
                        -- `* const *` -> `**`
                        argtype = argtype:gsub("[*][ ]*const[ ]*[*]", "**")
                        -- e.g., `struct aiocb **` -> `uint32_t *`
-                       argtype = argtype:gsub("[^*]*[*]", 
config["abi_ptr_array_t"] .. " ", 1)
+                       argtype = argtype:gsub("[^*]*[*]", 
config.abi_ptr_array_t .. " ", 1)
                end
 
                -- XX TODO: Forward declarations? See: sysstubfwd in CheriBSD
                if arg_abi_change then
-                       local abi_type_suffix = config["abi_type_suffix"]
+                       local abi_type_suffix = config.abi_type_suffix
                        argtype = argtype:gsub("(struct [^ ]*)", "%1" ..
                            abi_type_suffix)
                        argtype = argtype:gsub("(union [^ ]*)", "%1" ..
@@ -741,9 +741,9 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
     auditev, syscallret, funcname, funcalias, funcargs, argalias)
        local argssize
 
-       if flags & known_flags["SYSMUX"] ~= 0 then
+       if flags & known_flags.SYSMUX ~= 0 then
                argssize = "0"
-       elseif #funcargs > 0 or flags & known_flags["NODEF"] ~= 0 then
+       elseif #funcargs > 0 or flags & known_flags.NODEF ~= 0 then
                argssize = "AS(" .. argalias .. ")"
        else
                argssize = "0"
@@ -762,7 +762,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
        case %d:
 ]], funcname, sysnum))
 
-       if #funcargs > 0 and flags & known_flags["SYSMUX"] == 0 then
+       if #funcargs > 0 and flags & known_flags.SYSMUX == 0 then
                write_line("systracetmp", "\t\tswitch (ndx) {\n")
                write_line("systrace", string.format(
                    "\t\tstruct %s *p = params;\n", argalias))
@@ -771,8 +771,8 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
                local argtype, argname, desc, padding
                padding = ""
                for idx, arg in ipairs(funcargs) do
-                       argtype = arg["type"]
-                       argname = arg["name"]
+                       argtype = arg.type
+                       argname = arg.name
 
                        argtype = trim(argtype:gsub("__restrict$", ""), nil)
                        if argtype == "int" and argname == "_pad" and 
abi_changes("pair_64bit") then
@@ -795,7 +795,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
                        if isptrtype(argtype) then
                                write_line("systrace", string.format(
                                    "\t\tuarg[a++] = (%s)p->%s; /* %s */\n",
-                                   config["ptr_intptr_t_cast"],
+                                   config.ptr_intptr_t_cast,
                                    argname, argtype))
                        elseif argtype == "union l_semun" then
                                write_line("systrace", string.format(
@@ -831,7 +831,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
 ]], syscallret))
        end
        local n_args = #funcargs
-       if flags & known_flags["SYSMUX"] ~= 0 then
+       if flags & known_flags.SYSMUX ~= 0 then
                n_args = 0
        end
        write_line("systrace", string.format(
@@ -844,7 +844,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
                        write_line("sysarg", string.format("struct %s {\n",
                            argalias))
                        for _, v in ipairs(funcargs) do
-                               local argname, argtype = v["name"], v["type"]
+                               local argname, argtype = v.name, v.type
                                if argtype == "int" and argname == "_pad" and 
abi_changes("pair_64bit") then
                                        write_line("sysarg", "#ifdef 
PAD64_REQUIRED\n")
                                end
@@ -879,20 +879,20 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
                end
                write_line("sysdcl", ";\n")
                write_line("sysaue", string.format("#define\t%sAUE_%s\t%s\n",
-                   config['syscallprefix'], funcalias, auditev))
+                   config.syscallprefix, funcalias, auditev))
        end
 
        write_line("sysent",
            string.format("\t{ .sy_narg = %s, .sy_call = (sy_call_t *)", 
argssize))
        local column = 8 + 2 + #argssize + 15
 
-       if flags & known_flags["SYSMUX"] ~= 0 then
+       if flags & known_flags.SYSMUX ~= 0 then
                write_line("sysent", string.format(
                    "nosys, .sy_auevent = AUE_NULL, " ..
                    ".sy_flags = %s, .sy_thrcnt = SY_THR_STATIC },",
                    sysflags))
                column = column + #"nosys" + #"AUE_NULL" + 3
-       elseif flags & known_flags["NOSTD"] ~= 0 then
+       elseif flags & known_flags.NOSTD ~= 0 then
                write_line("sysent", string.format(
                    "lkmressys, .sy_auevent = AUE_NULL, " ..
                    ".sy_flags = %s, .sy_thrcnt = SY_THR_ABSENT },",
@@ -920,9 +920,9 @@ local function handle_noncompat(sysnum, thr_flag, flags, 
sysflags, rettype,
        write_line("sysnames", string.format("\t\"%s\",\t\t\t/* %d = %s */\n",
            funcalias, sysnum, funcalias))
 
-       if flags & known_flags["NODEF"] == 0 then
+       if flags & known_flags.NODEF == 0 then
                write_line("syshdr", string.format("#define\t%s%s\t%d\n",
-                   config['syscallprefix'], funcalias, sysnum))
+                   config.syscallprefix, funcalias, sysnum))
                write_line("sysmk", string.format(" \\\n\t%s.o",
                    funcalias))
        end
@@ -947,36 +947,36 @@ local function handle_compat(sysnum, thr_flag, flags, 
sysflags, rettype,
     auditev, funcname, funcalias, funcargs, argalias)
        local argssize, out, outdcl, wrap, prefix, descr
 
-       if #funcargs > 0 or flags & known_flags["NODEF"] ~= 0 then
+       if #funcargs > 0 or flags & known_flags.NODEF ~= 0 then
                argssize = "AS(" .. argalias .. ")"
        else
                argssize = "0"
        end
 
        for _, v in pairs(compat_options) do
-               if flags & v["mask"] ~= 0 then
-                       if config["mincompat"] > v["compatlevel"] then
+               if flags & v.mask ~= 0 then
+                       if config.mincompat > v.compatlevel then
                                funcname = strip_abi_prefix(funcname)
-                               funcname = v["prefix"] .. funcname
+                               funcname = v.prefix .. funcname
                                return handle_obsol(sysnum, funcname, funcname)
                        end
-                       v["count"] = v["count"] + 1
-                       out = v["tmp"]
-                       outdcl = v["dcltmp"]
-                       wrap = v["flag"]:lower()
-                       prefix = v["prefix"]
-                       descr = v["descr"]
+                       v.count = v.count + 1
+                       out = v.tmp
+                       outdcl = v.dcltmp
+                       wrap = v.flag:lower()
+                       prefix = v.prefix
+                       descr = v.descr
                        goto compatdone
                end
        end
 
        ::compatdone::
        local dprotoflags = get_mask({"NOPROTO", "NODEF"})
-       local nargflags = dprotoflags | known_flags["NOARGS"]
+       local nargflags = dprotoflags | known_flags.NOARGS
        if #funcargs > 0 and flags & nargflags == 0 then
                write_line(out, string.format("struct %s {\n", argalias))
                for _, v in ipairs(funcargs) do
-                       local argname, argtype = v["name"], v["type"]
+                       local argname, argtype = v.name, v.type
                        write_line(out, string.format(
                            "\tchar %s_l_[PADL_(%s)]; %s %s; char 
%s_r_[PADR_(%s)];\n",
                            argname, argtype,
@@ -993,11 +993,11 @@ local function handle_compat(sysnum, thr_flag, flags, 
sysflags, rettype,
                    "%s\t%s%s(struct thread *, struct %s *);\n",
                    rettype, prefix, funcname, argalias))
                write_line("sysaue", string.format(
-                   "#define\t%sAUE_%s%s\t%s\n", config['syscallprefix'],
+                   "#define\t%sAUE_%s%s\t%s\n", config.syscallprefix,
                    prefix, funcname, auditev))
        end
 
-       if flags & known_flags['NOSTD'] ~= 0 then
+       if flags & known_flags.NOSTD ~= 0 then
                write_line("sysent", string.format(
                    "\t{ .sy_narg = %s, .sy_call = (sy_call_t *)%s, " ..
                    ".sy_auevent = %s, .sy_flags = 0, " ..
@@ -1024,9 +1024,9 @@ local function handle_compat(sysnum, thr_flag, flags, 
sysflags, rettype,
                write_line("syshdr", string.format(
                    "\t\t\t\t/* %d is %s %s */\n",
                    sysnum, descr, funcalias))
-       elseif flags & known_flags["NODEF"] == 0 then
+       elseif flags & known_flags.NODEF == 0 then
                write_line("syshdr", string.format("#define\t%s%s%s\t%d\n",
-                   config['syscallprefix'], prefix, funcalias, sysnum))
+                   config.syscallprefix, prefix, funcalias, sysnum))
                write_line("sysmk", string.format(" \\\n\t%s%s.o",
                    prefix, funcalias))
        end
@@ -1104,7 +1104,7 @@ process_syscall_def = function(line)
                abort(1, "Range only allowed with RESERVED and UNIMPL: " .. 
line)
        end
 
-       if (flags & known_flags["NOTSTATIC"]) ~= 0 then
+       if (flags & known_flags.NOTSTATIC) ~= 0 then
                thr_flag = "SY_THR_ABSENT"
        end
 
@@ -1195,37 +1195,37 @@ process_syscall_def = function(line)
 
        funcname = trim(funcname)
 
-       if config["obsol_dict"][funcname] then
+       if config.obsol_dict[funcname] then
                local compat_prefix = ""
                for _, v in pairs(compat_options) do
-                       if flags & v["mask"] ~= 0 then
-                               compat_prefix = v["prefix"]
+                       if flags & v.mask ~= 0 then
+                               compat_prefix = v.prefix
                                goto obsol_compat_done
                        end
                end
                ::obsol_compat_done::
                args = nil
-               flags = known_flags['OBSOL']
+               flags = known_flags.OBSOL
                funcomment = compat_prefix .. funcname
        end
-       if config["unimpl_dict"][funcname] then
-               flags = known_flags['UNIMPL']
+       if config.unimpl_dict[funcname] then
+               flags = known_flags.UNIMPL
                funcomment = funcname
        end
 
        sysflags = "0"
 
        -- NODEF events do not get audited
-       if flags & known_flags['NODEF'] ~= 0 then
+       if flags & known_flags.NODEF ~= 0 then
                auditev = 'AUE_NULL'
        end
 
        -- If applicable; strip the ABI prefix from the name
        local stripped_name = strip_abi_prefix(funcname)
 
-       if flags & known_flags['CAPENABLED'] ~= 0 or
-           config["capenabled"][funcname] ~= nil or
-           config["capenabled"][stripped_name] ~= nil then
+       if flags & known_flags.CAPENABLED ~= 0 or
+           config.capenabled[funcname] ~= nil or
+           config.capenabled[stripped_name] ~= nil then
                sysflags = "SYF_CAPENABLED"
        end
 
@@ -1234,17 +1234,17 @@ process_syscall_def = function(line)
        if args ~= nil then
                funcargs, changes_abi = process_args(args)
        end
-       if config["sys_no_abi_change"][funcname] then
+       if config.sys_no_abi_change[funcname] then
                changes_abi = false
        end
-       local noproto = config["abi_flags"] ~= "" and not changes_abi
+       local noproto = config.abi_flags ~= "" and not changes_abi
 
        local argprefix = ''
        local funcprefix = ''
        if abi_changes("pointer_args") then
                for _, v in ipairs(funcargs) do
-                       if isptrtype(v["type"]) then
-                               if config["sys_no_abi_change"][funcname] then
+                       if isptrtype(v.type) then
+                               if config.sys_no_abi_change[funcname] then
                                        print("WARNING: " .. funcname ..
                                            " in syscall_no_abi_change, but 
pointers args are present")
                                end
@@ -1254,14 +1254,14 @@ process_syscall_def = function(line)
                end
                ::ptrfound::
        end
-       if config["sys_abi_change"][funcname] then
+       if config.sys_abi_change[funcname] then
                changes_abi = true
        end
        if changes_abi then
                -- argalias should be:
                --   COMPAT_PREFIX + ABI Prefix + funcname
-               argprefix = config['abi_func_prefix']
-               funcprefix = config['abi_func_prefix']
+               argprefix = config.abi_func_prefix
+               funcprefix = config.abi_func_prefix
                funcalias = funcprefix .. funcname
                noproto = false
        end
@@ -1275,11 +1275,11 @@ process_syscall_def = function(line)
        if argalias == nil and funcname ~= nil then
                argalias = funcname .. "_args"
                for _, v in pairs(compat_options) do
-                       local mask = v["mask"]
+                       local mask = v.mask
                        if (flags & mask) ~= 0 then
                                -- Multiple aliases doesn't seem to make
                                -- sense.
-                               argalias = v["prefix"] .. argalias
+                               argalias = v.prefix .. argalias
                                goto out
                        end
                end
@@ -1291,17 +1291,17 @@ process_syscall_def = function(line)
        local ncompatflags = get_mask({"STD", "NODEF", "NOARGS", "NOPROTO",
            "NOSTD"})
        local compatflags = get_mask_pat("COMPAT.*")
-       if noproto or flags & known_flags["SYSMUX"] ~= 0 then
-               flags = flags | known_flags["NOPROTO"];
+       if noproto or flags & known_flags.SYSMUX ~= 0 then
+               flags = flags | known_flags.NOPROTO;
        end
-       if flags & known_flags["OBSOL"] ~= 0 then
+       if flags & known_flags.OBSOL ~= 0 then
                handle_obsol(sysnum, funcname, funcomment)
-       elseif flags & known_flags["RESERVED"] ~= 0 then
+       elseif flags & known_flags.RESERVED ~= 0 then
                handle_reserved(sysnum, sysstart, sysend)
-       elseif flags & known_flags["UNIMPL"] ~= 0 then
+       elseif flags & known_flags.UNIMPL ~= 0 then
                handle_unimpl(sysnum, sysstart, sysend, funcomment)
        elseif flags & compatflags ~= 0 then
-               if flags & known_flags['STD'] ~= 0 then
+               if flags & known_flags.STD ~= 0 then
                        abort(1, "Incompatible COMPAT/STD: " .. line)
                end
                handle_compat(sysnum, thr_flag, flags, sysflags, rettype,
@@ -1342,7 +1342,7 @@ if configfile ~= nil then
        end
 end
 
-local compat_set = config['compat_set']
+local compat_set = config.compat_set
 if compat_set ~= "" then
        if not compat_option_sets[compat_set] then
                abort(1, "Undefined compat set: " .. compat_set)
@@ -1354,18 +1354,18 @@ else
 end
 
 -- We ignore errors here if we're relying on the default configuration.
-if not config_modified["capenabled"] then
-       config["capenabled"] = grab_capenabled(config['capabilities_conf'],
-           config_modified["capabilities_conf"] == nil)
-elseif config["capenabled"] ~= "" then
+if not config_modified.capenabled then
+       config.capenabled = grab_capenabled(config.capabilities_conf,
+           config_modified.capabilities_conf == nil)
+elseif config.capenabled ~= "" then
        -- Due to limitations in the config format mostly, we'll have a comma
        -- separated list.  Parse it into lines
        local capenabled = {}
-       -- print("here: " .. config["capenabled"])
-       for sysc in config["capenabled"]:gmatch("([^,]+)") do
+       -- print("here: " .. config.capenabled)
+       for sysc in config.capenabled:gmatch("([^,]+)") do
                capenabled[sysc] = true
        end
-       config["capenabled"] = capenabled
+       config.capenabled = capenabled
 end
 process_compat()
 process_abi_flags()
@@ -1403,7 +1403,7 @@ write_line("sysent", string.format([[
 
 /* The casts are bogus but will do for now. */
 struct sysent %s[] = {
-]], config['switchname']))
+]], config.switchname))
 
 write_line("syssw", string.format([[/*
  * System call switch table.
@@ -1412,7 +1412,7 @@ write_line("syssw", string.format([[/*
  * $%s$
  */
 
-]], generated_tag, config['os_id_keyword']))
+]], generated_tag, config.os_id_keyword))
 
 write_line("sysarg", string.format([[/*
  * System call prototypes.
@@ -1450,8 +1450,8 @@ struct thread;
 #define        PADR_(t)        0
 #endif
 
-]], generated_tag, config['os_id_keyword'], config['sysproto_h'],
-    config['sysproto_h']))
+]], generated_tag, config.os_id_keyword, config.sysproto_h,
+    config.sysproto_h))
 if abi_changes("pair_64bit") then
        write_line("sysarg", string.format([[
 #if !defined(PAD64_REQUIRED) && !defined(__amd64__)
@@ -1467,7 +1467,7 @@ if abi_changes("pair_64bit") then
 ]]))
 end
 for _, v in pairs(compat_options) do
-       write_line(v["tmp"], string.format("\n#ifdef %s\n\n", v["definition"]))
+       write_line(v.tmp, string.format("\n#ifdef %s\n\n", v.definition))
 end
 
 write_line("sysnames", string.format([[/*
@@ -1478,7 +1478,7 @@ write_line("sysnames", string.format([[/*
  */
 
 const char *%s[] = {
-]], generated_tag, config['os_id_keyword'], config['namesname']))
+]], generated_tag, config.os_id_keyword, config.namesname))
 
 write_line("syshdr", string.format([[/*
  * System call numbers.
@@ -1487,12 +1487,12 @@ write_line("syshdr", string.format([[/*
  * $%s$
  */
 
-]], generated_tag, config['os_id_keyword']))
+]], generated_tag, config.os_id_keyword))
 
 write_line("sysmk", string.format([[# FreeBSD system call object files.
 # DO NOT EDIT-- this file is automatically %s.
 # $%s$
-MIASM = ]], generated_tag, config['os_id_keyword']))
+MIASM = ]], generated_tag, config.os_id_keyword))
 
 write_line("systrace", string.format([[/*
  * System call argument to DTrace register array converstion.
@@ -1508,7 +1508,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, 
int *n_args)
        int64_t *iarg = (int64_t *)uarg;
        int a = 0;
        switch (sysnum) {
-]], generated_tag, config['os_id_keyword']))
+]], generated_tag, config.os_id_keyword))
 
 write_line("systracetmp", [[static void
 systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
@@ -1533,7 +1533,7 @@ write_line("sysinc",
     "\n#define AS(name) (sizeof(struct name) / sizeof(syscallarg_t))\n")
 
 for _, v in pairs(compat_options) do
-       if v["count"] > 0 then
+       if v.count > 0 then
                write_line("sysinc", string.format([[
 
 #ifdef %s
@@ -1541,11 +1541,11 @@ for _, v in pairs(compat_options) do
 #else
 #define %s(n, name) .sy_narg = 0, .sy_call = (sy_call_t *)nosys
 #endif
-]], v["definition"], v["flag"]:lower(), v["prefix"], v["flag"]:lower()))
+]], v.definition, v.flag:lower(), v.prefix, v.flag:lower()))
        end
 
-       write_line(v["dcltmp"], string.format("\n#endif /* %s */\n\n",
-           v["definition"]))
+       write_line(v.dcltmp, string.format("\n#endif /* %s */\n\n",
+           v.definition))
 end
 
 write_line("sysprotoend", string.format([[
@@ -1555,14 +1555,14 @@ write_line("sysprotoend", string.format([[
 #undef PADR_
 
 #endif /* !%s */
-]], config["sysproto_h"]))
+]], config.sysproto_h))
 
 write_line("sysmk", "\n")
 write_line("sysent", "};\n")
 write_line("sysnames", "};\n")
 -- maxsyscall is the highest seen; MAXSYSCALL should be one higher
 write_line("syshdr", string.format("#define\t%sMAXSYSCALL\t%d\n",
-    config["syscallprefix"], maxsyscall + 1))
+    config.syscallprefix, maxsyscall + 1))
 write_line("systrace", [[
        default:
                *n_args = 0;
@@ -1596,8 +1596,8 @@ write_line("syssw", read_file("sysent"))
 write_line("sysproto", read_file("sysarg"))
 write_line("sysproto", read_file("sysdcl"))
 for _, v in pairs(compat_options) do
-       write_line("sysproto", read_file(v["tmp"]))
-       write_line("sysproto", read_file(v["dcltmp"]))
+       write_line("sysproto", read_file(v.tmp))
+       write_line("sysproto", read_file(v.dcltmp))
 end
 write_line("sysproto", read_file("sysaue"))
 write_line("sysproto", read_file("sysprotoend"))

Reply via email to