[lxc-devel] [PATCH] Fix ABI compatibility

Serge Hallyn serge.hallyn at ubuntu.com
Mon Jun 1 16:13:12 UTC 2015


Quoting Stéphane Graber (stgraber at 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 <stgraber at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  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 at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list