tech-kern archive

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

Re: VOP_ISLOCKED



On Mon Aug 04 2008 at 14:08:57 -0700, Adam Burkepile wrote:
> While working on my project, I think I ran into an error in a man page  
> for a function, VOP_ISLOCKED. The man page describes it as:
> 
>      VOP_ISLOCKED(vp)
>               Test if the vnode vp is locked.  A non-zero value is  
> returned if
>               the vnode is not locked, otherwise zero is returned.
> 
> I believe from what I've been able to tell, it is the opposite. A zero  
> is returned if the vnode is not locked and non-zero value is returned  
> if it is locked (the value representing the appropriate locks).

You're correct, I fixed man page.

> This is the test that I did to find this out:
> 
> printf("1bvp ISLOCKED = %d\n",VOP_ISLOCKED(bvp));             //should 
> have been  locked at this point
> VOP_UNLOCK(bvp, 0);
> printf("2bvp ISLOCKED = %d\n",VOP_ISLOCKED(bvp));             //should be  
> unlocked at this point
> 
> when I do dmesg I get the following results though
> 
> 1bvp ISLOCKED = 2
> 2bvp ISLOCKED = 0
> 
> So as you can see I'm getting the opposite results that I expected.  
> This held up the progress of my project so if this is really wrong, as  
> I suspect, I'd like to fix it so it doesn't confuse anyone else. Can  
> someone confirm this or correct me if I am wrong somehow.

Unfortunately the manual pages especially for file systems are not always
completely accurate.  I suggest reading the source instead of banging
ones head against the wall for lengthy periods.


Home | Main Index | Thread Index | Old Index