Date: Mon, 1 Sep 2014 19:56:28 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270950 - head/lib/libcuse Message-ID: <201409011956.s81JuS6a028690@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Mon Sep 1 19:56:28 2014 New Revision: 270950 URL: http://svnweb.freebsd.org/changeset/base/270950 Log: 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@ Modified: head/lib/libcuse/cuse_lib.c Modified: head/lib/libcuse/cuse_lib.c ============================================================================== --- head/lib/libcuse/cuse_lib.c Mon Sep 1 19:20:42 2014 (r270949) +++ head/lib/libcuse/cuse_lib.c Mon Sep 1 19:56:28 2014 (r270950) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409011956.s81JuS6a028690>