tools/virtio: fix build
We use a spinlock now so add a stub. Ignore bogus uninitialized variable warnings. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
f8ce72632f
commit
a24ce06c70
|
@ -4,7 +4,8 @@ test: virtio_test vringh_test
|
|||
virtio_test: virtio_ring.o virtio_test.o
|
||||
vringh_test: vringh_test.o vringh.o virtio_ring.o
|
||||
|
||||
CFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h
|
||||
CFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h
|
||||
LDFLAGS += -lpthread
|
||||
vpath %.c ../../drivers/virtio ../../drivers/vhost
|
||||
mod:
|
||||
${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef SPINLOCK_H_STUB
|
||||
#define SPINLOCK_H_STUB
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
typedef pthread_spinlock_t spinlock_t;
|
||||
|
||||
static inline void spin_lock_init(spinlock_t *lock)
|
||||
{
|
||||
int r = pthread_spin_init(lock, 0);
|
||||
assert(!r);
|
||||
}
|
||||
|
||||
static inline void spin_lock(spinlock_t *lock)
|
||||
{
|
||||
int ret = pthread_spin_lock(lock);
|
||||
assert(!ret);
|
||||
}
|
||||
|
||||
static inline void spin_unlock(spinlock_t *lock)
|
||||
{
|
||||
int ret = pthread_spin_unlock(lock);
|
||||
assert(!ret);
|
||||
}
|
||||
|
||||
static inline void spin_lock_bh(spinlock_t *lock)
|
||||
{
|
||||
spin_lock(lock);
|
||||
}
|
||||
|
||||
static inline void spin_unlock_bh(spinlock_t *lock)
|
||||
{
|
||||
spin_unlock(lock);
|
||||
}
|
||||
|
||||
static inline void spin_lock_irq(spinlock_t *lock)
|
||||
{
|
||||
spin_lock(lock);
|
||||
}
|
||||
|
||||
static inline void spin_unlock_irq(spinlock_t *lock)
|
||||
{
|
||||
spin_unlock(lock);
|
||||
}
|
||||
|
||||
static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long f)
|
||||
{
|
||||
spin_lock(lock);
|
||||
}
|
||||
|
||||
static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long f)
|
||||
{
|
||||
spin_unlock(lock);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -3,6 +3,7 @@
|
|||
#define LINUX_VIRTIO_H
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
struct device {
|
||||
void *parent;
|
||||
|
@ -12,6 +13,7 @@ struct virtio_device {
|
|||
struct device dev;
|
||||
u64 features;
|
||||
struct list_head vqs;
|
||||
spinlock_t vqs_list_lock;
|
||||
};
|
||||
|
||||
struct virtqueue {
|
||||
|
|
Loading…
Reference in New Issue