[PATCH 02/15] virtio: don't use size_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A size_t can have a different size when compiled as
64-bit vs. 32-bit. When unsigned int is what we want,
then make sure unsigned int is what we use.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/chr-testdev.c | 4 ++--
 lib/virtio.c      | 2 +-
 lib/virtio.h      | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c
index 0c9a173a04886..c19424fd44b20 100644
--- a/lib/chr-testdev.c
+++ b/lib/chr-testdev.c
@@ -13,7 +13,7 @@ static struct virtio_device *vcon;
 static struct virtqueue *in_vq, *out_vq;
 static struct spinlock lock;
 
-static void __testdev_send(char *buf, size_t len)
+static void __testdev_send(char *buf, unsigned int len)
 {
 	int ret;
 
@@ -29,8 +29,8 @@ static void __testdev_send(char *buf, size_t len)
 
 void chr_testdev_exit(int code)
 {
+	unsigned int len;
 	char buf[8];
-	int len;
 
 	snprintf(buf, sizeof(buf), "%dq", code);
 	len = strlen(buf);
diff --git a/lib/virtio.c b/lib/virtio.c
index cb496ff2eabd5..9532d1aeb1707 100644
--- a/lib/virtio.c
+++ b/lib/virtio.c
@@ -47,7 +47,7 @@ void vring_init_virtqueue(struct vring_virtqueue *vq, unsigned index,
 	vq->data[i] = NULL;
 }
 
-int virtqueue_add_outbuf(struct virtqueue *_vq, char *buf, size_t len)
+int virtqueue_add_outbuf(struct virtqueue *_vq, char *buf, unsigned int len)
 {
 	struct vring_virtqueue *vq = to_vvq(_vq);
 	unsigned avail;
diff --git a/lib/virtio.h b/lib/virtio.h
index b51899ab998b6..4801e204a469d 100644
--- a/lib/virtio.h
+++ b/lib/virtio.h
@@ -139,7 +139,8 @@ extern void vring_init_virtqueue(struct vring_virtqueue *vq, unsigned index,
 				 bool (*notify)(struct virtqueue *),
 				 void (*callback)(struct virtqueue *),
 				 const char *name);
-extern int virtqueue_add_outbuf(struct virtqueue *vq, char *buf, size_t len);
+extern int virtqueue_add_outbuf(struct virtqueue *vq, char *buf,
+				unsigned int len);
 extern bool virtqueue_kick(struct virtqueue *vq);
 extern void detach_buf(struct vring_virtqueue *vq, unsigned head);
 extern void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len);
-- 
1.9.3

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux