[CRIU] Re: [PATCH 7/8] sockets: Add SK_HASH_LINK helper
Cyrill Gorcunov
gorcunov at openvz.org
Fri Jan 27 10:52:29 EST 2012
On Fri, Jan 27, 2012 at 07:38:18PM +0400, Pavel Emelyanov wrote:
> 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.
>
This means we need some abstract hash-type as say list-head,
so while we use hashes for different types of entries we
need a macro here.
Cyrill
More information about the CRIU
mailing list