Re: Stringbuf, v2

Matthew Wilcox
2007-10-24T20:57:18Z

On Wed, Oct 24, 2007 at 01:51:37PM -0700, Joe Perches wrote:
> On Wed, 2007-10-24 at 13:58 -0600, Matthew Wilcox wrote:
> > - Pass a gfp_t to sb_printk
>
> sb_printf

indeed.

> As it doesn't actually output anything but extends
> a buffer pointer in a struct, perhaps it's better to
> rename sb_printf to sb_sprintf.

printf prints to stdout. fprintf prints to a file. sprintf prints to
a string. sb_printf prints to an sb.

> I believe the common use will be GFP_ATOMIC.

An interesting belief. Of the three users I've converted, one uses
GFP_ATOMIC and two use GFP_KERNEL.

> Perhaps a default wrapper define and a renamed function?
>
> void sb_sprintf_gfp(struct stringbuf *sb, gfp_t gfp, const char *fmt, ...)
>
> #define sb_sprintf(sb, fmt, arg...) \
> sb_sprintf_gfp(sb, GFP_ATOMIC, fmt, ##arg)

If you look at the patches, you'll see that they basically all have a
wrapper around sb_printf that I was able to insert the GFP argument
into, so I don't see this as a win. I hadn't bothered with one for
ISDN, and that one involved much more editing.

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."