On Fri, Jul 19, 2013 at 08:33:37PM +0900, Namhyung Kim wrote:
> On Wed, 17 Jul 2013 19:49:50 +0200, Jiri Olsa wrote:
> > Introducing swap_header function to make the swapping
> > code more clear and extensible.
> 
> [SNIP]
> >  
> > +static int swap_header(struct perf_file_header *header)
> > +{
> > +   mem_bswap_64(header, offsetof(struct perf_file_header, adds_features));
> > +
> > +   if (header->size != sizeof(*header)) {
> > +           /* Support the previous format */
> > +           if (header->size == offsetof(typeof(*header), adds_features))
> > +                   bitmap_zero(header->adds_features, HEADER_FEAT_BITS);
> > +           else
> > +                   return -1;
> > +   } else
> > +           swap_features(header->adds_features);
> > +
> > +   return 0;
> > +}
> > +
> >  int perf_file_header__read(struct perf_file_header *header,
> >                        struct perf_header *ph, int fd)
> >  {
> > @@ -2562,19 +2578,8 @@ int perf_file_header__read(struct perf_file_header 
> > *header,
> >             return -1;
> >     }
> >  
> > -   if (ph->needs_swap) {
> > -           mem_bswap_64(header, offsetof(struct perf_file_header,
> > -                        adds_features));
> > -   }
> > -
> > -   if (header->size != sizeof(*header)) {
> > -           /* Support the previous format */
> > -           if (header->size == offsetof(typeof(*header), adds_features))
> > -                   bitmap_zero(header->adds_features, HEADER_FEAT_BITS);
> > -           else
> > -                   return -1;
> > -   } else if (ph->needs_swap)
> > -           swap_features(header->adds_features);
> > +   if (ph->needs_swap && swap_header(header))
> > +           return -1;
> 
> Doesn't it change existing behavior?  It looks like supporting previous
> format on a same endian machines will be removed by this patch.

I'll check and try to add v2 perf.data reading test for both endians

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to