[CRIU] Re: [PATCH 7/8] sockets: Add SK_HASH_LINK helper

Pavel Emelyanov xemul at parallels.com
Fri Jan 27 10:38:18 EST 2012


On 01/27/2012 04:36 PM, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  sockets.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/sockets.c b/sockets.c
> index 6c65bf2..7689b37 100644
> --- a/sockets.c
> +++ b/sockets.c
> @@ -68,9 +68,13 @@ struct inet_sk_desc {
>  	unsigned int		src_addr[4];
>  };
>  
> -#define SK_HASH_SIZE	32
> -static struct socket_desc *sockets[SK_HASH_SIZE];
>  
> +#define SK_HASH_SIZE		32
> +#define SK_HASH_LINK(head, key, elem)					\
> +	do {								\
> +		(elem)->next = (head)[(key) % SK_HASH_SIZE];		\
> +		(head)[(key) % SK_HASH_SIZE] = (elem);			\
> +	} while (0)

Make it function, not macros.


More information about the CRIU mailing list