[PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jul 28 08:07:14 UTC 2021


On 28/07/2021 09:58, Chris Johns wrote:
>> For what do we need lo_data?
> This field is used in various places for different type of locks so it needs to
> stay.
> 

It seems this is only used to indicate if a lock recursed:

sys/sys/_lock.h:        u_int   lo_data;                /* General class 
specific data. */
sys/sys/sx.h:#define    sx_recurse      lock_object.lo_data
sys/sys/lockmgr.h:#define       lk_recurse      lock_object.lo_data
sys/sys/mutex.h:#define mtx_recurse     lock_object.lo_data
sys/sys/rwlock.h:#define        rw_recurse      lock_object.lo_data

sys/sys/lockmgr.h:#define       lk_recurse      lock_object.lo_data
sys/ufs/ffs/ffs_vnops.c:                        if (result == 0 && 
vp->v_vnlock->lk_recurse == 0) {
sys/ufs/ffs/ffs_vnops.c:                if (result == 0 && 
vp->v_vnlock->lk_recurse == 0) {
sys/ufs/ffs/ffs_vnops.c:            vp->v_vnlock->lk_recurse == 0)
sys/ufs/ffs/ffs_snapshot.c:             for (i = 0; i < 
sn->sn_lock.lk_recurse; i++)
sys/ufs/ffs/ffs_snapshot.c:             while (sn->sn_lock.lk_recurse > 0)
sys/kern/kern_lock.c:   LOCK_LOG_LOCK("XLOCK", &lk->lock_object, 0, 
lk->lk_recurse, file, line);
sys/kern/kern_lock.c:   LOCK_LOG_LOCK("XUNLOCK", &lk->lock_object, 0, 
lk->lk_recurse, file,
sys/kern/kern_lock.c:   lk->lk_recurse = 0;
sys/kern/kern_lock.c:   KASSERT(lk->lk_recurse == 0, ("lockmgr still 
recursed"));
sys/kern/kern_lock.c:           lk->lk_recurse++;
sys/kern/kern_lock.c:               lk->lk_recurse, file, line);
sys/kern/kern_lock.c:           lk->lk_recurse--;
sys/kern/kern_lock.c:           if (lk->lk_recurse == 0)
sys/kern/kern_lock.c:                       lk->lk_recurse, file, line);
sys/kern/kern_lock.c:                   db_printf(" recursed: %d\n", 
lk->lk_recurse);
sys/fs/unionfs/union_subr.c:    lockrec = lvp->v_vnlock->lk_recurse;
sys/fs/nfsclient/nfs_clvnops.c: if (onfault && vp->v_vnlock->lk_recurse 
== 0) {
sys/fs/nfsclient/nfs_clvnops.c:     (lktype == LK_SHARED && 
vp->v_vnlock->lk_recurse > 0)) {

Maybe just

#define lo_data lo_mtx.nest_level

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list