[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090226190511.GB6658@nowhere>
Date: Thu, 26 Feb 2009 20:05:12 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>,
Lai Jiangshan <laijs@...fujitsu.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 1/3] add binary printf
On Thu, Feb 26, 2009 at 07:56:35PM +0100, Ingo Molnar wrote:
>
> * Frederic Weisbecker <fweisbec@...il.com> wrote:
>
> > Instead of calling the in/out helper from the decoder, why not
> > calling the decoder from these three functions and let them
> > take the appropriate actions for each decoded format token?
> >
> > Naive example:
> >
> > bstr_printf() {
> > while (decode_format(...))
> > if (type == number)
> > read_number_from_buf()
> > str = number(....)
> > ....
> > }
> >
> > vsnprintf {
> > while (decode_format(...))
> > if (type == number)
> > var_arg(...)
> > str = number(....)
> > ....
> > }
> >
> > vbin_printf {
> > while (decode_format(...))
> > if (type == number)
> > var_arg(...)
> > write_number_to_buffer()
> > ...
> > }
> >
> > And the standard in/out pieces can be invoked through helpers.
>
> ok, that looks rather clean too. And maybe vsnprintf() and
> bstr_printf() could be further unified?
Yes, read process can be unified between vbin_printf and vsnprintf
and write process can be unified between bstr_printf and vsnprintf,
both further than the above example.
> I guess it depends on how it all looks like in the end. Only one
> way to find out ...
Let's try, the practice will tell us more, I'm on it.
Thanks.
> Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists