[ovs-dev] [PATCH V2 06/11] compat: Add FIELD_SIZEOF macro

Yi-Hung Wei yihung.wei at gmail.com
Fri Feb 28 00:38:07 UTC 2020


On Wed, Feb 26, 2020 at 9:42 AM Greg Rose <gvrose8192 at gmail.com> wrote:
>
> The FIELD_SIZEOF macro is removed in Linux kernel release 5.5 but
> is still needed in our out of tree kernel module for compatibility
> with older kernels.
>
> Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
> ---
>  datapath/linux/compat/include/linux/kernel.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h
> index 2e81abc..8529b1d 100644
> --- a/datapath/linux/compat/include/linux/kernel.h
> +++ b/datapath/linux/compat/include/linux/kernel.h
> @@ -32,4 +32,8 @@
>  #define U32_MAX                ((u32)~0U)
>  #endif
>
> +#ifndef FIELD_SIZEOF
> +#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
> +#endif
> +
>  #endif /* linux/kernel.h */
> --

Hi Greg,

Thanks for the patch. I think we generally want to keep files in
./datapath/*.c|h to be in sync with upstream kernel, and we backports
the missing function in the older kernel.

As upstream patch c593642c8be04 ("treewide: Use sizeof_field() macro")
replaces FIELD_SIZEOF with sizeof_field(), should we update
FIELD_SIZEOF to sizeof_field() in datapath.c and flow.h and backports
sizeof_field() if necessary?

Thanks,

-Yi-Hung


More information about the dev mailing list