diff options
author | Ed Schouten <ed@FreeBSD.org> | 2014-09-01 19:56:28 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2014-09-01 19:56:28 +0000 |
commit | 8da5129816a8821c034f7a3606d5df306304e86d (patch) | |
tree | de3eb0bed7c1066de2043e1d1623d8329c20b6b0 /lib/libcuse | |
parent | 8c8f31e7b223cfb2bff6d72ce3522aba33f57ba3 (diff) | |
download | src-test-8da5129816a8821c034f7a3606d5df306304e86d.tar.gz src-test-8da5129816a8821c034f7a3606d5df306304e86d.zip |
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@
Notes
Notes:
svn path=/head/; revision=270950
Diffstat (limited to 'lib/libcuse')
-rw-r--r-- | lib/libcuse/cuse_lib.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libcuse/cuse_lib.c b/lib/libcuse/cuse_lib.c index 9d8352f81df1e..707e69d3d29b0 100644 --- a/lib/libcuse/cuse_lib.c +++ b/lib/libcuse/cuse_lib.c @@ -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); } |