>> >> If you make this >> >> + union { >> + struct kvm_vmx_data vmx[1]; >> + struct kvm_svm_data svm[1]; >> + }; >> >> then we can later change it to a zero-sized array with variable-size >> allocation, with no additional code changes. >> > > Why do we want to make it array? I suppose that we only have 1 struct > (either vmx or svm) for each vcpu, no? >
If it's an array of size one, you can refer to the only element with vcpu->vmx->member. If it's later changed to an array of size zero, you can keep the references the same, and change the allocations to kmalloc(sizeof(struct kvm_vcpu) +sizeof(struct kvm_vmx_data)) so that you don't allocate any unnecessary memory. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel