Commit 20b65266 authored by Julien Thierry's avatar Julien Thierry Committed by Will Deacon
Browse files

brlock: fix build with KVM_BRLOCK_DEBUG



Build breaks when using KVM_BRLOCK_DEBUG because the header was seamingly
conceived to be included in a single .c file...

Fix this by moving the definition of the read/write lock into the kvm
struct.
Reviewed-by: Andre Przywara's avatarAndre Przywara <andre.przywara@arm.com>
Signed-off-by: default avatarJulien Thierry <julien.thierry@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 026fb59c
......@@ -21,13 +21,11 @@
#include "kvm/rwsem.h"
DECLARE_RWSEM(brlock_sem);
#define br_read_lock(kvm) down_read(&(kvm)->brlock_sem);
#define br_read_unlock(kvm) up_read(&(kvm)->brlock_sem);
#define br_read_lock(kvm) down_read(&brlock_sem);
#define br_read_unlock(kvm) up_read(&brlock_sem);
#define br_write_lock(kvm) down_write(&brlock_sem);
#define br_write_unlock(kvm) up_write(&brlock_sem);
#define br_write_lock(kvm) down_write(&(kvm)->brlock_sem);
#define br_write_unlock(kvm) up_write(&(kvm)->brlock_sem);
#else
......
......@@ -81,6 +81,10 @@ struct kvm {
int nr_disks;
int vm_state;
#ifdef KVM_BRLOCK_DEBUG
pthread_rwlock_t brlock_sem;
#endif
};
void kvm__set_dir(const char *fmt, ...);
......
......@@ -160,6 +160,10 @@ struct kvm *kvm__new(void)
kvm->sys_fd = -1;
kvm->vm_fd = -1;
#ifdef KVM_BRLOCK_DEBUG
kvm->brlock_sem = (pthread_rwlock_t) PTHREAD_RWLOCK_INITIALIZER;
#endif
return kvm;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment