Skip to contentSkip to conversation

update-linux-headers: strip endianness-aware __counted_by

PATCH In review Francesco Valla 2 participants 3 messages Nov 7 – Nov 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update-linux-headers: strip endianness-aware __counted_by

Deal with the endianness-aware __counted_by_be() and __counted_by_le() annotations in Linux headers just like with __counted_by(): stripping them.

---
 scripts/update-linux-headers.sh | 2 ++
 1 file changed, 2 insertions(+)
scripts/update-linux-headers.sh +2 -0
index 3c3a0e9394d2..d3f843356507 100755
@@ -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/' \
Signature · 1 line
2.56.0
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Francesco Valla

Deal with the endianness-aware __counted_by_be() and __counted_by_le() annotations in Linux headers just like with __counted_by(): stripping them.

---
 scripts/update-linux-headers.sh | 2 ++
 1 file changed, 2 insertions(+)

For virtio-can, I guess?

Quoted 6 lines
scripts/update-linux-headers.sh +0 -0
index 3c3a0e9394d2..d3f843356507 100755

scripts/update-linux-headers.sh cp_portable() { · line 99

Quoted 8 lines
scripts/update-linux-headers.sh +2 -0
@@ -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.

#2 lore raw

10 Nov 2026 11:31:04 Cornelia Huck <[email protected]>:

Quoted 6 lines · Francesco Valla
Quoted 5 lines

Deal with the endianness-aware __counted_by_be() and __counted_by_le() annotations in Linux headers just like with __counted_by(): stripping them.

Quoted 7 lines
Quoted 4 lines

---
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.

Quoted 18 lines
Quoted 6 lines
scripts/update-linux-headers.sh +0 -0
index 3c3a0e9394d2..d3f843356507 100755

scripts/update-linux-headers.sh cp_portable() { · line 99

Quoted 8 lines
scripts/update-linux-headers.sh +2 -0
@@ -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.

Quoted 1 line

Thank you

Regards,
Francesco