[CRIU] Re: [PATCH] parasite: Move selftests into separate helper

Pavel Emelyanov xemul at parallels.com
Fri Oct 12 06:18:22 EDT 2012


On 10/11/2012 08:49 PM, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>

Look at parasite_args() fn I've introduced recently and make the
BUG_ON() there into BUILD_BUG_ON(). After this the BUILD_BUG_ON-s
in parasite can be dropped.

> ---
>  parasite.c |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/parasite.c b/parasite.c
> index 5588f3a..b14782a 100644
> --- a/parasite.c
> +++ b/parasite.c
> @@ -477,14 +477,26 @@ static int fini(void)
>  	return 0;
>  }
>  
> -int __used parasite_service(unsigned int cmd, void *args)
> +static void __always_unused __builtin_self_tests(void)
>  {
> -	BUILD_BUG_ON(sizeof(struct parasite_dump_pages_args) > PARASITE_ARG_SIZE);
> +	/*
> +	 * Please, don't forget to update this routine if
> +	 * you add some new structure into parasite arguments.
> +	 */
> +
>  	BUILD_BUG_ON(sizeof(struct parasite_init_args) > PARASITE_ARG_SIZE);
> +	BUILD_BUG_ON(sizeof(struct parasite_log_args) > PARASITE_ARG_SIZE);
> +	BUILD_BUG_ON(sizeof(struct parasite_dump_pages_args) > PARASITE_ARG_SIZE);
> +	BUILD_BUG_ON(sizeof(struct parasite_dump_sa_args) > PARASITE_ARG_SIZE);
> +	BUILD_BUG_ON(sizeof(struct parasite_dump_itimers_args) > PARASITE_ARG_SIZE);
>  	BUILD_BUG_ON(sizeof(struct parasite_dump_misc) > PARASITE_ARG_SIZE);
> +	BUILD_BUG_ON(sizeof(struct parasite_dump_creds) > PARASITE_ARG_SIZE);
>  	BUILD_BUG_ON(sizeof(struct parasite_dump_tid_info) > PARASITE_ARG_SIZE);
>  	BUILD_BUG_ON(sizeof(struct parasite_drain_fd) > PARASITE_ARG_SIZE);
> +}
>  
> +int __used parasite_service(unsigned int cmd, void *args)
> +{
>  	pr_info("Parasite cmd %d/%x process\n", cmd, cmd);
>  
>  	switch (cmd) {
> 




More information about the CRIU mailing list