Ignore:
Timestamp:
Dec 27, 2018, 7:38:58 PM (5 years ago)
Author:
alain
Message:

Fix several bugs in VFS to support the following
ksh commandis : cp, mv, rm, mkdir, cd, pwd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/rwlock.c

    r603 r610  
    5050    busylock_init( &lock->lock , type );
    5151
    52 #if DEBUG_RWLOCK
     52#if DEBUG_RWLOCK_TYPE
    5353thread_t * this = CURRENT_THREAD;
    54 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     54if( DEBUG_RWLOCK_TYPE == type )
    5555printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
    5656__FUNCTION__, this->process->pid, this->trdid,
     
    7575    {
    7676
    77 #if DEBUG_RWLOCK
    78 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     77#if DEBUG_RWLOCK_TYPE
     78uint32_t lock_type = lock->lock.type;
     79if( DEBUG_RWLOCK_TYPE == lock_type )
    7980printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
    8081__FUNCTION__, this->process->pid, this->trdid,
    81 lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
     82lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
    8283#endif
    8384        // register reader thread in waiting queue
     
    100101    lock->count++;
    101102
    102 #if DEBUG_RWLOCK
    103 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     103#if DEBUG_RWLOCK_TYPE
     104if( DEBUG_RWLOCK_TYPE == lock_type )
    104105printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
    105106__FUNCTION__, this->process->pid, this->trdid,
    106 lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
     107lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
    107108#endif
    108109
     
    127128    {
    128129
    129 #if DEBUG_RWLOCK
    130 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     130#if DEBUG_RWLOCK_TYPE
     131uint32_t lock_type = lock->lock.type;
     132if( DEBUG_RWLOCK_TYPE == lock_type )
    131133printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
    132134__FUNCTION__, this->process->pid, this->trdid,
    133 lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
     135lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
    134136#endif
    135137        // register writer in waiting queue
     
    152154    lock->taken = 1;
    153155
    154 #if DEBUG_RWLOCK
    155 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     156#if DEBUG_RWLOCK_TYPE
     157if( DEBUG_RWLOCK_TYPE == lock_type )
    156158printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
    157159__FUNCTION__, this->process->pid, this->trdid,
    158 lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
     160lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
    159161#endif
    160162
     
    176178    lock->count--;
    177179
    178 #if DEBUG_RWLOCK
     180#if DEBUG_RWLOCK_TYPE
    179181thread_t * this = CURRENT_THREAD;
    180 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     182uint32_t lock_type = lock->lock.type;
     183if( DEBUG_RWLOCK_TYPE == lock_type )
    181184printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
    182185__FUNCTION__, this->process->pid, this->trdid,
    183 lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
     186lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
    184187#endif
    185188
     
    191194        thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list );
    192195
    193 #if DEBUG_RWLOCK
    194 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     196#if DEBUG_RWLOCK_TYPE
     197if( DEBUG_RWLOCK_TYPE == lock_type )
    195198printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    196199__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
    197 lock_type_str[lock->lock.type], local_cxy, lock );
     200lock_type_str[lock_type], local_cxy, lock );
    198201#endif
    199202
     
    213216            thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list );
    214217
    215 #if DEBUG_RWLOCK
    216 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     218#if DEBUG_RWLOCK_TYPE
     219if( DEBUG_RWLOCK_TYPE == lock_type )
    217220printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    218221__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
    219 lock_type_str[lock->lock.type], local_cxy, lock );
     222lock_type_str[lock_type], local_cxy, lock );
    220223#endif
    221224   
     
    245248    lock->taken = 0;
    246249
    247 #if DEBUG_RWLOCK
     250#if DEBUG_RWLOCK_TYPE
    248251thread_t * this = CURRENT_THREAD;
    249 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     252uint32_t lock_type = lock->lock.type;
     253if( DEBUG_RWLOCK_TYPE == lock_type )
    250254printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
    251255__FUNCTION__, this->process->pid, this->trdid,
    252 lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
     256lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
    253257#endif
    254258
     
    259263        thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list );
    260264
    261 #if DEBUG_RWLOCK
    262 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     265#if DEBUG_RWLOCK_TYPE
     266if( DEBUG_RWLOCK_TYPE == lock_type )
    263267printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    264268__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
    265 lock_type_str[lock->lock.type], local_cxy, lock );
     269lock_type_str[lock_type], local_cxy, lock );
    266270#endif
    267271        // remove this waiting thread from waiting list
     
    280284            thread_t * thread = LIST_FIRST( &lock->rd_root , thread_t , wait_list );
    281285
    282 #if DEBUG_RWLOCK
    283 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     286#if DEBUG_RWLOCK_TYPE
     287if( DEBUG_RWLOCK_TYPE == lock_type )
    284288printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    285289__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
    286 lock_type_str[lock->lock.type], local_cxy, lock );
     290lock_type_str[lock_type], local_cxy, lock );
    287291#endif
    288292            // remove this waiting thread from waiting list
Note: See TracChangeset for help on using the changeset viewer.