Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
	tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v19 2/6] box/func: prepare for transition to modules subsystem
Date: Mon, 8 Mar 2021 23:44:08 +0100	[thread overview]
Message-ID: <d72eec34-0797-5fa5-f014-eb87461a59c7@tarantool.org> (raw)
In-Reply-To: <20210301212343.422372-3-gorcunov@gmail.com>

Hi! Thanks for the patch!

See 4 comments below.

> diff --git a/src/box/call.c b/src/box/call.c
> index 7839e1f3e..4b1893f12 100644
> --- a/src/box/call.c
> +++ b/src/box/call.c
> @@ -116,7 +116,7 @@ static const struct port_vtab port_msgpack_vtab = {
>  };
>  
>  int
> -box_module_reload(const char *name)
> +box_process_module_reload(const char *name)

1. The name is ugly. I propose to merge this function into
box_module_reload(). The latter is never used from anywhere
except this 'process' thing.

>  {
>  	struct credentials *credentials = effective_user();
>  	if ((credentials->universal_access & (PRIV_X | PRIV_U)) !=
> diff --git a/src/box/func.c b/src/box/func.c
> index 233696a4f..88903f40e 100644
> --- a/src/box/func.c
> +++ b/src/box/func.c
> @@ -71,7 +71,7 @@ struct func_c {
>  	 * Each stored function keeps a handle to the
>  	 * dynamic library for the C callback.
>  	 */
> -	struct module *module;
> +	struct box_module *bxmod;

2. What was wrong with the old member name? Especially in
the functions. It just significantly increases the diff, ruins
the history, and does not change readability anyhow. The old
name was even better IMO.

>  };
>  
>  /***
> @@ -166,61 +166,65 @@ module_find(const char *package, const char *package_end, char *path,
>  	return 0;
>  }
>  
> -static struct mh_strnptr_t *modules = NULL;
> +static struct mh_strnptr_t *box_module_hash = NULL;

3. The same question. 'modules' was just fine. Diff is
significantly bigger because most of such renames are not
needed at all. You only need to rename the struct. It was
module, and stayed module. Just a new prefix is added to
the struct name and its methods.

> @@ -484,23 +488,23 @@ func_c_new(MAYBE_UNUSED struct func_def *def)
>  	}
>  	func->base.vtab = &func_c_vtab;
>  	func->func = NULL;
> -	func->module = NULL;
> +	func->bxmod = NULL;
>  	return &func->base;
>  }
>  
>  static void
>  func_c_unload(struct func_c *func)
>  {
> -	if (func->module) {
> +	if (func->bxmod) {

4. Since you changed this line, it should be != NULL now. But even better -
keep the old variable and struct member names. Then you wouldn't need to
change almost anything in this file except struct names.

>  		rlist_del(&func->item);
> -		if (rlist_empty(&func->module->funcs)) {
> +		if (rlist_empty(&func->bxmod->funcs)) {
>  			struct func_name name;
>  			func_split_name(func->base.def->name, &name);
> -			module_cache_del(name.package, name.package_end);
> +			cache_del(name.package, name.package_end);
>  		}
> -		module_gc(func->module);
> +		box_module_gc(func->bxmod);
>  	}
> -	func->module = NULL;
> +	func->bxmod = NULL;
>  	func->func = NULL;
>  }

  reply	other threads:[~2021-03-08 22:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 21:23 [Tarantool-patches] [PATCH v19 0/6] box: implement cmod Lua module Cyrill Gorcunov via Tarantool-patches
2021-03-01 21:23 ` [Tarantool-patches] [PATCH v19 1/6] box/func: module_reload -- drop redundant argument Cyrill Gorcunov via Tarantool-patches
2021-03-01 21:23 ` [Tarantool-patches] [PATCH v19 2/6] box/func: prepare for transition to modules subsystem Cyrill Gorcunov via Tarantool-patches
2021-03-08 22:44   ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-03-01 21:23 ` [Tarantool-patches] [PATCH v19 3/6] box/module_cache: introduce " Cyrill Gorcunov via Tarantool-patches
2021-03-08 22:45   ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 21:23 ` [Tarantool-patches] [PATCH v19 4/6] box/func: switch to module_cache interface Cyrill Gorcunov via Tarantool-patches
2021-03-08 22:47   ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 21:23 ` [Tarantool-patches] [PATCH v19 5/6] box/cmod: implement cmod Lua module Cyrill Gorcunov via Tarantool-patches
2021-03-08 22:51   ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 21:23 ` [Tarantool-patches] [PATCH v19 6/6] test: box/cfunc -- add cmod test Cyrill Gorcunov via Tarantool-patches
2021-03-08 22:51   ` Vladislav Shpilevoy via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d72eec34-0797-5fa5-f014-eb87461a59c7@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v19 2/6] box/func: prepare for transition to modules subsystem' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox