mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-08-26 09:35:49 +00:00
introduce hyper_free_container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
+13
-7
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user