-/* $OpenBSD: virtio.c,v 1.5 2017/05/27 10:24:31 sf Exp $ */
+/* $OpenBSD: virtio.c,v 1.6 2017/05/30 08:35:32 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
}
/* free slot management */
- SIMPLEQ_INIT(&vq->vq_freelist);
+ SLIST_INIT(&vq->vq_freelist);
for (i = 0; i < vq_size; i++) {
- SIMPLEQ_INSERT_TAIL(&vq->vq_freelist,
- &vq->vq_entries[i], qe_list);
+ SLIST_INSERT_HEAD(&vq->vq_freelist, &vq->vq_entries[i],
+ qe_list);
vq->vq_entries[i].qe_index = i;
}
/* device must be already deactivated */
/* confirm the vq is empty */
- SIMPLEQ_FOREACH(qe, &vq->vq_freelist, qe_list) {
+ SLIST_FOREACH(qe, &vq->vq_freelist, qe_list) {
i++;
}
if (i != vq->vq_num) {
{
struct vq_entry *qe;
- if (SIMPLEQ_EMPTY(&vq->vq_freelist))
+ if (SLIST_EMPTY(&vq->vq_freelist))
return NULL;
- qe = SIMPLEQ_FIRST(&vq->vq_freelist);
- SIMPLEQ_REMOVE_HEAD(&vq->vq_freelist, qe_list);
+ qe = SLIST_FIRST(&vq->vq_freelist);
+ SLIST_REMOVE_HEAD(&vq->vq_freelist, qe_list);
return qe;
}
void
vq_free_entry(struct virtqueue *vq, struct vq_entry *qe)
{
- SIMPLEQ_INSERT_TAIL(&vq->vq_freelist, qe, qe_list);
+ SLIST_INSERT_HEAD(&vq->vq_freelist, qe, qe_list);
}
/*
-/* $OpenBSD: virtiovar.h,v 1.3 2017/05/27 10:24:31 sf Exp $ */
+/* $OpenBSD: virtiovar.h,v 1.4 2017/05/30 08:35:32 sf Exp $ */
/* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */
/*
#endif
struct vq_entry {
- SIMPLEQ_ENTRY(vq_entry) qe_list; /* free list */
+ SLIST_ENTRY(vq_entry) qe_list; /* free list */
uint16_t qe_index; /* index in vq_desc array */
/* followings are used only when it is the `head' entry */
int16_t qe_next; /* next enq slot */
/* free entry management */
struct vq_entry *vq_entries;
- SIMPLEQ_HEAD(, vq_entry) vq_freelist;
+ SLIST_HEAD(, vq_entry) vq_freelist;
struct mutex *vq_freelist_lock;
/* enqueue/dequeue status */