[ovs-dev] [PATCH] lockfile: Fix OVS_REQUIRES macro.

William Tu u9012063 at gmail.com
Mon Mar 23 23:34:37 UTC 2020


Pass lock objects, not their addresses, to the annotation macros.

Fixes: f21fa45f3085 ("lockfile: Minor code cleanup.")
Tested-at: https://travis-ci.org/github/williamtu/ovs-travis/builds/666098338
Signed-off-by: William Tu <u9012063 at gmail.com>
---
 lib/lockfile.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/lockfile.c b/lib/lockfile.c
index 36728ff912d9..42782d29e068 100644
--- a/lib/lockfile.c
+++ b/lib/lockfile.c
@@ -61,9 +61,9 @@ static struct hmap *const lock_table OVS_GUARDED_BY(lock_table_mutex)
 static void lockfile_unhash(struct lockfile *);
 static int lockfile_try_lock(const char *name, pid_t *pidp,
                              struct lockfile **lockfilep)
-    OVS_REQUIRES(&lock_table_mutex);
+    OVS_REQUIRES(lock_table_mutex);
 static void lockfile_do_unlock(struct lockfile * lockfile)
-    OVS_REQUIRES(&lock_table_mutex);
+    OVS_REQUIRES(lock_table_mutex);
 
 /* Returns the name of the lockfile that would be created for locking a file
  * named 'filename_'.  The caller is responsible for freeing the returned name,
@@ -188,7 +188,7 @@ lockfile_hash(dev_t device, ino_t inode)
 }
 
 static struct lockfile *
-lockfile_find(dev_t device, ino_t inode) OVS_REQUIRES(&lock_table_mutex)
+lockfile_find(dev_t device, ino_t inode) OVS_REQUIRES(lock_table_mutex)
 {
     struct lockfile *lockfile;
 
@@ -202,7 +202,7 @@ lockfile_find(dev_t device, ino_t inode) OVS_REQUIRES(&lock_table_mutex)
 }
 
 static void
-lockfile_unhash(struct lockfile *lockfile) OVS_REQUIRES(&lock_table_mutex)
+lockfile_unhash(struct lockfile *lockfile) OVS_REQUIRES(lock_table_mutex)
 {
     if (lockfile->fd >= 0) {
         close(lockfile->fd);
@@ -213,7 +213,7 @@ lockfile_unhash(struct lockfile *lockfile) OVS_REQUIRES(&lock_table_mutex)
 
 static struct lockfile *
 lockfile_register(const char *name, dev_t device, ino_t inode, int fd)
-    OVS_REQUIRES(&lock_table_mutex)
+    OVS_REQUIRES(lock_table_mutex)
 {
     struct lockfile *lockfile;
 
@@ -236,7 +236,7 @@ lockfile_register(const char *name, dev_t device, ino_t inode, int fd)
 #ifdef _WIN32
 static void
 lockfile_do_unlock(struct lockfile *lockfile)
-    OVS_REQUIRES(&lock_table_mutex)
+    OVS_REQUIRES(lock_table_mutex)
 {
     if (lockfile->fd >= 0) {
         OVERLAPPED overl;
@@ -252,7 +252,7 @@ lockfile_do_unlock(struct lockfile *lockfile)
 
 static int
 lockfile_try_lock(const char *name, pid_t *pidp, struct lockfile **lockfilep)
-    OVS_REQUIRES(&lock_table_mutex)
+    OVS_REQUIRES(lock_table_mutex)
 {
     HANDLE lock_handle;
     BOOL retval;
@@ -306,7 +306,7 @@ lockfile_do_unlock(struct lockfile *lockfile)
 
 static int
 lockfile_try_lock(const char *name, pid_t *pidp, struct lockfile **lockfilep)
-    OVS_REQUIRES(&lock_table_mutex)
+    OVS_REQUIRES(lock_table_mutex)
 {
     struct flock l;
     struct stat s;
-- 
2.7.4



More information about the dev mailing list