[lxc-devel] [lxc/master] smaller cleanups and simplifications
brauner on Github
lxc-bot at linuxcontainers.org
Sun Mar 15 14:53:52 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200315/165d55f3/attachment.bin>
-------------- next part --------------
From b78872c03d636418a9e9bb59584cd395bb8adecf Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 14:37:42 +0100
Subject: [PATCH 1/8] conf: don't wrap strings
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/conf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 08e6da29e9..40db20c3fe 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -941,13 +941,13 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
/* Prevent leaking the file descriptors to the container */
ret = fd_cloexec(tty->master, true);
if (ret < 0)
- SYSWARN("Failed to set FD_CLOEXEC flag on master fd %d of "
- "tty device \"%s\"", tty->master, tty->name);
+ SYSWARN("Failed to set FD_CLOEXEC flag on master fd %d of tty device \"%s\"",
+ tty->master, tty->name);
ret = fd_cloexec(tty->slave, true);
if (ret < 0)
- SYSWARN("Failed to set FD_CLOEXEC flag on slave fd %d of "
- "tty device \"%s\"", tty->slave, tty->name);
+ SYSWARN("Failed to set FD_CLOEXEC flag on slave fd %d of tty device \"%s\"",
+ tty->slave, tty->name);
tty->busy = -1;
}
From 59b1b67e7e52d90b07519d96a279f00ce36d3bc8 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 14:56:21 +0100
Subject: [PATCH 2/8] start: simplify lxc_init()
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/start.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 75ccddd855..9babce77ed 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -731,27 +731,21 @@ int lxc_init(const char *name, struct lxc_handler *handler)
handler->monitor_pid = lxc_raw_getpid();
status_fd = open("/proc/self/status", O_RDONLY | O_CLOEXEC);
- if (status_fd < 0) {
- SYSERROR("Failed to open monitor status fd");
- goto out_close_maincmd_fd;
- }
+ if (status_fd < 0)
+ return log_error_errno(-1, errno, "Failed to open monitor status fd");
lsm_init();
TRACE("Initialized LSM");
ret = lxc_read_seccomp_config(conf);
- if (ret < 0) {
- ERROR("Failed loading seccomp policy");
- goto out_close_maincmd_fd;
- }
+ if (ret < 0)
+ return log_error(-1, "Failed loading seccomp policy");
TRACE("Read seccomp policy");
/* Begin by setting the state to STARTING. */
ret = lxc_set_state(name, handler, STARTING);
- if (ret < 0) {
- ERROR("Failed to set state to \"%s\"", lxc_state2str(STARTING));
- goto out_close_maincmd_fd;
- }
+ if (ret < 0)
+ return log_error(-1, "Failed to set state to \"%s\"", lxc_state2str(STARTING));
TRACE("Set container state to \"STARTING\"");
/* Start of environment variable setup for hooks. */
@@ -824,7 +818,7 @@ int lxc_init(const char *name, struct lxc_handler *handler)
handler->sigfd = setup_signal_fd(&handler->oldmask);
if (handler->sigfd < 0) {
ERROR("Failed to setup SIGCHLD fd handler.");
- goto out_delete_tty;
+ goto out_aborting;
}
TRACE("Set up signal fd");
@@ -867,14 +861,9 @@ int lxc_init(const char *name, struct lxc_handler *handler)
out_restore_sigmask:
(void)pthread_sigmask(SIG_SETMASK, &handler->oldmask, NULL);
-out_delete_tty:
- lxc_delete_tty(&conf->ttys);
-
out_aborting:
(void)lxc_set_state(name, handler, ABORTING);
-out_close_maincmd_fd:
- close_prot_errno_disarm(conf->maincmd_fd);
return -1;
}
@@ -1041,7 +1030,7 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
handler->pidfd, handler->pid);
}
- if (!ret || errno != ESRCH)
+ if (!ret || errno != ESRCH && handler->pid > 0)
if (kill(handler->pid, SIGKILL))
SYSWARN("Failed to send SIGKILL to %d", handler->pid);
From 65a2dc8b90c05194b42759e72593d851b6f11335 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 15:26:47 +0100
Subject: [PATCH 3/8] start: rework cleanup code in __lxc_start()
This makes the goto labels slightly more convoluted but allows us to further
simplify the cleanup in lxc_init().
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/start.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 9babce77ed..0d4e28949e 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -805,10 +805,8 @@ int lxc_init(const char *name, struct lxc_handler *handler)
TRACE("Set environment variables");
ret = run_lxc_hooks(name, "pre-start", conf, NULL);
- if (ret < 0) {
- ERROR("Failed to run lxc.hook.pre-start for container \"%s\"", name);
- goto out_aborting;
- }
+ if (ret < 0)
+ return log_error(-1, "Failed to run lxc.hook.pre-start for container \"%s\"", name);
TRACE("Ran pre-start hooks");
/* The signal fd has to be created before forking otherwise if the child
@@ -816,10 +814,8 @@ int lxc_init(const char *name, struct lxc_handler *handler)
* and the command will be stuck.
*/
handler->sigfd = setup_signal_fd(&handler->oldmask);
- if (handler->sigfd < 0) {
- ERROR("Failed to setup SIGCHLD fd handler.");
- goto out_aborting;
- }
+ if (handler->sigfd < 0)
+ return log_error(-1, "Failed to setup SIGCHLD fd handler.");
TRACE("Set up signal fd");
/* Do this after setting up signals since it might unblock SIGWINCH. */
@@ -861,9 +857,6 @@ int lxc_init(const char *name, struct lxc_handler *handler)
out_restore_sigmask:
(void)pthread_sigmask(SIG_SETMASK, &handler->oldmask, NULL);
-out_aborting:
- (void)lxc_set_state(name, handler, ABORTING);
-
return -1;
}
@@ -1030,7 +1023,7 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
handler->pidfd, handler->pid);
}
- if (!ret || errno != ESRCH && handler->pid > 0)
+ if ((!ret || errno != ESRCH) && handler->pid > 0)
if (kill(handler->pid, SIGKILL))
SYSWARN("Failed to send SIGKILL to %d", handler->pid);
@@ -2004,19 +1997,31 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
if (error_num)
*error_num = handler->exit_status;
-out_fini:
+/* These are the goto targets you are not allowed to jump to. */
+__out_fini:
lxc_delete_network(handler);
-out_detach_blockdev:
+__out_detach_blockdev:
detach_block_device(handler->conf);
-out_fini_nonet:
+__out_fini_nonet:
lxc_fini(name, handler);
+
return ret;
+/* These are the goto targets you want to jump to. */
+out_fini_nonet:
+ lxc_abort(name, handler);
+ goto __out_fini_nonet;
+
+out_detach_blockdev:
+ lxc_abort(name, handler);
+ goto __out_detach_blockdev;
+
out_abort:
lxc_abort(name, handler);
- goto out_fini;
+ goto __out_fini;
+
}
struct start_args {
From 9ad6658913996bbd5cc5dbec845e78a050067548 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 15:37:00 +0100
Subject: [PATCH 4/8] start: better goto target naming in __lxc_start()
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/start.c | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 0d4e28949e..365b07d249 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -1889,7 +1889,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret = lxc_init(name, handler);
if (ret < 0) {
ERROR("Failed to initialize container \"%s\"", name);
- goto out_fini_nonet;
+ goto out_abort;
}
handler->ops = ops;
handler->data = data;
@@ -1899,25 +1899,25 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
if (!attach_block_device(handler->conf)) {
ERROR("Failed to attach block device");
ret = -1;
- goto out_fini_nonet;
+ goto out_abort;
}
if (!cgroup_ops->monitor_create(cgroup_ops, handler)) {
ERROR("Failed to create monitor cgroup");
ret = -1;
- goto out_fini_nonet;
+ goto out_abort;
}
if (!cgroup_ops->monitor_enter(cgroup_ops, handler)) {
ERROR("Failed to enter monitor cgroup");
ret = -1;
- goto out_fini_nonet;
+ goto out_abort;
}
if (!cgroup_ops->monitor_delegate_controllers(cgroup_ops)) {
ERROR("Failed to delegate controllers to monitor cgroup");
ret = -1;
- goto out_fini_nonet;
+ goto out_abort;
}
if (geteuid() == 0 && !lxc_list_empty(&conf->id_map)) {
@@ -1926,7 +1926,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret = unshare(CLONE_NEWNS);
if (ret < 0) {
ERROR("Failed to unshare CLONE_NEWNS");
- goto out_fini_nonet;
+ goto out_abort;
}
INFO("Unshared CLONE_NEWNS");
@@ -1934,7 +1934,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret = lxc_setup_rootfs_prepare_root(conf, name, lxcpath);
if (ret < 0) {
ERROR("Error setting up rootfs mount as root before spawn");
- goto out_fini_nonet;
+ goto out_abort;
}
INFO("Set up container rootfs as host root");
}
@@ -1951,13 +1951,13 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret = lxc_poll(name, handler);
if (ret) {
ERROR("LXC mainloop exited with error: %d", ret);
- goto out_abort;
+ goto out_delete_network;
}
if (!handler->init_died && handler->pid > 0) {
ERROR("Child process is not killed");
ret = -1;
- goto out_abort;
+ goto out_delete_network;
}
status = lxc_wait_for_pid_status(handler->pid);
@@ -1997,31 +1997,30 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
if (error_num)
*error_num = handler->exit_status;
-/* These are the goto targets you are not allowed to jump to. */
-__out_fini:
+/* These are not the droids you are looking for. */
+__private_goto1:
lxc_delete_network(handler);
-__out_detach_blockdev:
+__private_goto2:
detach_block_device(handler->conf);
-__out_fini_nonet:
+__private_goto3:
lxc_fini(name, handler);
return ret;
-/* These are the goto targets you want to jump to. */
-out_fini_nonet:
+/* These are the droids you are looking for. */
+out_abort:
lxc_abort(name, handler);
- goto __out_fini_nonet;
+ goto __private_goto3;
out_detach_blockdev:
lxc_abort(name, handler);
- goto __out_detach_blockdev;
+ goto __private_goto2;
-out_abort:
+out_delete_network:
lxc_abort(name, handler);
- goto __out_fini;
-
+ goto __private_goto1;
}
struct start_args {
From 695d0e56ea33eda4a205316a7f9c6e2e93d0761c Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 15:38:49 +0100
Subject: [PATCH 5/8] start: add missing TRACE() call
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/start.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 365b07d249..d33fd4e346 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -959,6 +959,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
TRACE("Set container state to \"STOPPED\"");
} else {
lxc_set_state(name, handler, STOPPED);
+ TRACE("Set container state to \"STOPPED\"");
}
/* Avoid lingering namespace references. */
From 7bdf97d26be920a6e0503cd4caf5c1ae9cbd157d Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 15:45:54 +0100
Subject: [PATCH 6/8] {_}lxc_start: remove "name" argument
as it's directly available in the handler itself.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/execute.c | 2 +-
src/lxc/lxc.h | 6 ++----
src/lxc/lxccontainer.c | 4 ++--
src/lxc/start.c | 10 +++++-----
src/lxc/start.h | 5 ++---
5 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/lxc/execute.c b/src/lxc/execute.c
index 1cff0eda1b..7dd835862f 100644
--- a/src/lxc/execute.c
+++ b/src/lxc/execute.c
@@ -96,6 +96,6 @@ int lxc_execute(const char *name, char *const argv[], int quiet,
TRACE("Doing lxc_execute");
handler->conf->is_execute = true;
- return __lxc_start(name, handler, &execute_start_ops, &args, lxcpath,
+ return __lxc_start(handler, &execute_start_ops, &args, lxcpath,
daemonize, error_num);
}
diff --git a/src/lxc/lxc.h b/src/lxc/lxc.h
index a58ca5f1ba..630eff0b49 100644
--- a/src/lxc/lxc.h
+++ b/src/lxc/lxc.h
@@ -27,15 +27,13 @@ struct lxc_handler;
/*
* Start the specified command inside a system container
- * @name : the name of the container
* @argv : an array of char * corresponding to the command line
* @conf : configuration
* @daemonize : whether or not the container is daemonized
* Returns 0 on success, < 0 otherwise
*/
-extern int lxc_start(const char *name, char *const argv[],
- struct lxc_handler *handler, const char *lxcpath,
- bool daemonize, int *error_num);
+extern int lxc_start(char *const argv[], struct lxc_handler *handler,
+ const char *lxcpath, bool daemonize, int *error_num);
/*
* Start the specified command inside an application container
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 06a1eb9b61..55eaf50b3f 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -1117,8 +1117,8 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
ret = lxc_execute(c->name, argv, 1, handler, c->config_path,
c->daemonize, &c->error_num);
else
- ret = lxc_start(c->name, argv, handler, c->config_path,
- c->daemonize, &c->error_num);
+ ret = lxc_start(argv, handler, c->config_path, c->daemonize,
+ &c->error_num);
if (conf->reboot == REBOOT_REQ) {
INFO("Container requested reboot");
diff --git a/src/lxc/start.c b/src/lxc/start.c
index d33fd4e346..08f336cf04 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -1879,11 +1879,11 @@ static int lxc_spawn(struct lxc_handler *handler)
return -1;
}
-int __lxc_start(const char *name, struct lxc_handler *handler,
- struct lxc_operations* ops, void *data, const char *lxcpath,
- bool daemonize, int *error_num)
+int __lxc_start(struct lxc_handler *handler, struct lxc_operations *ops,
+ void *data, const char *lxcpath, bool daemonize, int *error_num)
{
int ret, status;
+ const char *name = handler->name;
struct lxc_conf *conf = handler->conf;
struct cgroup_ops *cgroup_ops;
@@ -2052,7 +2052,7 @@ static struct lxc_operations start_ops = {
.post_start = post_start
};
-int lxc_start(const char *name, char *const argv[], struct lxc_handler *handler,
+int lxc_start(char *const argv[], struct lxc_handler *handler,
const char *lxcpath, bool daemonize, int *error_num)
{
struct start_args start_arg = {
@@ -2060,7 +2060,7 @@ int lxc_start(const char *name, char *const argv[], struct lxc_handler *handler,
};
TRACE("Doing lxc_start");
- return __lxc_start(name, handler, &start_ops, &start_arg, lxcpath, daemonize, error_num);
+ return __lxc_start(handler, &start_ops, &start_arg, lxcpath, daemonize, error_num);
}
static void lxc_destroy_container_on_signal(struct lxc_handler *handler,
diff --git a/src/lxc/start.h b/src/lxc/start.h
index f40b4d661e..370ed9f0ac 100644
--- a/src/lxc/start.h
+++ b/src/lxc/start.h
@@ -161,9 +161,8 @@ extern void lxc_fini(const char *name, struct lxc_handler *handler);
*/
extern int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
int *fds_to_ignore, size_t len_fds);
-extern int __lxc_start(const char *, struct lxc_handler *,
- struct lxc_operations *, void *, const char *, bool,
- int *);
+extern int __lxc_start(struct lxc_handler *, struct lxc_operations *, void *,
+ const char *, bool, int *);
extern int resolve_clone_flags(struct lxc_handler *handler);
From 0c5859ff6863f44c85bc614c33c798eb0e258155 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 15:50:34 +0100
Subject: [PATCH 7/8] tree-wide: remove "name" argument from lxc_{fini,abort}()
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/criu.c | 6 +++---
src/lxc/start.c | 17 +++++++++--------
src/lxc/start.h | 4 ++--
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 59e50047b9..6e56389285 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -1134,8 +1134,8 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
ret = lxc_poll(c->name, handler);
if (ret)
- lxc_abort(c->name, handler);
- lxc_fini(c->name, handler);
+ lxc_abort(handler);
+ lxc_fini(handler);
_exit(ret);
}
@@ -1145,7 +1145,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
if (pipes[1] >= 0)
close(pipes[1]);
- lxc_fini(c->name, handler);
+ lxc_fini(handler);
out:
if (status_pipe >= 0) {
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 08f336cf04..73d46ae39e 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -860,13 +860,14 @@ int lxc_init(const char *name, struct lxc_handler *handler)
return -1;
}
-void lxc_fini(const char *name, struct lxc_handler *handler)
+void lxc_fini(struct lxc_handler *handler)
{
int ret;
pid_t self;
struct lxc_list *cur, *next;
char *namespaces[LXC_NS_MAX + 1];
size_t namespace_count = 0;
+ const char *name = handler->name;
struct cgroup_ops *cgroup_ops = handler->cgroup_ops;
/* The STOPPING state is there for future cleanup code which can take
@@ -1010,12 +1011,12 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
lxc_free_handler(handler);
}
-void lxc_abort(const char *name, struct lxc_handler *handler)
+void lxc_abort(struct lxc_handler *handler)
{
int ret = 0;
int status;
- lxc_set_state(name, handler, ABORTING);
+ lxc_set_state(handler->name, handler, ABORTING);
if (handler->pidfd >= 0) {
ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0);
@@ -1870,7 +1871,7 @@ static int lxc_spawn(struct lxc_handler *handler)
lxc_delete_network(handler);
out_abort:
- lxc_abort(name, handler);
+ lxc_abort(handler);
out_sync_fini:
lxc_sync_fini(handler);
@@ -2006,21 +2007,21 @@ int __lxc_start(struct lxc_handler *handler, struct lxc_operations *ops,
detach_block_device(handler->conf);
__private_goto3:
- lxc_fini(name, handler);
+ lxc_fini(handler);
return ret;
/* These are the droids you are looking for. */
out_abort:
- lxc_abort(name, handler);
+ lxc_abort(handler);
goto __private_goto3;
out_detach_blockdev:
- lxc_abort(name, handler);
+ lxc_abort(handler);
goto __private_goto2;
out_delete_network:
- lxc_abort(name, handler);
+ lxc_abort(handler);
goto __private_goto1;
}
diff --git a/src/lxc/start.h b/src/lxc/start.h
index 370ed9f0ac..2c3edd8c08 100644
--- a/src/lxc/start.h
+++ b/src/lxc/start.h
@@ -142,7 +142,7 @@ extern int lxc_set_state(const char *name, struct lxc_handler *handler,
extern int lxc_serve_state_clients(const char *name,
struct lxc_handler *handler,
lxc_state_t state);
-extern void lxc_abort(const char *name, struct lxc_handler *handler);
+extern void lxc_abort(struct lxc_handler *handler);
extern struct lxc_handler *lxc_init_handler(const char *name,
struct lxc_conf *conf,
const char *lxcpath,
@@ -150,7 +150,7 @@ extern struct lxc_handler *lxc_init_handler(const char *name,
extern void lxc_zero_handler(struct lxc_handler *handler);
extern void lxc_free_handler(struct lxc_handler *handler);
extern int lxc_init(const char *name, struct lxc_handler *handler);
-extern void lxc_fini(const char *name, struct lxc_handler *handler);
+extern void lxc_fini(struct lxc_handler *handler);
/* lxc_check_inherited: Check for any open file descriptors and close them if
* requested.
From fd5be714fb001f756c0ce2a81484f547ee02cfe6 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 15 Mar 2020 15:52:30 +0100
Subject: [PATCH 8/8] tree-wide: s/lxc_fini()/lxc_end()/g
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/criu.c | 4 ++--
src/lxc/start.c | 4 ++--
src/lxc/start.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 6e56389285..e74bd4ddca 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -1135,7 +1135,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
ret = lxc_poll(c->name, handler);
if (ret)
lxc_abort(handler);
- lxc_fini(handler);
+ lxc_end(handler);
_exit(ret);
}
@@ -1145,7 +1145,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
if (pipes[1] >= 0)
close(pipes[1]);
- lxc_fini(handler);
+ lxc_end(handler);
out:
if (status_pipe >= 0) {
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 73d46ae39e..c82fb89887 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -860,7 +860,7 @@ int lxc_init(const char *name, struct lxc_handler *handler)
return -1;
}
-void lxc_fini(struct lxc_handler *handler)
+void lxc_end(struct lxc_handler *handler)
{
int ret;
pid_t self;
@@ -2007,7 +2007,7 @@ int __lxc_start(struct lxc_handler *handler, struct lxc_operations *ops,
detach_block_device(handler->conf);
__private_goto3:
- lxc_fini(handler);
+ lxc_end(handler);
return ret;
diff --git a/src/lxc/start.h b/src/lxc/start.h
index 2c3edd8c08..7e2371c74b 100644
--- a/src/lxc/start.h
+++ b/src/lxc/start.h
@@ -150,7 +150,7 @@ extern struct lxc_handler *lxc_init_handler(const char *name,
extern void lxc_zero_handler(struct lxc_handler *handler);
extern void lxc_free_handler(struct lxc_handler *handler);
extern int lxc_init(const char *name, struct lxc_handler *handler);
-extern void lxc_fini(struct lxc_handler *handler);
+extern void lxc_end(struct lxc_handler *handler);
/* lxc_check_inherited: Check for any open file descriptors and close them if
* requested.
More information about the lxc-devel
mailing list