lkml.org 
[lkml]   [2023]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2] tracing/synthetic: use union instead of casts
Date
From: Steven Rostedt
> Sent: 09 August 2023 13:55
> On Wed, 9 Aug 2023 09:14:59 +0200
> Sven Schnelle <svens@linux.ibm.com> wrote:
>
> > --- a/kernel/trace/trace.h
> > +++ b/kernel/trace/trace.h
> > @@ -1295,6 +1295,16 @@ static inline void trace_branch_disable(void)
> > /* set ring buffers to default size if not already done so */
> > int tracing_update_buffers(void);
> >
> > +struct trace_dynamic {
> > + union {
> > + u8 as_u8;
> > + u16 as_u16;
> > + u32 as_u32;
> > + u64 as_u64;
> > + struct trace_dynamic_info as_dynamic;
> > + };
> > +};
> > +
>
> No need to create a structure around a single element union. Also, I would
> like to name it for what it is for.
>
> union trace_synth_field {
> u8 as_u8;
> u16 as_u16;
> u32 as_u32;
> u64 as_u64;
> struct trace_dynamic_info as_dynamic;
> };
>
> Other than that, the patch looks good. Although I still need to test it.

I was wondering if you need the u8 and u16 members at all?
Can't the values just be treated as 32bit?
Both char and short aren't really 'proper' arithmetic types.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

\
 
 \ /
  Last update: 2023-08-14 13:36    [W:0.229 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site