[PATCH] update-linux-headers: strip endianness-aware __counted_by

Francesco Valla posted 1 patch 2 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261107175443.29012-1-francesco@valla.it
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
scripts/update-linux-headers.sh | 2 ++
1 file changed, 2 insertions(+)
[PATCH] update-linux-headers: strip endianness-aware __counted_by
Posted by Francesco Valla 2 weeks, 1 day ago
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
Re: [PATCH] update-linux-headers: strip endianness-aware __counted_by
Posted by Cornelia Huck 1 week, 5 days ago
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>
Re: [PATCH] update-linux-headers: strip endianness-aware __counted_by
Posted by Francesco Valla 1 week, 5 days ago
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