提交 058adb5b 编写于 作者: L lifeng68

refact: add api head files to api directory

Signed-off-by: Nlifeng68 <lifeng68@huawei.com>
上级 de229b28
......@@ -39,7 +39,7 @@
#endif
#include "constants.h"
#include "collector.h"
#include "events_collector_api.h"
#include "isulad_commands.h"
#include "isula_libutils/log.h"
#include "utils.h"
......@@ -49,13 +49,13 @@
#include "verify.h"
#include "service_common.h"
#include "callback.h"
#include "log_gather.h"
#include "log_gather_api.h"
#include "container_api.h"
#include "service_container.h"
#include "plugin.h"
#include "service_container_api.h"
#include "plugin_api.h"
#include "selinux_label.h"
#include "http.h"
#include "runtime.h"
#include "runtime_api.h"
#ifdef GRPC_CONNECTOR
#include "clibcni/api.h"
......
......@@ -26,8 +26,8 @@
#include "isula_libutils/log.h"
#include "utils.h"
#include "cri_helpers.h"
#include "event_sender.h"
#include "service_image.h"
#include "events_sender_api.h"
#include "service_image_api.h"
static void conv_image_to_grpc(const imagetool_image *element, std::unique_ptr<runtime::v1alpha2::Image> &image)
{
......
......@@ -43,15 +43,15 @@
#include "execution_stream.h"
#include "execution_create.h"
#include "io_handler.h"
#include "plugin.h"
#include "plugin_api.h"
#include "execution_network.h"
#include "runtime.h"
#include "runtime_api.h"
#include "specs_extend.h"
#include "utils.h"
#include "error.h"
#include "event_sender.h"
#include "specs.h"
#include "service_container.h"
#include "events_sender_api.h"
#include "specs_api.h"
#include "service_container_api.h"
static int filter_by_label(const container_t *cont, const container_get_id_request *request)
{
......
......@@ -32,20 +32,20 @@
#include "io_wrapper.h"
#include "isulad_config.h"
#include "config.h"
#include "specs.h"
#include "specs_api.h"
#include "verify.h"
#include "container_api.h"
#include "execution_network.h"
#include "runtime.h"
#include "plugin.h"
#include "runtime_api.h"
#include "plugin_api.h"
#include "image_api.h"
#include "utils.h"
#include "error.h"
#include "constants.h"
#include "namespace.h"
#include "event_sender.h"
#include "events_sender_api.h"
#include "sysinfo.h"
#include "service_container.h"
#include "service_container_api.h"
static int runtime_check(const char *name, bool *runtime_res)
{
......
......@@ -27,8 +27,8 @@
#include <sys/sysinfo.h>
#include "isula_libutils/log.h"
#include "event_sender.h"
#include "collector.h"
#include "events_sender_api.h"
#include "events_collector_api.h"
#include "io_wrapper.h"
#include "isulad_config.h"
#include "config.h"
......@@ -36,10 +36,10 @@
#include "verify.h"
#include "isula_libutils/container_inspect.h"
#include "container_api.h"
#include "service_container.h"
#include "service_container_api.h"
#include "sysinfo.h"
#include "specs.h"
#include "runtime.h"
#include "specs_api.h"
#include "runtime_api.h"
#include "filters.h"
#include "utils.h"
......
......@@ -37,11 +37,11 @@
#include "execution_information.h"
#include "sysinfo.h"
#include "runtime.h"
#include "runtime_api.h"
#include "list.h"
#include "utils.h"
#include "error.h"
#include "event_sender.h"
#include "events_sender_api.h"
static int container_version_cb(const container_version_request *request, container_version_response **response)
{
......@@ -928,11 +928,14 @@ static int dup_health_check_config(const container_config *src, container_inspec
dest->health_check->test[i] = util_strdup_s(src->healthcheck->test[i]);
dest->health_check->test_len++;
}
dest->health_check->interval = timeout_with_default(src->healthcheck->interval, DEFAULT_PROBE_INTERVAL);
dest->health_check->start_period = timeout_with_default(src->healthcheck->start_period, DEFAULT_START_PERIOD);
dest->health_check->timeout = timeout_with_default(src->healthcheck->timeout, DEFAULT_PROBE_TIMEOUT);
dest->health_check->retries = src->healthcheck->retries != 0 ? src->healthcheck->retries :
DEFAULT_PROBE_RETRIES;
dest->health_check->interval = (src->healthcheck->interval == 0) ? DEFAULT_PROBE_INTERVAL :
src->healthcheck->interval;
dest->health_check->start_period = (src->healthcheck->start_period == 0) ? DEFAULT_START_PERIOD :
src->healthcheck->start_period;
dest->health_check->timeout = (src->healthcheck->timeout == 0) ? DEFAULT_PROBE_TIMEOUT :
src->healthcheck->timeout;
dest->health_check->retries = (src->healthcheck->retries != 0) ? src->healthcheck->retries :
DEFAULT_PROBE_RETRIES;
dest->health_check->exit_on_unhealthy = src->healthcheck->exit_on_unhealthy;
}
......
......@@ -41,9 +41,9 @@
#include "error.h"
#include "isula_libutils/logger_json_file.h"
#include "constants.h"
#include "runtime.h"
#include "event_sender.h"
#include "service_container.h"
#include "runtime_api.h"
#include "events_sender_api.h"
#include "service_container_api.h"
#include "io_handler.h"
struct container_log_config {
......
......@@ -41,9 +41,9 @@
#include "error.h"
#include "isula_libutils/logger_json_file.h"
#include "constants.h"
#include "runtime.h"
#include "event_sender.h"
#include "service_container.h"
#include "runtime_api.h"
#include "events_sender_api.h"
#include "service_container_api.h"
static char *create_single_fifo(const char *statepath, const char *subpath, const char *stdflag)
{
......
......@@ -33,8 +33,8 @@
#include "isulad_config.h"
#include "mediatype.h"
#include "filters.h"
#include "event_sender.h"
#include "service_image.h"
#include "events_sender_api.h"
#include "service_image_api.h"
#ifdef ENABLE_OCI_IMAGE
#include "oci_common_operators.h"
#endif
......
......@@ -225,8 +225,6 @@ int dup_health_check_status(defs_health **dst, const defs_health *src);
void update_health_monitor(const char *container_id);
int64_t timeout_with_default(int64_t configured_value, int64_t default_value);
extern int supervisor_add_exit_monitor(int fd, const container_pid_t *pid_info, const char *name, const char *runtime);
extern char *exit_fifo_create(const char *cont_state_path);
......
......@@ -19,8 +19,8 @@
#include <pthread.h>
#include "map.h"
#include "specs.h" /* oci_runtime_spec */
#include "container_unix.h" /* container_t */
#include "specs_api.h" /* oci_runtime_spec */
#include "container_api.h" /* container_t */
/*
* returned int should means:
......@@ -32,14 +32,14 @@
* comment.
*/
#define PLUGIN_INIT_SKIP 0
#define PLUGIN_INIT_WITH_CONTAINER_RUNNING 1
#define PLUGIN_INIT_WITH_CONTAINER_ALL 2
#define PLUGIN_INIT_SKIP 0
#define PLUGIN_INIT_WITH_CONTAINER_RUNNING 1
#define PLUGIN_INIT_WITH_CONTAINER_ALL 2
#define PLUGIN_EVENT_CONTAINER_PRE_CREATE 1UL
#define PLUGIN_EVENT_CONTAINER_PRE_START (1UL << 1)
#define PLUGIN_EVENT_CONTAINER_POST_STOP (1UL << 2)
#define PLUGIN_EVENT_CONTAINER_POST_REMOVE (1UL << 3)
#define PLUGIN_EVENT_CONTAINER_PRE_CREATE 1UL
#define PLUGIN_EVENT_CONTAINER_PRE_START (1UL << 1)
#define PLUGIN_EVENT_CONTAINER_POST_STOP (1UL << 2)
#define PLUGIN_EVENT_CONTAINER_POST_REMOVE (1UL << 3)
typedef struct plugin_manifest {
uint64_t init_type;
......@@ -65,8 +65,8 @@ typedef struct plugin {
* more plugint_put() shall be called.
*/
plugin_t *plugin_new(const char *name, const char *addr);
void plugin_get(plugin_t *plugin); /* ref++ */
void plugin_put(plugin_t *plugin); /* ref-- */
void plugin_get(plugin_t *plugin); /* ref++ */
void plugin_put(plugin_t *plugin); /* ref-- */
int plugin_set_activated(plugin_t *plugin, bool activated, const char *errmsg);
int plugin_set_manifest(plugin_t *plugin, const plugin_manifest_t *manifest);
......@@ -74,8 +74,8 @@ bool plugin_is_watching(plugin_t *plugin, uint64_t pe);
typedef struct plugin_manager {
pthread_rwlock_t pm_rwlock;
map_t *np; /* name:plugin */
map_t *eps; /* watch_event:plugins */
map_t *np; /* name:plugin */
map_t *eps; /* watch_event:plugins */
} plugin_manager_t;
/*
......@@ -112,4 +112,3 @@ int plugin_event_container_post_remove(const container_t *cont);
int plugin_event_container_post_remove2(const char *cid, const oci_runtime_spec *oci);
#endif /* _PLUGIN_H_ */
......@@ -14,9 +14,7 @@
******************************************************************************/
#ifndef __ISULAD_SERVICE_CONTAINER_OPERATOR_H
#define __ISULAD_SERVICE_CONTAINER_OPERATOR_H
#include <pthread.h>
#include <semaphore.h>
#include "container_unix.h"
#include "container_api.h"
#ifdef __cplusplus
extern "C" {
......@@ -40,8 +38,6 @@ int set_container_to_removal(const container_t *cont);
int delete_container(container_t *cont, bool force);
int container_module_init(char **msg);
#ifdef __cplusplus
}
#endif
......
......@@ -26,20 +26,17 @@
extern "C" {
#endif
int merge_all_specs(host_config *host_spec,
const char *real_rootfs,
container_config_v2_common_config *v2_spec, oci_runtime_spec *oci_spec);
int merge_oci_cgroups_path(const char *id, oci_runtime_spec *oci_spec,
const host_config *host_spec);
int merge_all_specs(host_config *host_spec, const char *real_rootfs, container_config_v2_common_config *v2_spec,
oci_runtime_spec *oci_spec);
int merge_oci_cgroups_path(const char *id, oci_runtime_spec *oci_spec, const host_config *host_spec);
int merge_global_config(oci_runtime_spec *oci_spec);
oci_runtime_spec *load_oci_config(const char *rootpath, const char *name);
oci_runtime_spec *default_spec(bool system_container);
int merge_conf_cgroup(oci_runtime_spec *oci_spec, const host_config *host_spec);
int save_oci_config(const char *id, const char *rootpath, const oci_runtime_spec *oci_spec);
int parse_security_opt(const host_config *host_spec, bool *no_new_privileges,
char ***label_opts, size_t *label_opts_len,
char **seccomp_profile);
int parse_security_opt(const host_config *host_spec, bool *no_new_privileges, char ***label_opts,
size_t *label_opts_len, char **seccomp_profile);
int merge_share_namespace(oci_runtime_spec *oci_spec, const host_config *host_spec);
#ifdef __cplusplus
......@@ -47,4 +44,3 @@ int merge_share_namespace(oci_runtime_spec *oci_spec, const host_config *host_sp
#endif
#endif
......@@ -27,8 +27,8 @@
#include "container_events_handler.h"
#include "utils.h"
#include "container_api.h"
#include "service_container.h"
#include "plugin.h"
#include "service_container_api.h"
#include "plugin_api.h"
#include "restartmanager.h"
#include "health_check.h"
......
......@@ -23,9 +23,9 @@
#include "isula_libutils/container_garbage_config.h"
#include "isula_libutils/log.h"
#include "utils.h"
#include "service_container.h"
#include "service_container_api.h"
#include "container_api.h"
#include "runtime.h"
#include "runtime_api.h"
#include "restartmanager.h"
static containers_gc_t g_gc_containers;
......
......@@ -26,10 +26,10 @@
#include "utils.h"
#include "health_check.h"
#include "callback.h"
#include "service_container.h"
#include "service_container_api.h"
#include "isula_libutils/container_exec_request.h"
#include "isula_libutils/container_exec_response.h"
#include "log_gather.h"
#include "log_gather_api.h"
#include "container_state.h"
/* container state lock */
......@@ -147,15 +147,6 @@ void stop_health_checks(const char *container_id)
container_unref(cont);
}
// If configuredValue is zero, use defaultValue instead.
int64_t timeout_with_default(int64_t configured_value, int64_t default_value)
{
if (configured_value == 0) {
return default_value;
}
return configured_value;
}
/* health check manager free */
void health_check_manager_free(health_check_manager_t *health_check)
{
......@@ -357,8 +348,9 @@ static int handle_unhealthy_case(container_t *cont, const defs_health_log_elemen
health_status = get_health_status(cont->state);
if (strcmp(health_status, HEALTH_STARTING) == 0) {
int64_t start_period =
timeout_with_default(cont->common_config->config->healthcheck->start_period, DEFAULT_START_PERIOD);
int64_t start_period = (cont->common_config->config->healthcheck->start_period == 0) ?
DEFAULT_START_PERIOD :
cont->common_config->config->healthcheck->start_period;
int64_t first, last;
if (to_unix_nanos_from_str(cont->state->state->started_at, &first)) {
ERROR("Parse container started time failed: %s", cont->state->state->started_at);
......@@ -557,7 +549,8 @@ void *health_check_run(void *arg)
container_req->attach_stdin = false;
container_req->attach_stdout = true;
container_req->attach_stderr = true;
container_req->timeout = timeout_with_default(config->healthcheck->timeout, DEFAULT_PROBE_TIMEOUT) / Time_Second;
container_req->timeout =
((config->healthcheck->timeout == 0) ? DEFAULT_PROBE_TIMEOUT : config->healthcheck->timeout) / Time_Second;
container_req->container_id = util_strdup_s(cont->common_config->id);
container_req->argv = cmd_slice;
container_req->argv_len = util_array_len((const char **)cmd_slice);
......@@ -704,7 +697,9 @@ static void *health_check_monitor(void *arg)
ERROR("Failed to monitor start time stamp");
goto out;
}
probe_interval = timeout_with_default(cont->common_config->config->healthcheck->interval, DEFAULT_PROBE_INTERVAL);
probe_interval = (cont->common_config->config->healthcheck->interval == 0) ?
DEFAULT_PROBE_INTERVAL :
cont->common_config->config->healthcheck->interval;
set_monitor_idle_status(cont->health_check);
while (true) {
switch (get_health_check_monitor_state(cont->health_check)) {
......
......@@ -26,7 +26,8 @@
#include "isula_libutils/log.h"
#include "isulad_config.h"
#include "utils.h"
#include "service_container.h"
#include "service_container_api.h"
#include "container_unix.h"
#define backoffMultipulier 2U
// unit nanos
......
......@@ -28,8 +28,8 @@
#include "container_unix.h"
#include "error.h"
#include "image_api.h"
#include "runtime.h"
#include "service_container.h"
#include "runtime_api.h"
#include "service_container_api.h"
#include "restartmanager.h"
#include "health_check.h"
......
......@@ -22,9 +22,9 @@
#include "supervisor.h"
#include "mainloop.h"
#include "libisulad.h"
#include "event_sender.h"
#include "events_sender_api.h"
#include "containers_gc.h"
#include "service_container.h"
#include "service_container_api.h"
pthread_mutex_t g_supervisor_lock = PTHREAD_MUTEX_INITIALIZER;
struct epoll_descr g_supervisor_descr;
......
......@@ -27,7 +27,7 @@
#include "error.h"
#include "isula_libutils/log.h"
#include "collector.h"
#include "events_collector_api.h"
#include "monitord.h"
#include "isulad_config.h"
#include "libisulad.h"
......
......@@ -27,9 +27,9 @@
#include "monitord.h"
#include "mainloop.h"
#include "isulad_config.h"
#include "collector.h"
#include "events_collector_api.h"
#include "utils.h"
#include "event_sender.h"
#include "events_sender_api.h"
struct monitord_handler {
struct epoll_descr *pdescr;
......
......@@ -13,7 +13,7 @@
* Description: provide container collector definition
******************************************************************************/
#define _GNU_SOURCE
#include "event_sender.h"
#include "events_sender_api.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -78,13 +78,12 @@ int isulad_monitor_send_container_event(const char *name, runtime_state_t state,
{
int ret = 0;
struct monitord_msg msg = { .type = MONITORD_MSG_STATE,
.event_type = CONTAINER_EVENT,
.value = state,
.pid = -1,
.exit_code = -1,
.args = { 0x00 },
.extra_annations = { 0x00 }
};
.event_type = CONTAINER_EVENT,
.value = state,
.pid = -1,
.exit_code = -1,
.args = { 0x00 },
.extra_annations = { 0x00 } };
if (name == NULL) {
CRIT("Invalid input arguments");
......@@ -124,11 +123,10 @@ int isulad_monitor_send_image_event(const char *name, image_state_t state)
int ret = 0;
struct monitord_msg msg = { .type = MONITORD_MSG_STATE,
.event_type = IMAGE_EVENT,
.value = state,
.args = { 0x00 },
.extra_annations = { 0x00 }
};
.event_type = IMAGE_EVENT,
.value = state,
.args = { 0x00 },
.extra_annations = { 0x00 } };
if (name == NULL) {
CRIT("Invalid input arguments");
......
......@@ -13,7 +13,7 @@
* Description: provide log gather functions
******************************************************************************/
#define _GNU_SOURCE
#include "log_gather.h"
#include "log_gather_api.h"
#include <unistd.h>
#include <string.h>
......@@ -28,7 +28,7 @@
#include "utils.h"
#include "isulad_tar.h"
typedef int(*log_save_t)(const void *buf, size_t count);
typedef int (*log_save_t)(const void *buf, size_t count);
static log_save_t g_save_log_op = NULL;
static int g_fifo_fd = -1;
......@@ -407,4 +407,3 @@ err_out:
pexit:
return NULL;
}
......@@ -22,13 +22,13 @@
#include <sys/stat.h>
#include "isula_libutils/log.h"
#include "plugin.h"
#include "plugin_api.h"
#include "pspec.h"
#include "utils.h"
#include "parser.h"
#include "buffer.h"
#include "isulad_config.h"
#include "specs.h"
#include "specs_api.h"
#include "specs_extend.h"
#include "rest_common.h"
#include "container_api.h"
......
......@@ -17,7 +17,7 @@
#include "isula_libutils/log.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "isula_libutils/oci_runtime_pspec.h"
#include "plugin.h"
#include "plugin_api.h"
#include "pspec.h"
/*
......@@ -26,12 +26,12 @@
*/
#define PTR_UPDATE(old, new, field, ffree) \
do { \
if ((new)->field == NULL) { \
if ((new)->field == NULL) { \
break; \
} \
ffree((old)->field); \
(old)->field = (new)->field; \
(new)->field = NULL; \
ffree((old)->field); \
(old)->field = (new)->field; \
(new)->field = NULL; \
} while (0)
/*
......@@ -87,8 +87,7 @@ static oci_runtime_pspec *raw_get_pspec(oci_runtime_spec *oci)
PPR_UPDATE(pspec, oci->process, env, env_len, free);
PPR_UPDATE(pspec, oci->linux, devices, devices_len, free_defs_device);
PPR_UPDATE(pspec->resources, oci->linux->resources, devices, devices_len,
free_defs_device_cgroup);
PPR_UPDATE(pspec->resources, oci->linux->resources, devices, devices_len, free_defs_device_cgroup);
return pspec;
}
......@@ -113,8 +112,7 @@ static void raw_set_pspec(oci_runtime_spec *oci, oci_runtime_pspec *pspec)
PPR_UPDATE(oci->process, pspec, env, env_len, free);
PPR_UPDATE(oci->linux, pspec, devices, devices_len, free_defs_device);
PPR_UPDATE(oci->linux->resources, pspec->resources, devices, devices_len,
free_defs_device_cgroup);
PPR_UPDATE(oci->linux->resources, pspec->resources, devices, devices_len, free_defs_device_cgroup);
}
char *get_pspec(oci_runtime_spec *oci)
......@@ -254,4 +252,3 @@ revert_free_old:
return dst;
}
......@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdint.h>
#include "runtime.h"
#include "runtime_api.h"
#ifdef __cplusplus
extern "C" {
......
......@@ -23,7 +23,7 @@
#include "error.h"
#include "isulad_config.h"
#include "libisulad.h"
#include "runtime.h"
#include "runtime_api.h"
bool rt_lcr_detect(const char *runtime)
{
......
......@@ -16,7 +16,7 @@
#ifndef __RUNTIME_LCR_OPS_INTERFACE_H_
#define __RUNTIME_LCR_OPS_INTERFACE_H_
#include "runtime.h"
#include "runtime_api.h"
#ifdef __cplusplus
extern "C" {
......
......@@ -22,7 +22,7 @@
#include "isula_rt_ops.h"
#include "isula_libutils/log.h"
#include "error.h"
#include "runtime.h"
#include "runtime_api.h"
#include "constants.h"
#include "isula_libutils/shim_client_process_state.h"
#include "isula_libutils/shim_client_runtime_stats.h"
......@@ -673,7 +673,7 @@ static int shim_create(bool fg, const char *id, const char *workdir, const char
_exit(EXIT_SUCCESS);
}
realexec:
realexec:
/* real shim process. */
close(exec_fd[0]);
if (setsid() < 0) {
......@@ -685,7 +685,7 @@ realexec:
(void)dprintf(exec_fd[1], "close inherited fds failed");
}
execvp(SHIM_BINARY, (char * const *)params);
execvp(SHIM_BINARY, (char *const *)params);
(void)dprintf(exec_fd[1], "exec failed: %s", strerror(errno));
}
......
......@@ -16,7 +16,7 @@
#ifndef ISULA_RT_OPS_H
#define ISULA_RT_OPS_H /* ISULA_RT_OPS_H */
#include "runtime.h"
#include "runtime_api.h"
#ifdef __cplusplus
extern "C" {
......
......@@ -21,7 +21,7 @@
#include <sys/utsname.h>
#include <ctype.h>
#include "runtime.h"
#include "runtime_api.h"
#include "engine.h"
#include "isulad_config.h"
#include "isula_libutils/log.h"
......
......@@ -13,7 +13,7 @@
* Description: provide container supervisor functions
******************************************************************************/
#define _GNU_SOURCE
#include "service_container.h"
#include "service_container_api.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
......@@ -23,15 +23,15 @@
#include "utils.h"
#include "mainloop.h"
#include "libisulad.h"
#include "event_sender.h"
#include "events_sender_api.h"
#include "image_api.h"
#include "specs.h"
#include "specs_api.h"
#include "isulad_config.h"
#include "verify.h"
#include "plugin.h"
#include "plugin_api.h"
#include "container_api.h"
#include "namespace.h"
#include "runtime.h"
#include "runtime_api.h"
int set_container_to_removal(const container_t *cont)
{
......
......@@ -13,7 +13,7 @@
* Description: provide container supervisor functions
******************************************************************************/
#define _GNU_SOURCE
#include "service_image.h"
#include "service_image_api.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
......@@ -23,7 +23,7 @@
#include "image_api.h"
#include "utils.h"
#include "container_api.h"
#include "event_sender.h"
#include "events_sender_api.h"
static bool check_image_in_used(const char *image_ref)
{
......
......@@ -30,7 +30,7 @@
#include "error.h"
#include "isula_libutils/log.h"
#include "specs.h"
#include "specs_api.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "isula_libutils/oci_runtime_hooks.h"
#include "isula_libutils/docker_seccomp.h"
......@@ -688,16 +688,16 @@ static int merge_hugetlbs(oci_runtime_spec *oci_spec, host_config_hugetlbs_eleme
for (i = 0; i < hugetlbs_len; i++) {
oci_spec->linux->resources->hugepage_limits[oci_spec->linux->resources->hugepage_limits_len] =
util_common_calloc_s(sizeof(defs_resources_hugepage_limits_element));
util_common_calloc_s(sizeof(defs_resources_hugepage_limits_element));
if (oci_spec->linux->resources->hugepage_limits[oci_spec->linux->resources->hugepage_limits_len] == NULL) {
ERROR("Failed to malloc memory for hugepage limits");
ret = -1;
goto out;
}
oci_spec->linux->resources->hugepage_limits[oci_spec->linux->resources->hugepage_limits_len]->limit =
hugetlbs[i]->limit;
hugetlbs[i]->limit;
oci_spec->linux->resources->hugepage_limits[oci_spec->linux->resources->hugepage_limits_len]->page_size =
util_strdup_s(hugetlbs[i]->page_size);
util_strdup_s(hugetlbs[i]->page_size);
oci_spec->linux->resources->hugepage_limits_len++;
}
out:
......
......@@ -44,18 +44,17 @@
#include "libisulad.h"
#include "specs_extend.h"
#include "selinux_label.h"
#include "specs.h"
#include "specs_api.h"
#include "constants.h"
#define MAX_CAP_LEN 32
static const char * const g_system_caps[] = { "SYS_BOOT", "SETPCAP", "NET_RAW", "NET_BIND_SERVICE",
static const char *const g_system_caps[] = { "SYS_BOOT", "SETPCAP", "NET_RAW", "NET_BIND_SERVICE",
#ifdef CAP_AUDIT_WRITE
"AUDIT_WRITE",
"AUDIT_WRITE",
#endif
"DAC_OVERRIDE", "SETFCAP", "SETGID", "SETUID", "MKNOD", "CHOWN",
"FOWNER", "FSETID", "KILL", "SYS_CHROOT"
};
"DAC_OVERRIDE", "SETFCAP", "SETGID", "SETUID", "MKNOD", "CHOWN",
"FOWNER", "FSETID", "KILL", "SYS_CHROOT" };
static int append_capability(char ***dstcaps, size_t *dstcaps_len, const char *cap)
{
......@@ -311,25 +310,24 @@ static char *seccomp_trans_arch_for_docker(const char *arch)
{
size_t i = 0;
char *arch_map[][2] = { { "SCMP_ARCH_X86", "x86" },
{ "SCMP_ARCH_X86_64", "amd64" },
{ "SCMP_ARCH_X32", "x32" },
{ "SCMP_ARCH_ARM", "arm" },
{ "SCMP_ARCH_AARCH64", "arm64" },
{ "SCMP_ARCH_MIPS", "mips" },
{ "SCMP_ARCH_MIPS64", "mips64" },
{ "SCMP_ARCH_MIPS64N32", "mips64n32" },
{ "SCMP_ARCH_MIPSEL", "mipsel" },
{ "SCMP_ARCH_MIPSEL64", "mipsel64" },
{ "SCMP_ARCH_MIPSEL64N32", "mipsel64n32" },
{ "SCMP_ARCH_PPC", "ppc" },
{ "SCMP_ARCH_PPC64", "ppc64" },
{ "SCMP_ARCH_PPC64LE", "ppc64le" },
{ "SCMP_ARCH_S390", "s390" },
{ "SCMP_ARCH_S390X", "s390x" },
{ "SCMP_ARCH_PARISC", "parisc" },
{ "SCMP_ARCH_PARISC64", "parisc64" },
{ "SCMP_ARCH_ALL", "all" }
};
{ "SCMP_ARCH_X86_64", "amd64" },
{ "SCMP_ARCH_X32", "x32" },
{ "SCMP_ARCH_ARM", "arm" },
{ "SCMP_ARCH_AARCH64", "arm64" },
{ "SCMP_ARCH_MIPS", "mips" },
{ "SCMP_ARCH_MIPS64", "mips64" },
{ "SCMP_ARCH_MIPS64N32", "mips64n32" },
{ "SCMP_ARCH_MIPSEL", "mipsel" },
{ "SCMP_ARCH_MIPSEL64", "mipsel64" },
{ "SCMP_ARCH_MIPSEL64N32", "mipsel64n32" },
{ "SCMP_ARCH_PPC", "ppc" },
{ "SCMP_ARCH_PPC64", "ppc64" },
{ "SCMP_ARCH_PPC64LE", "ppc64le" },
{ "SCMP_ARCH_S390", "s390" },
{ "SCMP_ARCH_S390X", "s390x" },
{ "SCMP_ARCH_PARISC", "parisc" },
{ "SCMP_ARCH_PARISC64", "parisc64" },
{ "SCMP_ARCH_ALL", "all" } };
for (i = 0; i < sizeof(arch_map) / sizeof(arch_map[0]); i++) {
if (strcmp(arch, arch_map[i][0]) == 0) {
return util_strdup_s(arch_map[i][1]);
......@@ -493,10 +491,10 @@ static int dup_architectures_to_oci_spec(const docker_seccomp *docker_seccomp_sp
}
for (i = 0; i < docker_seccomp_spec->arch_map_len; i++) {
oci_seccomp_spec->architectures[oci_seccomp_spec->architectures_len++] =
util_strdup_s(docker_seccomp_spec->arch_map[i]->architecture);
util_strdup_s(docker_seccomp_spec->arch_map[i]->architecture);
for (j = 0; j < docker_seccomp_spec->arch_map[i]->sub_architectures_len; j++) {
oci_seccomp_spec->architectures[oci_seccomp_spec->architectures_len++] =
util_strdup_s(docker_seccomp_spec->arch_map[i]->sub_architectures[j]);
util_strdup_s(docker_seccomp_spec->arch_map[i]->sub_architectures[j]);
}
}
}
......@@ -574,7 +572,7 @@ static int dup_syscall_to_oci_spec(const docker_seccomp *docker_seccomp_spec,
}
oci_seccomp_spec->syscalls[k]->names =
util_common_calloc_s(docker_seccomp_spec->syscalls[i]->names_len * sizeof(char *));
util_common_calloc_s(docker_seccomp_spec->syscalls[i]->names_len * sizeof(char *));
if (oci_seccomp_spec->syscalls[k]->names == NULL) {
return -1;
}
......@@ -961,8 +959,7 @@ int adapt_settings_for_system_container(oci_runtime_spec *oci_spec, const host_c
{
int ret = 0;
char *unblocked_systemcall_for_system_container[] = { "mount", "umount2", "reboot", "name_to_handle_at",
"unshare"
};
"unshare" };
char **adds = NULL;
size_t adds_len = 0;
bool no_new_privileges = false;
......@@ -1005,11 +1002,11 @@ int adapt_settings_for_system_container(oci_runtime_spec *oci_spec, const host_c
}
ret = append_systemcall_to_seccomp(
oci_spec->linux->seccomp,
make_seccomp_syscalls_element((const char **)unblocked_systemcall_for_system_container,
sizeof(unblocked_systemcall_for_system_container) /
sizeof(unblocked_systemcall_for_system_container[0]),
"SCMP_ACT_ALLOW", 0, NULL));
oci_spec->linux->seccomp,
make_seccomp_syscalls_element((const char **)unblocked_systemcall_for_system_container,
sizeof(unblocked_systemcall_for_system_container) /
sizeof(unblocked_systemcall_for_system_container[0]),
"SCMP_ACT_ALLOW", 0, NULL));
if (ret != 0) {
ERROR("Failed to append systemcall to seccomp file");
ret = -1;
......
......@@ -30,7 +30,7 @@
#include "libisulad.h"
#include "isula_libutils/log.h"
#include "sysinfo.h"
#include "specs.h"
#include "specs_api.h"
#include "verify.h"
#include "isulad_config.h"
#include "selinux_label.h"
......
......@@ -38,6 +38,7 @@ target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/common
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/utils/cutils/map
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/runtime/engines
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/spec/
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/container/
......
......@@ -40,6 +40,7 @@ target_include_directories(${DRIVER_EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/sha256
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/console
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver
......
......@@ -17,7 +17,7 @@
#define COLLECTOR_MOCK_H_
#include <gmock/gmock.h>
#include "collector.h"
#include "events_collector_api.h"
class MockCollector {
public:
......@@ -29,6 +29,6 @@ public:
const char *args, const char *extra_annations));
};
void MockCollector_SetMock(MockCollector* mock);
void MockCollector_SetMock(MockCollector *mock);
#endif
......@@ -17,7 +17,7 @@
#define CONTAINERS_OPERATOR_MOCK_H_
#include <gmock/gmock.h>
#include "service_container.h"
#include "service_container_api.h"
class MockContainersOperator {
public:
......
......@@ -17,7 +17,7 @@
#define RUNTIME_MOCK_H_
#include <gmock/gmock.h>
#include "runtime.h"
#include "runtime_api.h"
class MockRuntime {
public:
......
......@@ -17,15 +17,15 @@
#define SPECS_MOCK_H_
#include <gmock/gmock.h>
#include "specs.h"
#include "specs_api.h"
class MockSpecs {
public:
MOCK_METHOD2(LoadOciConfig, oci_runtime_spec * (const char *rootpath, const char *name));
MOCK_METHOD2(LoadOciConfig, oci_runtime_spec *(const char *rootpath, const char *name));
MOCK_METHOD2(MergeConfCgroup, int(oci_runtime_spec *oci_spec, const host_config *host_spec));
MOCK_METHOD3(SaveOciConfig, int(const char *id, const char *rootpath, const oci_runtime_spec *oci_spec));
};
void MockSpecs_SetMock(MockSpecs* mock);
void MockSpecs_SetMock(MockSpecs *mock);
#endif
......@@ -34,6 +34,7 @@ target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/common
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/services/execution/manager
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/events
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/runtime
......
......@@ -35,6 +35,7 @@ target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/common
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container/restart_manager
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container/health_check
......
......@@ -57,6 +57,7 @@ target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/console
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/cutils
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/service
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/container
......
......@@ -42,6 +42,7 @@ target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/isulad
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/runtime
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container/restart_manager
......
......@@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include "mock.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "specs.h"
#include "specs_api.h"
#include "isula_libutils/host_config.h"
#include "isula_libutils/container_config.h"
#include "oci_ut_common.h"
......@@ -69,7 +69,7 @@ TEST(merge_conf_cgroup_ut, test_merge_conf_cgroup_2)
oci_runtime_spec *oci_spec = NULL;
// Parameter host_spec is NULL
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
ASSERT_NE(merge_conf_cgroup(oci_spec, NULL), 0);
free_oci_runtime_spec(oci_spec);
......@@ -113,7 +113,7 @@ TEST(merge_conf_cgroup_ut, test_merge_conf_cgroup)
free(host_config_file);
host_config_file = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
ASSERT_EQ(merge_conf_cgroup(oci_spec, host_spec), 0);
......@@ -245,10 +245,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_2)
oci_runtime_spec *oci_spec = nullptr;
host_config *host_spec = nullptr;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
host_spec = (host_config *) util_common_calloc_s(sizeof(host_config));
host_spec = (host_config *)util_common_calloc_s(sizeof(host_config));
ASSERT_TRUE(host_spec != NULL);
EXPECT_CALL(m_isulad_conf, GetCgroupParent()).WillRepeatedly(Invoke(invoke_conf_get_isulad_cgroup_parent_null));
......@@ -268,10 +268,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_3)
oci_runtime_spec *oci_spec = nullptr;
host_config *host_spec = nullptr;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
host_spec = (host_config *) util_common_calloc_s(sizeof(host_config));
host_spec = (host_config *)util_common_calloc_s(sizeof(host_config));
ASSERT_TRUE(host_spec != NULL);
host_spec->cgroup_parent = util_strdup_s("/test");
......@@ -293,10 +293,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_4)
oci_runtime_spec *oci_spec = nullptr;
host_config *host_spec = nullptr;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
host_spec = (host_config *) util_common_calloc_s(sizeof(host_config));
host_spec = (host_config *)util_common_calloc_s(sizeof(host_config));
ASSERT_TRUE(host_spec != NULL);
EXPECT_CALL(m_isulad_conf, GetCgroupParent()).WillRepeatedly(Invoke(invoke_conf_get_isulad_cgroup_parent));
......@@ -316,10 +316,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_5)
oci_runtime_spec *oci_spec = nullptr;
host_config *host_spec = nullptr;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
host_spec = (host_config *) util_common_calloc_s(sizeof(host_config));
host_spec = (host_config *)util_common_calloc_s(sizeof(host_config));
ASSERT_TRUE(host_spec != NULL);
host_spec->cgroup_parent = util_strdup_s("/test");
......
......@@ -42,6 +42,7 @@ target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/isulad
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/api
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container/restart_manager
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/container/health_check
......
......@@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include "mock.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "specs.h"
#include "specs_api.h"
#include "isula_libutils/host_config.h"
#include "isula_libutils/container_config.h"
#include "oci_ut_common.h"
......@@ -47,7 +47,7 @@ using namespace std;
TEST(make_sure_oci_spec_linux_ut, test_make_sure_oci_spec_linux)
{
oci_runtime_spec *oci_spec = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
ASSERT_EQ(make_sure_oci_spec_linux(oci_spec), 0);
ASSERT_TRUE(oci_spec->linux != NULL);
......@@ -58,7 +58,7 @@ TEST(make_sure_oci_spec_linux_ut, test_make_sure_oci_spec_linux)
TEST(make_sure_oci_spec_process_ut, test_make_sure_oci_spec_process)
{
oci_runtime_spec *oci_spec = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
ASSERT_EQ(make_sure_oci_spec_process(oci_spec), 0);
ASSERT_TRUE(oci_spec->process != NULL);
......@@ -69,7 +69,7 @@ TEST(make_sure_oci_spec_process_ut, test_make_sure_oci_spec_process)
TEST(make_sure_oci_spec_linux_resources_ut, test_make_sure_oci_spec_linux_resources)
{
oci_runtime_spec *oci_spec = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
ASSERT_EQ(make_sure_oci_spec_linux_resources(oci_spec), 0);
ASSERT_TRUE(oci_spec->linux != NULL);
......@@ -81,7 +81,7 @@ TEST(make_sure_oci_spec_linux_resources_ut, test_make_sure_oci_spec_linux_resour
TEST(make_sure_oci_spec_linux_resources_blkio_ut, test_make_sure_oci_spec_linux_resources_blkio)
{
oci_runtime_spec *oci_spec = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
ASSERT_EQ(make_sure_oci_spec_linux_resources_blkio(oci_spec), 0);
ASSERT_TRUE(oci_spec->linux != NULL);
......@@ -100,9 +100,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_2)
{
oci_runtime_spec *oci_spec = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
oci_spec->hooks = (oci_runtime_spec_hooks*)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
oci_spec->hooks = (oci_runtime_spec_hooks *)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
ASSERT_NE(merge_hooks(oci_spec->hooks, NULL), 0);
free_oci_runtime_spec(oci_spec);
oci_spec = NULL;
......@@ -144,9 +144,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_4)
free(hooks_config_file);
hooks_config_file = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
oci_spec->hooks = (oci_runtime_spec_hooks*)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
oci_spec->hooks = (oci_runtime_spec_hooks *)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
ASSERT_EQ(merge_hooks(oci_spec->hooks, hooks_spec), 0);
......@@ -172,9 +172,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_prestart)
free(hooks_config_file);
hooks_config_file = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
oci_spec->hooks = (oci_runtime_spec_hooks*)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
oci_spec->hooks = (oci_runtime_spec_hooks *)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
ASSERT_EQ(merge_hooks(oci_spec->hooks, hooks_spec), 0);
ASSERT_EQ(oci_spec->hooks->prestart_len, 1);
......@@ -210,9 +210,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_poststart)
free(hooks_config_file);
hooks_config_file = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
oci_spec->hooks = (oci_runtime_spec_hooks*)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
oci_spec->hooks = (oci_runtime_spec_hooks *)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
ASSERT_EQ(merge_hooks(oci_spec->hooks, hooks_spec), 0);
ASSERT_EQ(oci_spec->hooks->poststart_len, 2);
......@@ -257,9 +257,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_poststop)
free(hooks_config_file);
hooks_config_file = NULL;
oci_spec = (oci_runtime_spec *) util_common_calloc_s(sizeof(oci_runtime_spec));
oci_spec = (oci_runtime_spec *)util_common_calloc_s(sizeof(oci_runtime_spec));
ASSERT_TRUE(oci_spec != NULL);
oci_spec->hooks = (oci_runtime_spec_hooks*)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
oci_spec->hooks = (oci_runtime_spec_hooks *)util_common_calloc_s(sizeof(oci_runtime_spec_hooks));
ASSERT_EQ(merge_hooks(oci_spec->hooks, hooks_spec), 0);
ASSERT_EQ(oci_spec->hooks->poststop_len, 2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册