lkml.org 
[lkml]   [2022]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 048/144] KVM: selftests: Rename 'struct vcpu' to 'struct kvm_vcpu'
On Wed, Jun 08, 2022, Andrew Jones wrote:
> On Fri, Jun 03, 2022 at 12:41:55AM +0000, Sean Christopherson wrote:
> > Rename 'struct vcpu' to 'struct kvm_vcpu' to align with 'struct kvm_vm'
> > in the selftest, and to give readers a hint that the struct is specific
> > to KVM.
>
> I'm not completely sold on this change. I don't mind that the selftest
> vcpu struct isn't named the same as the KVM vcpu struct, since they're
> different structs.

I don't care about about matching KVM's internal naming exactly, but I do care
about not having a bare "vcpu", it makes searching for usage a pain because it's
impossible to differentiate between instances of the struct and variables of the
same name without additional qualifiers.

> I also don't mind avoiding 'kvm_' prefixes in "KVM selftests" (indeed I
> wonder if we really need the kvm_ prefix for the vm struct).

Same as above, "struct vm *vm" will drive me bonkers :-)

> If we do need prefixes for the kvm selftest framework code to avoid
> collisions with test code, then maybe we should invent something else, rather
> than use the somewhat ambiguous 'kvm', which could also collide with stuff in
> the kvm uapi.

Potential collisions with the KVM uAPI is a feature of sorts, e.g. tests shouldn't
be redefining kvm_* structures (I'd prefer _tests_ not use kvm_* at all, and only
use kvm_* in the library), and I gotta imagine KVM would break at least one real
world userspace if it defined "kvm_vcpu".

That said, I don't have a super strong preference for kvm_ versus something else,
though I think it will be difficult to come up with something that's unique,
intuitive, and doesn't look like a typo.

\
 
 \ /
  Last update: 2022-06-08 18:05    [W:0.207 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site