scripts/update-linux-headers.sh | 2 ++ 1 file changed, 2 insertions(+)
Deal with the endianness-aware __counted_by_be() and __counted_by_le()
annotations in Linux headers just like with __counted_by(): stripping
them.
Signed-off-by: Francesco Valla <francesco@valla.it>
---
scripts/update-linux-headers.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 3c3a0e9394d2..d3f843356507 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -92,6 +92,8 @@ cp_portable() {
-e "$arch_cmd" \
-e 's/__bitwise//' \
-e 's/__counted_by(\w*)//' \
+ -e 's/__counted_by_be(\w*)//' \
+ -e 's/__counted_by_le(\w*)//' \
-e 's/__attribute__((packed))/QEMU_PACKED/' \
-e 's/__inline__/inline/' \
-e 's/__BITS_PER_LONG/HOST_LONG_BITS/' \
--
2.56.0
On Sat, Nov 07 2026, Francesco Valla <francesco@valla.it> wrote:
> Deal with the endianness-aware __counted_by_be() and __counted_by_le()
> annotations in Linux headers just like with __counted_by(): stripping
> them.
>
> Signed-off-by: Francesco Valla <francesco@valla.it>
> ---
> scripts/update-linux-headers.sh | 2 ++
> 1 file changed, 2 insertions(+)
For virtio-can, I guess?
>
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index 3c3a0e9394d2..d3f843356507 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -92,6 +92,8 @@ cp_portable() {
> -e "$arch_cmd" \
> -e 's/__bitwise//' \
> -e 's/__counted_by(\w*)//' \
> + -e 's/__counted_by_be(\w*)//' \
> + -e 's/__counted_by_le(\w*)//' \
> -e 's/__attribute__((packed))/QEMU_PACKED/' \
> -e 's/__inline__/inline/' \
> -e 's/__BITS_PER_LONG/HOST_LONG_BITS/' \
Not sure if we would want to kill all the __counted_by* birds with one
stone, but let's not overthink this.
Acked-by: Cornelia Huck <cohuck@redhat.com>
10 Nov 2026 11:31:04 Cornelia Huck <cohuck@redhat.com>:
> On Sat, Nov 07 2026, Francesco Valla <francesco@valla.it> wrote:
>
>> Deal with the endianness-aware __counted_by_be() and __counted_by_le()
>> annotations in Linux headers just like with __counted_by(): stripping
>> them.
>>
>> Signed-off-by: Francesco Valla <francesco@valla.it>
>> ---
>> scripts/update-linux-headers.sh | 2 ++
>> 1 file changed, 2 insertions(+)
>
> For virtio-can, I guess?
>
Correct. That's the usecase that needs this at the moment.
>>
>> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
>> index 3c3a0e9394d2..d3f843356507 100755
>> --- a/scripts/update-linux-headers.sh
>> +++ b/scripts/update-linux-headers.sh
>> @@ -92,6 +92,8 @@ cp_portable() {
>> -e "$arch_cmd" \
>> -e 's/__bitwise//' \
>> -e 's/__counted_by(\w*)//' \
>> + -e 's/__counted_by_be(\w*)//' \
>> + -e 's/__counted_by_le(\w*)//' \
>> -e 's/__attribute__((packed))/QEMU_PACKED/' \
>> -e 's/__inline__/inline/' \
>> -e 's/__BITS_PER_LONG/HOST_LONG_BITS/' \
>
> Not sure if we would want to kill all the __counted_by* birds with one
> stone, but let's not overthink this.
>
> Acked-by: Cornelia Huck <cohuck@redhat.com>
Thank you
Regards,
Francesco
© 2016 - 2026 Red Hat, Inc.