rename exec->id to exec->container_id

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-09-25 10:28:21 +08:00
parent 728d02983e
commit 45967cc8b8
3 changed files with 14 additions and 14 deletions
+7 -7
View File
@@ -356,7 +356,7 @@ static int hyper_setup_exec_tty(struct hyper_exec *e)
e->stderrfd = errpipe[1];
}
if (sprintf(ptmx, "/tmp/hyper/%s/devpts/ptmx", e->id) < 0) {
if (sprintf(ptmx, "/tmp/hyper/%s/devpts/ptmx", e->container_id) < 0) {
fprintf(stderr, "get ptmx path failed\n");
return -1;
}
@@ -480,9 +480,9 @@ static int hyper_do_exec_cmd(struct hyper_exec *exec, struct hyper_pod *pod, int
goto out;
}
c = hyper_find_container(pod, exec->id);
c = hyper_find_container(pod, exec->container_id);
if (c == NULL) {
fprintf(stderr, "can not find container %s\n", exec->id);
fprintf(stderr, "can not find container %s\n", exec->container_id);
goto out;
}
@@ -563,7 +563,7 @@ static void hyper_free_exec(struct hyper_exec *exec)
{
int i;
free(exec->id);
free(exec->container_id);
for (i = 0; i < exec->argc; i++) {
//fprintf(stdout, "argv %d %s\n", i, exec->argv[i]);
@@ -600,9 +600,9 @@ int hyper_run_process(struct hyper_exec *exec)
int pid, ret = -1;
uint32_t type;
if (exec->argv == NULL || exec->seq == 0 || exec->id == NULL || strlen(exec->id) == 0) {
if (exec->argv == NULL || exec->seq == 0 || exec->container_id == NULL || strlen(exec->container_id) == 0) {
fprintf(stderr, "cmd is %p, seq %" PRIu64 ", container %s\n",
exec->argv, exec->seq, exec->id);
exec->argv, exec->seq, exec->container_id);
goto out;
}
@@ -822,7 +822,7 @@ int hyper_handle_exec_exit(struct hyper_pod *pod, int pid, uint8_t code)
}
fprintf(stdout, "%s exec exit pid %d, seq %" PRIu64 ", container %s\n",
__func__, exec->pid, exec->seq, exec->id);
__func__, exec->pid, exec->seq, exec->container_id);
exec->code = code;
exec->exit = 1;
+1 -1
View File
@@ -27,7 +27,7 @@ struct hyper_exec {
uint8_t ref;
// configs
char *id;
char *container_id;
char *user;
char *group;
char **additional_groups;
+6 -6
View File
@@ -184,8 +184,8 @@ static void container_cleanup_exec(struct hyper_exec *exec)
{
int i;
free(exec->id);
exec->id = NULL;
free(exec->container_id);
exec->container_id = NULL;
free(exec->user);
exec->user = NULL;
@@ -653,7 +653,7 @@ static int hyper_parse_container(struct hyper_pod *pod, struct hyper_container *
fprintf(stdout, "%d name %s\n", i, json_token_str(json, t));
if (json_token_streq(json, t, "id") && t->size == 1) {
c->id = (json_token_str(json, &toks[++i]));
c->exec.id = strdup(c->id);
c->exec.container_id = strdup(c->id);
fprintf(stdout, "container id %s\n", c->id);
i++;
} else if (json_token_streq(json, t, "rootfs") && t->size == 1) {
@@ -1296,8 +1296,8 @@ realloc:
jsmntok_t *t = &toks[i];
if (json_token_streq(json, t, "container")) {
exec->id = (json_token_str(json, &toks[++i]));
fprintf(stdout, "get container %s\n", exec->id);
exec->container_id = (json_token_str(json, &toks[++i]));
fprintf(stdout, "get container %s\n", exec->container_id);
} else if (json_token_streq(json, t, "process") && t->size == 1) {
j = hyper_parse_process(exec, json, &toks[++i]);
if (j < 0)
@@ -1306,7 +1306,7 @@ realloc:
}
}
if (exec->id == NULL || strlen(exec->id) == 0) {
if (exec->container_id == NULL || strlen(exec->container_id) == 0) {
fprintf(stderr, "execcmd format error, has no container id\n");
goto fail;
}