Re: [RFC][PATCH 2/5 v2] tracing: Create seq_buf layer in trace_seq
From: Petr Mládek
Date: Fri Jun 27 2014 - 10:56:29 EST
On Fri 2014-06-27 10:21:34, Steven Rostedt wrote:
> On Fri, 27 Jun 2014 15:45:38 +0200
> Petr Mládek <pmladek@xxxxxxx> wrote:
>
> > ad 4th:
> >
> > Both "full" and "overflow" flags seems to have the same meaning.
> > For example, trace_seq_printf() sets "full" on failure even
> > when s->seq.len != s->size.
> >
> >
> > Best Regards,
> > Petr
> >
> > [...]
>
>
> BTW, you shouldn't sign off if you have more comments, I usually stop
> reading when I see someone's signature. Or at the very least, state
> that you have more comments below.
Shame on me. I was about to send the mail but then I decided to add
more comments into the code. :-)
> >
> > > +#define MAX_MEMHEX_BYTES 8U
> > > +#define HEX_CHARS (MAX_MEMHEX_BYTES*2 + 1)
> > > +
> > > +/**
> > > + * seq_buf_putmem_hex - write raw memory into the buffer in ASCII hex
> > > + * @s: seq_buf descriptor
> > > + * @mem: The raw memory to write its hex ASCII representation of
> > > + * @len: The length of the raw memory to copy (in bytes)
> > > + *
> > > + * This is similar to seq_buf_putmem() except instead of just copying the
> > > + * raw memory into the buffer it writes its ASCII representation of it
> > > + * in hex characters.
> > > + *
> > > + * Returns how much it wrote to the buffer.
> > > + */
> > > +int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
> > > + unsigned int len)
> > > +{
> > > + unsigned char hex[HEX_CHARS];
> > > + const unsigned char *data = mem;
> > > + unsigned int start_len;
> > > + int i, j;
> > > + int cnt = 0;
> > > +
> > > + while (len) {
> > > + start_len = min(len, HEX_CHARS - 1);
> >
> > I would do s/start_len/end_len/
> >
> > I know that it depends on the point of view. But iteration between "0"
> > and "end" is better understandable for me :-)
>
> Yeah, I didn't like the name of that variable. I guess end_len is
> better, but still not exactly what I want to call it. Unfortunately, I
> don't know what exactly I want to call it ;-)
Yup, the code is tricky :-) The names like break_len, wrap_len,
split_len, block_len come to my mind.
I would prefer wrap_len after all. But the choice it yours.
Best Regards,
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/