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

Re: [libvirt] [PATCH] Add support for shared sanlock leases

On 06/21/2012 11:00 AM, Federico Simoncelli wrote:
> On Thu, Jun 21, 2012 at 03:37:10PM +0100, Daniel P. Berrange wrote:
>> From: "Daniel P. Berrange" <berrange redhat com>
>> A sanlock lease can be marked as shared (rather
>> than exclusive)  using SANLK_RES_SHARED flag. This
>> adds support for that flag and ensures that in auto
>> disk mode, any shared disks use shared leases. This
>> also makes any read-only disks be completely
>> ignored.

>>          if (driver->autoDiskLease) {
>> -            if (virLockManagerSanlockAddDisk(lock, name, nparams, params) < 0)
>> +            if (virLockManagerSanlockAddDisk(lock, name, nparams, params,
>> +                                             !!(flags & VIR_LOCK_MANAGER_RESOURCE_SHARED)) < 0)
> Just out of curiosity, you are using "!!" (both here and below) because
> the compiler is complaining about the type?

Rather, it is a way of forcing a value to be 0 or 1 with the fewest
characters possible (since the line is already long); shorter than
constructs such as:


But since virLockManagerSanlockAddDisk() declared its argument as bool,
and we already require a C99 compiler, the !! trick is strictly
unnecessary; C99 compilers already guarantee to implicitly convert any
non-zero value to true when doing argument conversion.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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