introduce hyper_free_container

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
Gao feng
2015-11-12 23:26:58 +08:00
parent c3160aea0a
commit 25da342f75
2 changed files with 14 additions and 7 deletions
+13 -7
View File
@@ -599,18 +599,13 @@ struct hyper_container *hyper_find_container(struct hyper_pod *pod, char *id)
return NULL;
}
void hyper_cleanup_container(struct hyper_container *c)
void hyper_free_container(struct hyper_container *c)
{
int i;
struct volume *vol;
struct env *env;
struct fsmap *map;
struct sysctl *sys;
char root[512];
sprintf(root, "/tmp/hyper/%s/devpts/", c->id);
if (umount(root) < 0 && umount2(root, MNT_DETACH))
perror("umount devpts failed");
free(c->id);
free(c->rootfs);
@@ -646,7 +641,6 @@ void hyper_cleanup_container(struct hyper_container *c)
free(map->path);
}
free(c->maps);
close(c->ns);
free(c->exec.id);
for (i = 0; i < c->exec.argc; i++) {
@@ -656,6 +650,18 @@ void hyper_cleanup_container(struct hyper_container *c)
free(c->exec.argv);
}
void hyper_cleanup_container(struct hyper_container *c)
{
char root[512];
sprintf(root, "/tmp/hyper/%s/devpts/", c->id);
if (umount(root) < 0 && umount2(root, MNT_DETACH))
perror("umount devpts failed");
close(c->ns);
hyper_free_container(c);
}
void hyper_cleanup_containers(struct hyper_pod *pod)
{
int i;
+1
View File
@@ -53,5 +53,6 @@ int hyper_start_container(struct hyper_container *container,
struct hyper_container *hyper_find_container(struct hyper_pod *pod, char *id);
void hyper_cleanup_container(struct hyper_container *container);
void hyper_cleanup_containers(struct hyper_pod *pod);
void hyper_free_container(struct hyper_container *c);
#endif