]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
virtio: uapi: avoid usage of libc types
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Mon, 22 Dec 2025 08:00:33 +0000 (09:00 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 26 Dec 2025 20:00:00 +0000 (15:00 -0500)
Using libc types and headers from the UAPI headers is problematic as it
introduces a dependency on a full C toolchain.

On Linux 'unsigned long' works as a replacement for 'uintptr_t' and does
not depend on libc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20251222-uapi-virtio-v1-1-29390f87bcad@linutronix.de>

include/uapi/linux/virtio_ring.h

index f8c20d3de8da14fc092b8d08283f1b4a7de9451f..3c478582a3c242537c5e0be476e901b574ea72a2 100644 (file)
@@ -31,9 +31,6 @@
  * SUCH DAMAGE.
  *
  * Copyright Rusty Russell IBM Corporation 2007. */
-#ifndef __KERNEL__
-#include <stdint.h>
-#endif
 #include <linux/types.h>
 #include <linux/virtio_types.h>
 
@@ -202,7 +199,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
        vr->num = num;
        vr->desc = p;
        vr->avail = (struct vring_avail *)((char *)p + num * sizeof(struct vring_desc));
-       vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16)
+       vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16)
                + align-1) & ~(align - 1));
 }