On 15/09/2017 09:30, Cornelia Huck wrote: > On Thu, 14 Sep 2017 20:07:37 +0200 > Radim Krčmář <rkrcmar@xxxxxxxxxx> wrote: > >> 2017-09-14 12:06+0200, Cornelia Huck: > >>> /me wonders whether there is a way to avoid them running out of sync... >> >> If we do not want to generate it with an external script, I think the >> simplest is to have a separate file that looks like >> >> #define kvm_exit_reasons \ >> KVM_EXIT(UNKNOWN, 0), \ >> KVM_EXIT(EXCEPTION, 1), \ >> ... >> KVM_EXIT(HYPERV, 27) \ >> >> and include it from both places. The current exit definitions would be >> >> #define KVM_EXIT(reason, code) >> KVM_EXIT_ ## reason = code >> >> #include <the/magic/file> >> >> enum { >> kvm_exit_reasons >> }; >> >> #undef kvm_exit_reasons >> >> and the trace >> >> #define KVM_EXIT(reason, code) >> { code, "KVM_EXIT_" # reason } >> #include <the/magic/file> >> >> ... >> >> __print_symbolic(__entry->reason, kvm_exit_reasons), >> >> ... >> >> #undef kvm_exit_reasons >> >> (Would also work with just "KVM_EXIT(UNKNOWN), ..." and small tweaks.) >> >>> but otoh, not so many exit reasons are being added anyway. >> >> Yes. :) > > Yeah, your approach would work, but it's unlikely to be worth it :) The next one who adds an exit reason will do it then. :) Paolo