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 v12 2/8] module_cache: move module handling into own subsystem
Date: Sun, 24 Jan 2021 17:26:48 +0100 [thread overview]
Message-ID: <136716fc-7e19-6515-d18c-c0d3d0576a96@tarantool.org> (raw)
In-Reply-To: <20210118203556.281700-3-gorcunov@gmail.com>
Thanks for the patch!
See 4 comments below.
On 18.01.2021 21:35, Cyrill Gorcunov wrote:
> The module handling should not be bound to particular
> function implementation (we will have two users: already
> existing functions for "_func" space, and a new upcoming
> one which will be serving cbox submodule in next patch).
1. It is now cmod, not cbox.
> For this sake all module related code is moved to
> module_cache file where we do symbol resolving, calling
> and tracking of symbol usage.
>
> Part-of #4642
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> diff --git a/src/box/module_cache.c b/src/box/module_cache.c
> new file mode 100644
> index 000000000..9fe316807
> --- /dev/null
> +++ b/src/box/module_cache.c
> @@ -0,0 +1,513 @@
> +/*
> + * SPDX-License-Identifier: BSD-2-Clause
> + *
> + * Copyright 2010-2021, Tarantool AUTHORS, please see AUTHORS file.
> + */
> +
> +#include <dlfcn.h>
> +#include <fcntl.h>
> +#include <stdlib.h>
> +#include <string.h>
> +
> +#include "assoc.h"
> +#include "diag.h"
> +#include "error.h"
> +#include "errinj.h"
> +#include "fiber.h"
> +#include "port.h"
> +
> +#include "box/error.h"
2. #include "error.h" and #include "box/error.h" are the same
files. Because you are in box/ folder.
> +#include "lua/utils.h"
> +#include "libeio/eio.h"
> +
> +#include "module_cache.h"
> +
> +/** Modules name to descriptor hash. */
> +static struct mh_strnptr_t *mod_hash = NULL;
> +
> +int
> +module_sym_load(struct module_sym *mod_sym)
> +{
> + assert(mod_sym->addr == NULL);
> +
> + struct func_name name;
> + func_split_name(mod_sym->name, &name);
> +
> + struct module *module = module_cache_find(name.package, name.package_end);
> + if (module == NULL) {
> + module = module_load(name.package, name.package_end);
> + if (module == NULL)
> + return -1;
> + if (module_cache_add(module) != 0) {
> + module_delete(module);
> + return -1;
> + }
> + }
> +
> + mod_sym->addr = module_sym(module, name.sym);
> + if (mod_sym->addr == NULL)
> + return -1;
3. Is it correct, that you second time has deleted the bugfix
which you did about module not being unloaded when first
symbol load fails?
> +
> + mod_sym->module = module;
> + rlist_add(&module->funcs_list, &mod_sym->item);
> + return 0;
> +}
> diff --git a/src/box/module_cache.h b/src/box/module_cache.h
> new file mode 100644
> index 000000000..fd789f603
> --- /dev/null
> +++ b/src/box/module_cache.h
> @@ -0,0 +1,139 @@
> +/*
> + * SPDX-License-Identifier: BSD-2-Clause
> + *
> + * Copyright 2010-2021, Tarantool AUTHORS, please see AUTHORS file.
> + */
> +
> +#pragma once
> +
> +#include <small/rlist.h>
4. Please, use "" instead of <> for non-system headers.
next prev parent reply other threads:[~2021-01-24 16:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 20:35 [Tarantool-patches] [PATCH v12 0/8] box: implement cmod Lua module Cyrill Gorcunov via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 1/8] box/func: factor out c function entry structure Cyrill Gorcunov via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 2/8] module_cache: move module handling into own subsystem Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:26 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-01-25 8:52 ` Cyrill Gorcunov via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 3/8] module_cache: improve naming Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:27 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-24 22:32 ` Cyrill Gorcunov via Tarantool-patches
2021-01-30 18:53 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-01 11:41 ` Cyrill Gorcunov via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 4/8] module_cache: direct update a cache value on reload Cyrill Gorcunov via Tarantool-patches
2021-01-19 12:46 ` Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:27 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-24 22:26 ` Cyrill Gorcunov via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 5/8] module_cache: rename calls to ref in module structure Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:27 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-25 10:29 ` Cyrill Gorcunov via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 6/8] module_cache: provide helpers to load and unload modules Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:28 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 7/8] box/cmod: implement cmod Lua module Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:28 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-25 16:50 ` Cyrill Gorcunov via Tarantool-patches
2021-01-30 18:53 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-18 20:35 ` [Tarantool-patches] [PATCH v12 8/8] test: box/cfunc -- add cmod test Cyrill Gorcunov via Tarantool-patches
2021-01-24 16:28 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-24 16:26 ` [Tarantool-patches] [PATCH v12 0/8] box: implement cmod Lua module 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=136716fc-7e19-6515-d18c-c0d3d0576a96@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=gorcunov@gmail.com \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v12 2/8] module_cache: move module handling into own 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