[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100105141146.GD6836@linux.vnet.ibm.com>
Date: Tue, 5 Jan 2010 06:11:46 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: ebiederm@...ssion.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [1/9] Add rcustring ADT for RCU protected strings v2
On Tue, Jan 05, 2010 at 11:47:46AM +0100, Andi Kleen wrote:
> On Mon, Jan 04, 2010 at 09:32:52PM -0800, Paul E. McKenney wrote:
> > > +/*
> > > + * Get a local private copy of a RCU protected string.
> > > + * Mostly useful to get a string that is stable while sleeping.
> > > + * Caller must free returned string.
> > > + */
> > > +char *access_rcu_string(char **str, int size, gfp_t gfp)
> > > +{
> > > + char *copy = kmalloc(size, gfp);
> > > + if (!str)
> > > + return NULL;
> > > + rcu_read_lock();
> > > + strlcpy(copy, rcu_dereference(*str), size);
> >
> > What if "str" is non-NULL, but "*str" is NULL? Or is that disallowed
> > somehow?
>
> I would consider it disallowed, all the strings have some default value.
> Empty string would be ""
>
> If we allowed it the caller couldn't easily distingush error from expected NULL.
OK, then:
Reviewed-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Thanx, Paul
--
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