From 322a2dddba49d04539cc130cd2264a00db45c20d Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sat, 24 Feb 2018 20:21:21 +0000 Subject: [PATCH] lualoader: Clean up naming conventions a little bit We mostly use camel case for function names, but some local functions got mixed in using internal underscores. Doubles down on camel case. --- stand/lua/cli.lua | 8 ++++---- stand/lua/config.lua | 30 +++++++++++++++--------------- stand/lua/core.lua | 6 +++--- stand/lua/drawer.lua | 10 +++++----- stand/lua/menu.lua | 2 +- stand/lua/password.lua | 6 +++--- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index db17a8c195d6..116005e956d6 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -38,7 +38,7 @@ local cli = {} -- Defaults to nil and "" respectively. -- This will also parse arguments to autoboot, but the with_kernel argument -- will need to be explicitly overwritten to false -local function parse_boot_args(argv, with_kernel) +local function parseBootArgs(argv, with_kernel) if with_kernel == nil then with_kernel = true end @@ -95,17 +95,17 @@ end function cli.boot(...) local _, argv = cli.arguments(...) - local kernel, argstr = parse_boot_args(argv) + local kernel, argstr = parseBootArgs(argv) if kernel ~= nil then loader.perform("unload") - config.selectkernel(kernel) + config.selectKernel(kernel) end core.boot(argstr) end function cli.autoboot(...) local _, argv = cli.arguments(...) - local argstr = parse_boot_args(argv, false) + local argstr = parseBootArgs(argv, false) core.autoboot(argstr) end diff --git a/stand/lua/config.lua b/stand/lua/config.lua index a50a4560a1a7..2ec75ebe432f 100644 --- a/stand/lua/config.lua +++ b/stand/lua/config.lua @@ -124,7 +124,7 @@ pattern_table = { } } -local function read_file(name, silent) +local function readFile(name, silent) local f = io.open(name) if f == nil then if not silent then @@ -146,13 +146,13 @@ local function read_file(name, silent) return text end -local function check_nextboot() +local function checkNextboot() local nextboot_file = loader.getenv("nextboot_file") if nextboot_file == nil then return end - local text = read_file(nextboot_file, true) + local text = readFile(nextboot_file, true) if text == nil then return end @@ -169,7 +169,7 @@ local function check_nextboot() -- Attempt to rewrite the first line and only the first line of the -- nextboot_file. We overwrite it with nextboot_enable="NO", then - -- check for that on load. See: check_nextboot_enabled + -- check for that on load. See: checkNextboot_enabled -- It's worth noting that this won't work on every filesystem, so we -- won't do anything notable if we have any errors in this process. local nfile = io.open(nextboot_file, 'w') @@ -336,7 +336,7 @@ function config.processFile(name, silent) silent = false end - local text = read_file(name, silent) + local text = readFile(name, silent) if text == nil then return not silent end @@ -386,11 +386,11 @@ end -- other_kernel is optionally the name of a kernel to load, if not the default -- or autoloaded default from the module_path -function config.loadkernel(other_kernel) +function config.loadKernel(other_kernel) local flags = loader.getenv("kernel_options") or "" local kernel = other_kernel or loader.getenv("kernel") - local function try_load(names) + local function tryLoad(names) for name in names:gmatch("([^;]+)%s*;?") do local r = loader.perform("load " .. flags .. " " .. name) @@ -401,7 +401,7 @@ function config.loadkernel(other_kernel) return nil end - local function load_bootfile() + local function loadBootfile() local bootfile = loader.getenv("bootfile") -- append default kernel name @@ -411,12 +411,12 @@ function config.loadkernel(other_kernel) bootfile = bootfile .. ";kernel" end - return try_load(bootfile) + return tryLoad(bootfile) end -- kernel not set, try load from default module_path if kernel == nil then - local res = load_bootfile() + local res = loadBootfile() if res ~= nil then -- Default kernel is loaded @@ -441,7 +441,7 @@ function config.loadkernel(other_kernel) for _, v in pairs(paths) do loader.setenv("module_path", v) - res = load_bootfile() + res = loadBootfile() -- succeeded, add path to module_path if res ~= nil then @@ -456,7 +456,7 @@ function config.loadkernel(other_kernel) -- failed to load with ${kernel} as a directory -- try as a file - res = try_load(kernel) + res = tryLoad(kernel) if res ~= nil then config.kernel_loaded = kernel return true @@ -467,7 +467,7 @@ function config.loadkernel(other_kernel) end end -function config.selectkernel(kernel) +function config.selectKernel(kernel) config.kernel_selected = kernel end @@ -493,7 +493,7 @@ function config.load(file) end end - check_nextboot() + checkNextboot() -- Cache the provided module_path at load time for later use config.module_path = loader.getenv("module_path") @@ -511,7 +511,7 @@ function config.loadelf() local loaded print("Loading kernel...") - loaded = config.loadkernel(kernel) + loaded = config.loadKernel(kernel) if not loaded then print("Failed to load any kernel") diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 01a27a850dc9..fc9c322da3a6 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -33,7 +33,7 @@ local config = require("config") local core = {} -local function compose_loader_cmd(cmd_name, argstr) +local function composeLoaderCmd(cmd_name, argstr) if argstr ~= nil then cmd_name = cmd_name .. " " .. argstr end @@ -238,12 +238,12 @@ end function core.autoboot(argstr) config.loadelf() - loader.perform(compose_loader_cmd("autoboot", argstr)) + loader.perform(composeLoaderCmd("autoboot", argstr)) end function core.boot(argstr) config.loadelf() - loader.perform(compose_loader_cmd("boot", argstr)) + loader.perform(composeLoaderCmd("boot", argstr)) end function core.isSingleUserBoot() diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 0dabf9e8c851..0e82e3b80e03 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -45,7 +45,7 @@ local orb local none local none_shifted = false -local function menu_entry_name(drawing_menu, entry) +local function menuEntryName(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type] if name_handler ~= nil then @@ -57,7 +57,7 @@ local function menu_entry_name(drawing_menu, entry) return entry.name end -local function shift_brand_text(shift) +local function shiftBrandText(shift) drawer.brand_position.x = drawer.brand_position.x + shift.x drawer.brand_position.y = drawer.brand_position.y + shift.y drawer.menu_position.x = drawer.menu_position.x + shift.x @@ -288,7 +288,7 @@ function drawer.drawmenu(m) entry_num = entry_num + 1 screen.setcursor(x, y + effective_line_num) - print(entry_num .. ". " .. menu_entry_name(m, e)) + print(entry_num .. ". " .. menuEntryName(m, e)) -- fill the alias table alias_table[tostring(entry_num)] = e @@ -299,7 +299,7 @@ function drawer.drawmenu(m) end else screen.setcursor(x, y + effective_line_num) - print(menu_entry_name(m, e)) + print(menuEntryName(m, e)) end ::continue:: end @@ -379,7 +379,7 @@ function drawer.drawlogo() if logodef ~= nil and logodef.graphic == none then -- centre brand and text if no logo if not none_shifted then - shift_brand_text(logodef.shift) + shiftBrandText(logodef.shift) none_shifted = true end elseif logodef == nil or logodef.graphic == nil or diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index 6f09b3e1bca9..86cd709476ad 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -315,7 +315,7 @@ menu.welcome = { #all_choices .. ")" end, func = function(_, choice, _) - config.selectkernel(choice) + config.selectKernel(choice) end, alias = {"k", "K"} }, diff --git a/stand/lua/password.lua b/stand/lua/password.lua index e1325fd6359a..124ce5686349 100644 --- a/stand/lua/password.lua +++ b/stand/lua/password.lua @@ -65,7 +65,7 @@ function password.check() screen.clear() screen.defcursor() -- pwd is optionally supplied if we want to check it - local function do_prompt(prompt, pwd) + local function doPrompt(prompt, pwd) while true do loader.printc(prompt) local read_pwd = password.read() @@ -82,7 +82,7 @@ function password.check() if pwd == nil then return end - do_prompt(prompt, pwd) + doPrompt(prompt, pwd) end local boot_pwd = loader.getenv("bootlock_password") @@ -90,7 +90,7 @@ function password.check() local geli_prompt = loader.getenv("geom_eli_passphrase_prompt") if geli_prompt ~= nil and geli_prompt:lower() == "yes" then - local passphrase = do_prompt("GELI Passphrase: ") + local passphrase = doPrompt("GELI Passphrase: ") loader.setenv("kern.geom.eli.passphrase", passphrase) end