|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 1/5] tools: add container_of() macro to xen-tools/common-macros.h
On 22.03.2023 13:08, Juergen Gross wrote:
> --- a/tools/include/xen-tools/common-macros.h
> +++ b/tools/include/xen-tools/common-macros.h
> @@ -76,4 +76,8 @@
> #define __must_check __attribute__((__warn_unused_result__))
> #endif
>
> +#define container_of(ptr, type, member) ({ \
> + typeof( ((type *)0)->member ) *__mptr = (ptr); \
> + (type *)( (char *)__mptr - offsetof(type,member) );})
Can the variant used here please be closer to ...
> --- a/tools/tests/x86_emulator/x86-emulate.h
> +++ b/tools/tests/x86_emulator/x86-emulate.h
> @@ -56,11 +56,6 @@
>
> #define cf_check /* No Control Flow Integriy checking */
>
> -#define container_of(ptr, type, member) ({ \
> - typeof(((type *)0)->member) *mptr__ = (ptr); \
> - (type *)((char *)mptr__ - offsetof(type, member)); \
> -})
... this rather than ...
> --- a/tools/xenstore/list.h
> +++ b/tools/xenstore/list.h
> @@ -3,6 +3,8 @@
> /* Taken from Linux kernel code, but de-kernelized for userspace. */
> #include <stddef.h>
>
> +#include <xen-tools/common-macros.h>
> +
> #undef LIST_HEAD_INIT
> #undef LIST_HEAD
> #undef INIT_LIST_HEAD
> @@ -15,10 +17,6 @@
> #define LIST_POISON1 ((void *) 0x00100100)
> #define LIST_POISON2 ((void *) 0x00200200)
>
> -#define container_of(ptr, type, member) ({ \
> - typeof( ((type *)0)->member ) *__mptr = (ptr); \
> - (type *)( (char *)__mptr - offsetof(type,member) );})
... this, both formatting-wise (excess blanks) and local-variable-
naming-wise (trailing underscores instead of leading ones)? (If I was
the one to commit this, I'd be happy to make the adjustment at that
time.) Then
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |