Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jan 2023 23:39:30 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        =?UTF-8?Q?Jean-S=C3=A9bastien_P=C3=A9dron?= <dumbbell@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,  dev-commits-src-main@FreeBSD.org
Subject:   Re: git: a83b3ec719eb - main - linuxkpi: list_sort()'s callback now takes list arguments
Message-ID:  <oo8p59q-p2pn-036-17q6-9p5o8831443@mnoonqbm.arg>
In-Reply-To: <on56374-4qq6-6644-o295-r97oq5701n0@mnoonqbm.arg>
References:  <202301312244.30VMiiuF052081@gitrepo.freebsd.org> <on56374-4qq6-6644-o295-r97oq5701n0@mnoonqbm.arg>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1098556516-623335687-1675208371=:27118
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

On Tue, 31 Jan 2023, Bjoern A. Zeeb wrote:

> On Tue, 31 Jan 2023, Jean-Sébastien Pédron wrote:
>
>> The branch main has been updated by dumbbell (ports committer):
>> 
>> URL: 
>> https://cgit.FreeBSD.org/src/commit/?id=a83b3ec719eb6c53658656b7b90607564d3c64d3
>> 
>> commit a83b3ec719eb6c53658656b7b90607564d3c64d3
>> Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
>> AuthorDate: 2023-01-11 22:22:07 +0000
>> Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
>> CommitDate: 2023-01-31 22:36:33 +0000
>>
>>    linuxkpi: list_sort()'s callback now takes list arguments
>
> Does that description miss a ... takes "const" list ... ?
>
>>    This change breaks the API of `list_sort()`. `LINUXKPI_VERSION >= 51300`
>>    is used to keep the header compatible with both versions of the
>>    prototype.
>
> Given our internals half way through already dal with "const" I see
> little harm in making it const unconditionally.  The actual
> LINUXKPI_VERSION check probably should be around the DECONST lines in
> linux_le_cmp() and in list_sort_thunk ; if we really wanted to not
> lose the "const" half way through for newer versions which are prepared
> for it.
>
> Non-const arguments passed in to list_sort() will still work and we can
> avoid having an extern with const but an implementation without (not
> sure why that's not giving warnings anyway).
>
> Or am I misreading the change?

Never mind, I did.  Too late.

We could still fully pass the const through but that'll indeed need more
#ifdef to the implementation.

/bz

>
>>    Reviewed by:    manu
>>    Approved by:    manu
>>    Differential Revision:  https://reviews.freebsd.org/D38082
>> ---
>> sys/compat/linuxkpi/common/include/linux/list.h | 5 +++++
>> 1 file changed, 5 insertions(+)
>> 
>> diff --git a/sys/compat/linuxkpi/common/include/linux/list.h 
>> b/sys/compat/linuxkpi/common/include/linux/list.h
>> index 80ac57fecf6d..6ec715291807 100644
>> --- a/sys/compat/linuxkpi/common/include/linux/list.h
>> +++ b/sys/compat/linuxkpi/common/include/linux/list.h
>> @@ -504,7 +504,12 @@ static inline int list_is_last(const struct list_head 
>> *list,
>> 	     (pos) && ({ n = (pos)->member.next; 1; });			\
>> 	     pos = hlist_entry_safe(n, typeof(*(pos)), member))
>> 
>> +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 51300
>> +extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void 
>> *priv,
>> +    const struct list_head *a, const struct list_head *b));
>> +#else
>> extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void 
>> *priv,
>>     struct list_head *a, struct list_head *b));
>> +#endif
>> 
>> #endif /* _LINUXKPI_LINUX_LIST_H_ */
>> 
>
>

-- 
Bjoern A. Zeeb                                                     r15:7
--1098556516-623335687-1675208371=:27118--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?oo8p59q-p2pn-036-17q6-9p5o8831443>