[PATCH] BPF: use uint16_t for code and uint32_t for k

Roy Marples <[email protected]> Thu, 11 Jun 2026 10:09:41 +0100
Newsgroups gmane.os.hurd.bugs
Message-ID <[email protected]>
This aligns with all other BPF implementations because BPF is 32-bit.
While here, use uint8_t for jt and jf for consistency.

Thanks

Roy
bpf.h.patch (application/octet-stream, 719 B)
commit f7e5f5acb3c13406339550ec79572f851d1ee127
Author: Roy Marples <[email protected]>
Date:   Thu Jun 11 08:45:13 2026 +0000

    BPF: use uint16_t for code and uint32_t for k
    
    This aligns with all other BPF implementations.
    While here, use uint8_t for jt and jf for consistency.

diff --git a/include/device/bpf.h b/include/device/bpf.h
index 1d00e8c6..52f13b3d 100644
--- a/include/device/bpf.h
+++ b/include/device/bpf.h
@@ -182,10 +182,10 @@ struct bpf_version {
  * The instruction data structure.
  */
 struct bpf_insn {
-	unsigned short	code;
-	unsigned char 	jt;
-	unsigned char 	jf;
-	int	k;
+	uint16_t	code;
+	uint8_t		jt;
+	uint8_t 	jf;
+	uint32_t	k;
 };
 typedef struct bpf_insn *bpf_insn_t;