[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251222033807-mutt-send-email-mst@kernel.org>
Date: Mon, 22 Dec 2025 03:39:12 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Cc: Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio Pérez <eperezma@...hat.com>,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] virtio: uapi: avoid usage of libc types
On Mon, Dec 22, 2025 at 09:00:33AM +0100, Thomas Weißschuh wrote:
> 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@...utronix.de>
are you fixing other uses of uintptr_t ?
> ---
> include/uapi/linux/virtio_ring.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
> index f8c20d3de8da..3c478582a3c2 100644
> --- a/include/uapi/linux/virtio_ring.h
> +++ b/include/uapi/linux/virtio_ring.h
> @@ -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));
> }
>
>
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-uapi-virtio-d208b915ca1d
>
> Best regards,
> --
> Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Powered by blists - more mailing lists