diff mbox series

Lua: expose get_tmpdirscripts() to Lua

Message ID 20180212152835.32413-1-christian.storm@siemens.com
State Accepted
Headers show
Series Lua: expose get_tmpdirscripts() to Lua | expand

Commit Message

Storm, Christian Feb. 12, 2018, 3:28 p.m. UTC
In order chain-call the 'bootloader' handler from a Lua
handler, get_tmpdirscripts() is needed in the Lua realm as
this is the directory where the bootloader handler expects
to find its input file.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 corelib/lua_interface.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Stefano Babic Feb. 12, 2018, 4:49 p.m. UTC | #1
Hi Christian,

On 12/02/2018 16:28, Christian Storm wrote:
> In order chain-call the 'bootloader' handler from a Lua
> handler, get_tmpdirscripts() is needed in the Lua realm as
> this is the directory where the bootloader handler expects
> to find its input file.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  corelib/lua_interface.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
> index 8875026..e96fbe6 100644
> --- a/corelib/lua_interface.c
> +++ b/corelib/lua_interface.c
> @@ -776,6 +776,12 @@ static int l_get_tmpdir(lua_State *L)
>  	lua_pushstring(L, get_tmpdir());
>  	return 1;
>  }
> +
> +static int l_get_tmpdir_scripts(lua_State *L)
> +{
> +	lua_pushstring(L, get_tmpdirscripts());
> +	return 1;
> +}
>  #endif
>  
>  /**
> @@ -803,6 +809,7 @@ static const luaL_Reg l_swupdate_bootenv[] = {
>  static const luaL_Reg l_swupdate_handler[] = {
>          { "register_handler", l_register_handler },
>          { "call_handler", l_call_handler },
> +        { "tmpdirscripts", l_get_tmpdir_scripts },
>          { "tmpdir", l_get_tmpdir },
>          { NULL, NULL }
>  };
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano
diff mbox series

Patch

diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
index 8875026..e96fbe6 100644
--- a/corelib/lua_interface.c
+++ b/corelib/lua_interface.c
@@ -776,6 +776,12 @@  static int l_get_tmpdir(lua_State *L)
 	lua_pushstring(L, get_tmpdir());
 	return 1;
 }
+
+static int l_get_tmpdir_scripts(lua_State *L)
+{
+	lua_pushstring(L, get_tmpdirscripts());
+	return 1;
+}
 #endif
 
 /**
@@ -803,6 +809,7 @@  static const luaL_Reg l_swupdate_bootenv[] = {
 static const luaL_Reg l_swupdate_handler[] = {
         { "register_handler", l_register_handler },
         { "call_handler", l_call_handler },
+        { "tmpdirscripts", l_get_tmpdir_scripts },
         { "tmpdir", l_get_tmpdir },
         { NULL, NULL }
 };