From: Liu, E. E <eri...@in...> - 2008-04-16 03:13:31
|
Hollis Blanchard wrote: > On Wednesday 09 April 2008 05:01:36 Liu, Eric E wrote: >> +/* This structure represents a single trace buffer record. */ >> +struct kvm_trace_rec { + __u32 event:28; >> + __u32 extra_u32:3; >> + __u32 cycle_in:1; >> + __u32 pid; >> + __u32 vcpu_id; >> + union { >> + struct { >> + __u32 cycle_lo, cycle_hi; >> + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; >> + } cycle; + struct { >> + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; >> + } nocycle; + } u; >> +}; > > Do we really need bitfields here? They are notoriously non-portable. > > Practically speaking, this will prevent me from copying a trace file > from my big-endian target to my little-endian workstation for > analysis, at least without some ugly hacking in the userland tool. Here the main consideration using bitfields is to save storage space for each record, but as you said it is non-portable for your mentioned case, so should we need to adjust the struct like this? __u32 event; __16 extra_u32; __16 cycle_in; |