Replace _prop_rwlock_tryrdlock() by a macro _PROP_RWLOCK_TRYRDLOCK().
This avoids build failures in stand alone binaries (e.g. bootloaders) where there is no "pa_rwlock" member in the "_prop_array" structure.
This commit is contained in:
parent
4a30ae1037
commit
2916b940f8
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: prop_array.c,v 1.14 2008/05/06 22:57:26 xtraeme Exp $ */
|
||||
/* $NetBSD: prop_array.c,v 1.15 2008/05/07 10:01:50 tron Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -315,7 +315,7 @@ _prop_array_iterator_next_object(void *v)
|
||||
bool acquired;
|
||||
|
||||
_PROP_ASSERT(prop_object_is_array(pa));
|
||||
acquired = _prop_rwlock_tryrdlock(&pa->pa_rwlock);
|
||||
acquired = _PROP_RWLOCK_TRYRDLOCK(&pa->pa_rwlock);
|
||||
_PROP_RWLOCK_OWNED(pa->pa_rwlock);
|
||||
|
||||
if (pa->pa_version != pai->pai_base.pi_version)
|
||||
@ -344,7 +344,7 @@ _prop_array_iterator_reset(void *v)
|
||||
bool acquired;
|
||||
|
||||
_PROP_ASSERT(prop_object_is_array(pa));
|
||||
acquired = _prop_rwlock_tryrdlock(&pa->pa_rwlock);
|
||||
acquired = _PROP_RWLOCK_TRYRDLOCK(&pa->pa_rwlock);
|
||||
_PROP_RWLOCK_OWNED(pa->pa_rwlock);
|
||||
|
||||
pai->pai_index = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: prop_dictionary.c,v 1.26 2008/05/06 22:57:26 xtraeme Exp $ */
|
||||
/* $NetBSD: prop_dictionary.c,v 1.27 2008/05/07 10:01:50 tron Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -574,7 +574,7 @@ _prop_dictionary_iterator_next_object(void *v)
|
||||
bool acquired;
|
||||
|
||||
_PROP_ASSERT(prop_object_is_dictionary(pd));
|
||||
acquired = _prop_rwlock_tryrdlock(&pd->pd_rwlock);
|
||||
acquired = _PROP_RWLOCK_TRYRDLOCK(&pd->pd_rwlock);
|
||||
_PROP_RWLOCK_OWNED(pd->pd_rwlock);
|
||||
|
||||
if (pd->pd_version != pdi->pdi_base.pi_version)
|
||||
@ -603,7 +603,7 @@ _prop_dictionary_iterator_reset(void *v)
|
||||
bool acquired;
|
||||
|
||||
_PROP_ASSERT(prop_object_is_dictionary(pd));
|
||||
acquired = _prop_rwlock_tryrdlock(&pd->pd_rwlock);
|
||||
acquired = _PROP_RWLOCK_TRYRDLOCK(&pd->pd_rwlock);
|
||||
_PROP_RWLOCK_OWNED(pd->pd_rwlock);
|
||||
|
||||
pdi->pdi_index = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: prop_object_impl.h,v 1.23 2008/05/07 05:40:01 simonb Exp $ */
|
||||
/* $NetBSD: prop_object_impl.h,v 1.24 2008/05/07 10:01:50 tron Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
@ -259,19 +259,14 @@ struct _prop_object_iterator {
|
||||
#define _PROP_MUTEX_LOCK(x) simple_lock(&(x))
|
||||
#define _PROP_MUTEX_UNLOCK(x) simple_unlock(&(x))
|
||||
|
||||
#define _PROP_RWLOCK_DECL(x) krwlock_t x ;
|
||||
#define _PROP_RWLOCK_INIT(x) rw_init(&(x))
|
||||
#define _PROP_RWLOCK_RDLOCK(x) rw_enter(&(x), RW_READER)
|
||||
#define _PROP_RWLOCK_WRLOCK(x) rw_enter(&(x), RW_WRITER)
|
||||
#define _PROP_RWLOCK_UNLOCK(x) rw_exit(&(x))
|
||||
#define _PROP_RWLOCK_DESTROY(x) rw_destroy(&(x))
|
||||
#define _PROP_RWLOCK_OWNED(x) _PROP_ASSERT(rw_lock_held(&(x)))
|
||||
|
||||
static __inline int
|
||||
_prop_rwlock_tryrdlock(krwlock_t *lock)
|
||||
{
|
||||
return rw_tryenter(lock, RW_READER);
|
||||
}
|
||||
#define _PROP_RWLOCK_DECL(x) krwlock_t x ;
|
||||
#define _PROP_RWLOCK_INIT(x) rw_init(&(x))
|
||||
#define _PROP_RWLOCK_RDLOCK(x) rw_enter(&(x), RW_READER)
|
||||
#define _PROP_RWLOCK_WRLOCK(x) rw_enter(&(x), RW_WRITER)
|
||||
#define _PROP_RWLOCK_UNLOCK(x) rw_exit(&(x))
|
||||
#define _PROP_RWLOCK_DESTROY(x) rw_destroy(&(x))
|
||||
#define _PROP_RWLOCK_OWNED(x) _PROP_ASSERT(rw_lock_held(&(x)))
|
||||
#define _PROP_RWLOCK_TRYRDLOCK(x) rw_tryenter((x), RW_READER)
|
||||
|
||||
#elif defined(_STANDALONE)
|
||||
|
||||
@ -302,19 +297,14 @@ void * _prop_standalone_realloc(void *, size_t);
|
||||
#define _PROP_MUTEX_LOCK(x) /* nothing */
|
||||
#define _PROP_MUTEX_UNLOCK(x) /* nothing */
|
||||
|
||||
#define _PROP_RWLOCK_DECL(x) /* nothing */
|
||||
#define _PROP_RWLOCK_INIT(x) /* nothing */
|
||||
#define _PROP_RWLOCK_RDLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_WRLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_UNLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_DESTROY(x) /* nothing */
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
|
||||
static __inline int
|
||||
_prop_rwlock_tryrdlock(void *v __unused)
|
||||
{
|
||||
return 0; /* dummy */
|
||||
}
|
||||
#define _PROP_RWLOCK_DECL(x) /* nothing */
|
||||
#define _PROP_RWLOCK_INIT(x) /* nothing */
|
||||
#define _PROP_RWLOCK_RDLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_WRLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_UNLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_DESTROY(x) /* nothing */
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
#define _PROP_RWLOCK_TRYRDLOCK(x) 0
|
||||
|
||||
#else
|
||||
|
||||
@ -352,19 +342,14 @@ _prop_rwlock_tryrdlock(void *v __unused)
|
||||
#define _PROP_MUTEX_LOCK(x) mutex_lock(&(x))
|
||||
#define _PROP_MUTEX_UNLOCK(x) mutex_unlock(&(x))
|
||||
|
||||
#define _PROP_RWLOCK_DECL(x) rwlock_t x ;
|
||||
#define _PROP_RWLOCK_INIT(x) rwlock_init(&(x), NULL)
|
||||
#define _PROP_RWLOCK_RDLOCK(x) rwlock_rdlock(&(x))
|
||||
#define _PROP_RWLOCK_WRLOCK(x) rwlock_wrlock(&(x))
|
||||
#define _PROP_RWLOCK_UNLOCK(x) rwlock_unlock(&(x))
|
||||
#define _PROP_RWLOCK_DESTROY(x) rwlock_destroy(&(x))
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
|
||||
static __inline int
|
||||
_prop_rwlock_tryrdlock(rwlock_t *lock)
|
||||
{
|
||||
return rwlock_tryrdlock(lock);
|
||||
}
|
||||
#define _PROP_RWLOCK_DECL(x) rwlock_t x ;
|
||||
#define _PROP_RWLOCK_INIT(x) rwlock_init(&(x), NULL)
|
||||
#define _PROP_RWLOCK_RDLOCK(x) rwlock_rdlock(&(x))
|
||||
#define _PROP_RWLOCK_WRLOCK(x) rwlock_wrlock(&(x))
|
||||
#define _PROP_RWLOCK_UNLOCK(x) rwlock_unlock(&(x))
|
||||
#define _PROP_RWLOCK_DESTROY(x) rwlock_destroy(&(x))
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
#define _PROP_RWLOCK_TRYRDLOCK(x) rwlock_tryrdlock(x)
|
||||
|
||||
#elif defined(HAVE_NBTOOL_CONFIG_H)
|
||||
/*
|
||||
@ -374,19 +359,14 @@ _prop_rwlock_tryrdlock(rwlock_t *lock)
|
||||
#define _PROP_MUTEX_LOCK(x) /* nothing */
|
||||
#define _PROP_MUTEX_UNLOCK(x) /* nothing */
|
||||
|
||||
#define _PROP_RWLOCK_DECL(x) /* nothing */
|
||||
#define _PROP_RWLOCK_INIT(x) /* nothing */
|
||||
#define _PROP_RWLOCK_RDLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_WRLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_UNLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_DESTROY(x) /* nothing */
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
|
||||
static __inline int
|
||||
_prop_rwlock_tryrdlock(void *v __unused)
|
||||
{
|
||||
return 0; /* dummy */
|
||||
}
|
||||
#define _PROP_RWLOCK_DECL(x) /* nothing */
|
||||
#define _PROP_RWLOCK_INIT(x) /* nothing */
|
||||
#define _PROP_RWLOCK_RDLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_WRLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_UNLOCK(x) /* nothing */
|
||||
#define _PROP_RWLOCK_DESTROY(x) /* nothing */
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
#define _PROP_RWLOCK_TRYRDLOCK(x) 0
|
||||
|
||||
#else
|
||||
/*
|
||||
@ -398,19 +378,14 @@ _prop_rwlock_tryrdlock(void *v __unused)
|
||||
#define _PROP_MUTEX_LOCK(x) pthread_mutex_lock(&(x))
|
||||
#define _PROP_MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
|
||||
|
||||
#define _PROP_RWLOCK_DECL(x) pthread_rwlock_t x ;
|
||||
#define _PROP_RWLOCK_INIT(x) pthread_rwlock_init(&(x), NULL)
|
||||
#define _PROP_RWLOCK_RDLOCK(x) pthread_rwlock_rdlock(&(x))
|
||||
#define _PROP_RWLOCK_WRLOCK(x) pthread_rwlock_wrlock(&(x))
|
||||
#define _PROP_RWLOCK_UNLOCK(x) pthread_rwlock_unlock(&(x))
|
||||
#define _PROP_RWLOCK_DESTROY(x) pthread_rwlock_destroy(&(x))
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
|
||||
static __inline int
|
||||
_prop_rwlock_tryrdlock(pthread_rwlock_t *lock)
|
||||
{
|
||||
return pthread_rwlock_tryrdlock(lock);
|
||||
}
|
||||
#define _PROP_RWLOCK_DECL(x) pthread_rwlock_t x ;
|
||||
#define _PROP_RWLOCK_INIT(x) pthread_rwlock_init(&(x), NULL)
|
||||
#define _PROP_RWLOCK_RDLOCK(x) pthread_rwlock_rdlock(&(x))
|
||||
#define _PROP_RWLOCK_WRLOCK(x) pthread_rwlock_wrlock(&(x))
|
||||
#define _PROP_RWLOCK_UNLOCK(x) pthread_rwlock_unlock(&(x))
|
||||
#define _PROP_RWLOCK_DESTROY(x) pthread_rwlock_destroy(&(x))
|
||||
#define _PROP_RWLOCK_OWNED(x) /* nothing */
|
||||
#define _PROP_RWLOCK_TRYRDLOCK(x) pthread_rwlock_tryrdlock(x)
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user