Re: [lxc-devel] [PATCH] Fix ABI compatibility

2015-06-01 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com):
> Until we bump the SONAME to liblxc2, only symbol additions and struct
> member additions are allowed.
> 
> Adding struct members in the middle of the struct breaks backward
> compatibility.
> 
> This commit makes it clear when struct members were added and moves a
> few members that were added in the middle of the 1.0 struct to the end
> of it.
> 
> Note that unfortunately that means we're breaking backward compatibility
> between LXC 1.1.0 and the state after this commit, given 1.1 is
> reasonably new, this is the least damaging way of fixing the problem.
> 
> Signed-off-by: Stéphane Graber 

Acked-by: Serge E. Hallyn 

> ---
>  src/lxc/lxccontainer.h | 44 
>  1 file changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
> index a136a43..d60e19a 100644
> --- a/src/lxc/lxccontainer.h
> +++ b/src/lxc/lxccontainer.h
> @@ -286,17 +286,6 @@ struct lxc_container {
>   bool (*destroy)(struct lxc_container *c);
>  
>   /*!
> -  * \brief Delete the container and all its snapshots.
> -  *
> -  * \param c Container.
> -  *
> -  * \return \c true on success, else \c false.
> -  *
> -  * \note Container must be stopped.
> -  */
> - bool (*destroy_with_snapshots)(struct lxc_container *c);
> -
> - /*!
>* \brief Save configuaration to a file.
>*
>* \param c Container.
> @@ -718,15 +707,6 @@ struct lxc_container {
>   bool (*snapshot_destroy)(struct lxc_container *c, const char *snapname);
>  
>   /*!
> -  * \brief Destroy all the container's snapshot.
> -  *
> -  * \param c Container.
> -  *
> -  * \return \c true on success, else \c false.
> -  */
> - bool (*snapshot_destroy_all)(struct lxc_container *c);
> -
> - /*!
>* \brief Determine if the caller may control the container.
>*
>* \param c Container.
> @@ -761,6 +741,8 @@ struct lxc_container {
>*/
>   bool (*remove_device_node)(struct lxc_container *c, const char 
> *src_path, const char *dest_path);
>  
> + /* Post LXC-1.0 additions */
> +
>   /*!
>* \brief Add specified netdev to the container.
>*
> @@ -804,6 +786,28 @@ struct lxc_container {
>*
>*/
>   bool (*restore)(struct lxc_container *c, char *directory, bool verbose);
> +
> + /*!
> +  * \brief Delete the container and all its snapshots.
> +  *
> +  * \param c Container.
> +  *
> +  * \return \c true on success, else \c false.
> +  *
> +  * \note Container must be stopped.
> +  */
> + bool (*destroy_with_snapshots)(struct lxc_container *c);
> +
> + /*!
> +  * \brief Destroy all the container's snapshot.
> +  *
> +  * \param c Container.
> +  *
> +  * \return \c true on success, else \c false.
> +  */
> + bool (*snapshot_destroy_all)(struct lxc_container *c);
> +
> + /* Post LXC-1.1 additions */
>  };
>  
>  /*!
> -- 
> 2.1.4
> 
> ___
> lxc-devel mailing list
> lxc-devel@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [PATCH] c/r: remember to clean up pidfile

2015-06-01 Thread Tycho Andersen
When restoring, we didn't clean up the pidfile that criu uses to pass us the
init pid on error or success; let's do that.

Signed-off-by: Tycho Andersen 
---
 src/lxc/criu.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 1913473..d45c96c 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -526,6 +526,9 @@ void do_restore(struct lxc_container *c, int pipe, char 
*directory, bool verbose
 
ret = fscanf(f, "%d", (int*) &handler->pid);
fclose(f);
+   if (unlink(pidfile) < 0 && errno != ENOENT)
+   SYSERROR("unlinking pidfile failed");
+
if (ret != 1) {
ERROR("reading restore pid failed");
goto out_fini_handler;
@@ -556,6 +559,8 @@ void do_restore(struct lxc_container *c, int pipe, char 
*directory, bool verbose
 
 out_fini_handler:
lxc_fini(c->name, handler);
+   if (unlink(pidfile) < 0 && errno != ENOENT)
+   SYSERROR("unlinking pidfile failed");
 
 out:
if (pipe >= 0) {
-- 
2.1.4

___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel