[libvirt] [PATCH 1/7] util: Alter virObjectLockRead to return status

Michal Privoznik mprivozn at redhat.com
Mon Jul 31 08:26:54 UTC 2017


On 07/28/2017 08:26 PM, John Ferlan wrote:
> 
> 
> On 07/28/2017 12:56 PM, Pavel Hrdina wrote:
>> On Fri, Jul 28, 2017 at 12:38:55PM -0400, John Ferlan wrote:
>>> Rather than ignore errors, let's have virObjectLockRead check for
>>> the correct usage and issue an error when not properly used so
>>> so that we don't run into situations where the resource we think
>>> we're locking really isn't locked because the void input parameter
>>> wasn't valid.
>>
>> I agree with Dan that this doesn't give any benefit.  We should rather
>> consider start using abort() since this is a programming error, not
>> something that depends on an input from user.  It should not happen if
>> if it does we have serious issues and abort is a best choice.
>>
>> Pavel
>>
> 
> I'm in the minority, but that's fine. I could also change this patch to
> be rename virObjectLockRead to be virObjectRWLockRead as suggested later
> on too.

Actually, me choosing virObjectLockRead over virObjectRWLockRead was
arbitrary. The reason is that my text editor can offer me completions:

virObjectLock
virObjectLockWrite
virObjectLockRead

BTW: Following your reasoning here, it should have been called
virObjectLockableLock() instead of virObjectLock() ;-)
IOW, I'm failing to see the need for 'RW' in the name you're suggesting.

Michal




More information about the libvir-list mailing list