[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/common: rwlock: Constify the parameter of _rw_is{,_write}_locked()



commit 720944ea26014a1830f9b44bda13b79e8e7d753b
Author:     Julien Grall <jgrall@xxxxxxxxxx>
AuthorDate: Mon Jan 30 18:28:58 2023 +0000
Commit:     Julien Grall <julien@xxxxxxx>
CommitDate: Thu Feb 16 21:58:26 2023 +0000

    xen/common: rwlock: Constify the parameter of _rw_is{,_write}_locked()
    
    The lock is not meant to be modified by _rw_is{,_write}_locked(). So
    constify it.
    
    This is helpful to be able to assert if the lock is taken when the
    underlying structure is const.
    
    Requested-by: Jan Beulich <jbeulich@xxxxxxxx>
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/xen/rwlock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h
index b8d52a5aa9..e0d2b41c5c 100644
--- a/xen/include/xen/rwlock.h
+++ b/xen/include/xen/rwlock.h
@@ -149,7 +149,7 @@ static inline void _read_unlock_irqrestore(rwlock_t *lock, 
unsigned long flags)
     local_irq_restore(flags);
 }
 
-static inline int _rw_is_locked(rwlock_t *lock)
+static inline int _rw_is_locked(const rwlock_t *lock)
 {
     return atomic_read(&lock->cnts);
 }
@@ -254,7 +254,7 @@ static inline void _write_unlock_irqrestore(rwlock_t *lock, 
unsigned long flags)
     local_irq_restore(flags);
 }
 
-static inline int _rw_is_write_locked(rwlock_t *lock)
+static inline int _rw_is_write_locked(const rwlock_t *lock)
 {
     return (atomic_read(&lock->cnts) & _QW_WMASK) == _QW_LOCKED;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.