提交 f46dd18e 编写于 作者: L lifeng68

image: use isulad_daemon_config as module init args

Signed-off-by: Nlifeng68 <lifeng68@huawei.com>
上级 f8e6cb02
......@@ -1063,7 +1063,7 @@ static int isulad_server_init_common()
goto out;
}
if (image_module_init(args)) {
if (image_module_init(args->json_confs) != 0) {
ERROR("Failed to init image manager");
goto out;
}
......
......@@ -129,7 +129,6 @@ out:
return ret;
}
int embedded_merge_conf(const char *img_name, container_config *container_spec)
{
int ret = 0;
......@@ -155,11 +154,10 @@ int embedded_get_user_conf(const char *basefs, host_config *hc, const char *user
ERROR("Empty basefs or puser");
return -1;
}
return get_user("/", hc, userstr, puser);;
return get_user("/", hc, userstr, puser);
}
static int embedded_images_to_imagetool_images(struct db_all_images *all_images,
imagetool_images_list *list)
static int embedded_images_to_imagetool_images(struct db_all_images *all_images, imagetool_images_list *list)
{
int ret = 0;
size_t images_num = 0;
......@@ -314,8 +312,7 @@ int embedded_remove_image(const im_rmi_request *request)
}
if (strcmp(conts[i]->common_config->image, image_ref) == 0) {
ERROR("unable to remove image %s, container %s is using it",
image_ref, conts[i]->common_config->id);
ERROR("unable to remove image %s, container %s is using it", image_ref, conts[i]->common_config->id);
isulad_set_error_message("Image is in use");
ret = EIMAGEBUSY;
goto unref_continue;
......@@ -351,19 +348,17 @@ int embedded_inspect_image(const im_inspect_request *request, char **inspected_j
return lim_query_image_data(image_ref, IMAGE_DATA_TYPE_CONFIG, inspected_json, NULL);
}
int embedded_init(const struct service_arguments *args)
int embedded_init(const isulad_daemon_configs *args)
{
if (args == NULL) {
ERROR("Invalid image configs");
return -1;
}
return lim_init(args->json_confs->graph);
return lim_init(args->graph);
}
void embedded_exit()
{
db_common_finish();
}
......@@ -44,9 +44,8 @@ int embedded_inspect_image(const im_inspect_request *request, char **inspected_j
int embedded_load_image(const im_load_request *request);
int embedded_init(const struct service_arguments *args);
int embedded_init(const isulad_daemon_configs *args);
void embedded_exit();
#endif
......@@ -175,7 +175,7 @@ int ext_logout(const im_logout_request *request)
return 0;
}
int ext_init(const struct service_arguments *args)
int ext_init(const isulad_daemon_configs *args)
{
return 0;
}
......@@ -36,7 +36,6 @@ int ext_load_image(const im_load_request *request);
int ext_login(const im_login_request *request);
int ext_logout(const im_logout_request *request);
int ext_init(const struct service_arguments *args);
int ext_init(const isulad_daemon_configs *args);
#endif
......@@ -1745,7 +1745,7 @@ void free_im_export_request(im_export_request *ptr)
free(ptr);
}
static int bims_init(const struct service_arguments *args)
static int bims_init(const isulad_daemon_configs *args)
{
int ret = 0;
size_t i;
......@@ -1765,7 +1765,7 @@ static int bims_init(const struct service_arguments *args)
return ret;
}
int image_module_init(const struct service_arguments *args)
int image_module_init(const isulad_daemon_configs *args)
{
if (args == NULL) {
ERROR("Invalid input arguments");
......
......@@ -24,7 +24,7 @@
#include "isula_libutils/host_config.h"
#include "isula_libutils/container_config.h"
#include "libisulad.h"
#include "daemon_arguments.h"
#include "isula_libutils/isulad_daemon_configs.h"
#include "isula_libutils/container_inspect.h"
#include "isula_libutils/imagetool_images_list.h"
#include "isula_libutils/imagetool_fs_info.h"
......@@ -204,7 +204,7 @@ struct graphdriver_status {
};
struct bim_ops {
int (*init)(const struct service_arguments *args);
int (*init)(const isulad_daemon_configs *args);
void (*clean_resource)(void);
/* detect whether image is of this bim type */
......@@ -276,7 +276,7 @@ struct bim_type {
const struct bim_ops *ops;
};
int image_module_init(const struct service_arguments *args);
int image_module_init(const isulad_daemon_configs *args);
void image_module_exit();
......
......@@ -46,7 +46,7 @@ static char *format_driver_name(const char *driver)
}
}
static int storage_module_init_helper(const struct service_arguments *args)
static int storage_module_init_helper(const isulad_daemon_configs *args)
{
int ret = 0;
struct storage_module_init_options *storage_opts = NULL;
......@@ -58,29 +58,29 @@ static int storage_module_init_helper(const struct service_arguments *args)
goto out;
}
storage_opts->driver_name = format_driver_name(args->json_confs->storage_driver);
storage_opts->driver_name = format_driver_name(args->storage_driver);
if (storage_opts->driver_name == NULL) {
ERROR("Failed to get storage driver name");
ret = -1;
goto out;
}
storage_opts->storage_root = util_path_join(args->json_confs->graph, GRAPH_ROOTPATH_NAME);
storage_opts->storage_root = util_path_join(args->graph, GRAPH_ROOTPATH_NAME);
if (storage_opts->storage_root == NULL) {
ERROR("Failed to get storage root dir");
ret = -1;
goto out;
}
storage_opts->storage_run_root = util_path_join(args->json_confs->state, GRAPH_ROOTPATH_NAME);
storage_opts->storage_run_root = util_path_join(args->state, GRAPH_ROOTPATH_NAME);
if (storage_opts->storage_run_root == NULL) {
ERROR("Failed to get storage run root dir");
ret = -1;
goto out;
}
if (dup_array_of_strings((const char **)args->json_confs->storage_opts, args->json_confs->storage_opts_len,
&storage_opts->driver_opts, &storage_opts->driver_opts_len) != 0) {
if (dup_array_of_strings((const char **)args->storage_opts, args->storage_opts_len, &storage_opts->driver_opts,
&storage_opts->driver_opts_len) != 0) {
ERROR("Failed to get storage storage opts");
ret = -1;
goto out;
......@@ -110,7 +110,7 @@ static void cleanup_image_tmpdir()
return;
}
int oci_init(const struct service_arguments *args)
int oci_init(const isulad_daemon_configs *args)
{
int ret = 0;
......
......@@ -23,7 +23,7 @@
extern "C" {
#endif
int oci_init(const struct service_arguments *args);
int oci_init(const isulad_daemon_configs *args);
void oci_exit();
int oci_pull_rf(const im_pull_request *request, im_pull_response *response);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册