[ovs-dev] [PATCH] acinclude: Fix build with kernels with prandom* moved to prandom.h.
Gregory Rose
gvrose8192 at gmail.com
Wed Aug 12 15:42:40 UTC 2020
On 8/12/2020 8:39 AM, Ilya Maximets wrote:
> On 8/12/20 5:25 PM, Gregory Rose wrote:
>>
>>
>> On 8/12/2020 2:26 AM, Ilya Maximets wrote:
>>> Recent commit c0842fbc1b18 ("random32: move the pseudo-random 32-bit
>>> definitions to prandom.h") in upstream kernel moved the definition
>>> of prandom_* functions from random.h to prandom.h. This change was
>>> also backported to stable kernels.
>>>
>>> Fixing our configure script to look for these functions in a new
>>> location and avoid build failures:
>>>
>>> datapath/linux/compat/include/linux/random.h:11:19:
>>> error: redefinition of 'prandom_u32_max'
>>>
>>> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
>>> ---
>>>
>>> This goes down to all branches that claims support for 4.14 and higer.
>>
>>
>> Hi Ilya,
>>
>> I'm working on adding support up to kernel version 5.8 and had to fix
>> this up myself.
>>
>>>
>>> acinclude.m4 | 15 +++++++++++++--
>>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/acinclude.m4 b/acinclude.m4
>>> index 4bac9dbdd..31565ee5e 100644
>>> --- a/acinclude.m4
>>> +++ b/acinclude.m4
>>> @@ -815,8 +815,19 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>>> OVS_GREP_IFELSE([$KSRC/include/linux/random.h],
>>> [prandom_u32[[\(]]],
>>> - [OVS_DEFINE([HAVE_PRANDOM_U32])])
>>> - OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max])
>>> + [OVS_DEFINE([HAVE_PRANDOM_U32])],
>>> + [
>>> + OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h],
>>> + [prandom_u32[[\(]]],
>>> + [OVS_DEFINE([HAVE_PRANDOM_U32])])
>>> + ])
>>> + OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max],
>>> + [OVS_DEFINE([HAVE_PRANDOM_U32_MAX])],
>>> + [
>>> + OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h],
>>> + [prandom_u32_max],
>>> + [OVS_DEFINE([HAVE_PRANDOM_U32_MAX])])
>>> + ])
>>>
>>
>> Seems complex... why not this?
>>
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index e9e15f8b5..30ef2068e 100644
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -817,6 +817,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>> [prandom_u32[[\(]]],
>> [OVS_DEFINE([HAVE_PRANDOM_U32])])
>> OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max])
>> + OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h],
>> + [prandom_u32[[\(]]],
>> + [OVS_DEFINE([HAVE_PRANDOM_U32])])
>> + OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h], [prandom_u32_max])
>
> Hmm. Yes, this looks better. And it will work since we will likely
> not have definitions in both files.
It would result in serious breakage if they were defined in both
headers so I don't think that will be an issue.
>
> I'll send v2.
Thanks!!
- Greg
>
>>
>> Thanks,
>>
>> - Greg
>>
>>
>>> OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [get_link_net])
>>> OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [name_assign_type])
>>>
>
More information about the dev
mailing list