Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virtio: uapi: avoid usage of libc types

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>

authored by

Thomas Weißschuh and committed by
Michael S. Tsirkin
3c4629b6 d8ee3cfd

+1 -4
+1 -4
include/uapi/linux/virtio_ring.h
··· 31 31 * SUCH DAMAGE. 32 32 * 33 33 * Copyright Rusty Russell IBM Corporation 2007. */ 34 - #ifndef __KERNEL__ 35 - #include <stdint.h> 36 - #endif 37 34 #include <linux/types.h> 38 35 #include <linux/virtio_types.h> 39 36 ··· 199 202 vr->num = num; 200 203 vr->desc = p; 201 204 vr->avail = (struct vring_avail *)((char *)p + num * sizeof(struct vring_desc)); 202 - vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) 205 + vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16) 203 206 + align-1) & ~(align - 1)); 204 207 } 205 208