Add lock annotations to libcuse.

- Add annotations to the lock/unlock function to indicate that the
  function is allowed to lock and unlock the underlying pthread mutex.

- Add __guarded_by() annotations to the global variables.

Approved by:	hselasky@
This commit is contained in:
Ed Schouten 2014-09-01 19:56:28 +00:00
parent 8c8f31e7b2
commit 8da5129816
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270950

View file

@ -79,20 +79,22 @@ struct cuse_dev {
void *priv1;
};
static TAILQ_HEAD(, cuse_dev) h_cuse;
static TAILQ_HEAD(, cuse_dev_entered) h_cuse_entered;
static int f_cuse = -1;
static pthread_mutex_t m_cuse;
static struct cuse_vm_allocation a_cuse[CUSE_ALLOC_UNIT_MAX];
static TAILQ_HEAD(, cuse_dev) h_cuse __guarded_by(m_cuse);
static TAILQ_HEAD(, cuse_dev_entered) h_cuse_entered __guarded_by(m_cuse);
static struct cuse_vm_allocation a_cuse[CUSE_ALLOC_UNIT_MAX]
__guarded_by(m_cuse);
static void
cuse_lock(void)
cuse_lock(void) __locks_exclusive(m_cuse)
{
pthread_mutex_lock(&m_cuse);
}
static void
cuse_unlock(void)
cuse_unlock(void) __unlocks(m_cuse)
{
pthread_mutex_unlock(&m_cuse);
}