Skip to content

Commit cb91909

Browse files
eugpermarmstsirkin
authored andcommitted
tools/virtio: Use tools/include/list.h instead of stubs
It should not make any significant difference but reduce stub code. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Link: https://lore.kernel.org/r/20200418102217.32327-9-eperezma@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 1d8bf5c commit cb91909

4 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎tools/virtio/linux/kernel.h‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <linux/compiler.h>
1313
#include <linux/types.h>
14+
#include <linux/list.h>
1415
#include <linux/printk.h>
1516
#include <linux/bug.h>
1617
#include <errno.h>
@@ -135,10 +136,4 @@ static inline void free_page(unsigned long addr)
135136
(void) (&_min1 == &_min2); \
136137
_min1 < _min2 ? _min1 : _min2; })
137138

138-
/* TODO: empty stubs for now. Broken but enough for virtio_ring.c */
139-
#define list_add_tail(a, b) do {} while (0)
140-
#define list_del(a) do {} while (0)
141-
#define list_for_each_entry(a, b, c) while (0)
142-
/* end of stubs */
143-
144139
#endif /* KERNEL_H */

‎tools/virtio/linux/virtio.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ struct device {
1111
struct virtio_device {
1212
struct device dev;
1313
u64 features;
14+
struct list_head vqs;
1415
};
1516

1617
struct virtqueue {
17-
/* TODO: commented as list macros are empty stubs for now.
18-
* Broken but enough for virtio_ring.c
19-
* struct list_head list; */
18+
struct list_head list;
2019
void (*callback)(struct virtqueue *vq);
2120
const char *name;
2221
struct virtio_device *vdev;

‎tools/virtio/virtio_test.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features)
129129
int r;
130130
memset(dev, 0, sizeof *dev);
131131
dev->vdev.features = features;
132+
INIT_LIST_HEAD(&dev->vdev.vqs);
132133
dev->buf_size = 1024;
133134
dev->buf = malloc(dev->buf_size);
134135
assert(dev->buf);

‎tools/virtio/vringh_test.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ static int parallel_test(u64 features,
307307
close(to_host[0]);
308308

309309
gvdev.vdev.features = features;
310+
INIT_LIST_HEAD(&gvdev.vdev.vqs);
310311
gvdev.to_host_fd = to_host[1];
311312
gvdev.notifies = 0;
312313

@@ -453,6 +454,7 @@ int main(int argc, char *argv[])
453454

454455
getrange = getrange_iov;
455456
vdev.features = 0;
457+
INIT_LIST_HEAD(&vdev.vqs);
456458

457459
while (argv[1]) {
458460
if (strcmp(argv[1], "--indirect") == 0)

0 commit comments

Comments
 (0)