Re: [PATCH v2 3/6] KVM: introduce kvm_for_each_memslot macro

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

 



On 11/20/2011 07:21 PM, Avi Kivity wrote:

> On 11/18/2011 11:18 AM, Xiao Guangrong wrote:
>> index bb8728e..10524c0 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -307,6 +307,10 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
>>  	     (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
>>  	     idx++)
>>
>> +#define kvm_for_each_memslot(slots, memslot, i)	\
>> +	for (i = 0; i < (slots)->nmemslots &&	\
>> +	      ({ memslot = &(slots)->memslots[i]; 1; }); i++)
>> +
>>
> 
> Statement expression not needed, you can use the comma operator:
> 
>   i < (slots)->nmemslots && (memslot = @(slots)->memslots[i], true)
> 
> or even
> 
>   memslot = &(slots)->memslots[i], i < (slots)->nmemslots
> 
> or just kill i and make memslot the loop variable.
> 


Good, will fix it in the next version, thanks!

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux