Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-03-04 Thread Tejun Heo
Hello, On Mon, Mar 04, 2013 at 11:02:37AM +0800, Li Zefan wrote: > > Yeah, that's what I meant by the "anal" part although it seems like > > c99 doesn't even allow that. Do we care tho? It seems like a logical > > feature which should show up in the standard eventually. Maybe it > > could be a pro

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-03-03 Thread Li Zefan
On 2013/3/2 4:45, Tejun Heo wrote: > Hello, Al. > > On Fri, Mar 1, 2013 at 12:39 PM, Al Viro wrote: Flexible array members can be statically initialized. If you wanna be really anal about it, you can do it manually with a wrapping struct but I don't think that would be necessary. >

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-03-01 Thread Tejun Heo
Hello, Al. On Fri, Mar 1, 2013 at 12:39 PM, Al Viro wrote: >> > Flexible array members can be statically initialized. If you wanna be >> > really anal about it, you can do it manually with a wrapping struct >> > but I don't think that would be necessary. >> > >> >> I didn't know this difference b

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-03-01 Thread Al Viro
On Fri, Mar 01, 2013 at 02:36:29PM +0800, Li Zefan wrote: > On 2013/2/28 22:49, Tejun Heo wrote: > > On Wed, Feb 27, 2013 at 10:53 PM, Li Zefan wrote: > >>> static const struct cgroup_name root_cgroup_name = { .name = "/" }; > >> > >> Can't... That's char name[0] not char *name. > > > > Flexible

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-28 Thread Li Zefan
On 2013/2/28 22:49, Tejun Heo wrote: > On Wed, Feb 27, 2013 at 10:53 PM, Li Zefan wrote: >>> static const struct cgroup_name root_cgroup_name = { .name = "/" }; >> >> Can't... That's char name[0] not char *name. > > Flexible array members can be statically initialized. If you wanna be > really an

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-28 Thread Tejun Heo
On Wed, Feb 27, 2013 at 10:53 PM, Li Zefan wrote: >> static const struct cgroup_name root_cgroup_name = { .name = "/" }; > > Can't... That's char name[0] not char *name. Flexible array members can be statically initialized. If you wanna be really anal about it, you can do it manually with a wrapp

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-27 Thread Li Zefan
On 2013/2/27 21:23, Tejun Heo wrote: > On Wed, Feb 27, 2013 at 2:49 AM, Li Zefan wrote: >> Well, cgrp->name is a pointer to struct cgroup_name. >> >> At first I tried to declare cgrp->name as char *, and use container_of() >> to get struct cgroup_name, but it didn't result in simpler code. > > Hm

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-27 Thread Tejun Heo
On Wed, Feb 27, 2013 at 2:49 AM, Li Zefan wrote: > Well, cgrp->name is a pointer to struct cgroup_name. > > At first I tried to declare cgrp->name as char *, and use container_of() > to get struct cgroup_name, but it didn't result in simpler code. Hmmm? But then what prevents defining const stru

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-27 Thread Li Zefan
On 2013/2/26 21:26, Tejun Heo wrote: > Hello, > > On Tue, Feb 26, 2013 at 2:25 AM, Li Zefan wrote: >> Sure we can. We'll have to allocate cgrp->name in cgroup_remount() and >> cgroup_init(), and free cgrp->name in cgroup_kill_sb(). It looks to me >> the current version is a bit simpler. > > Can'

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-26 Thread Tejun Heo
Hello, On Tue, Feb 26, 2013 at 2:25 AM, Li Zefan wrote: > Sure we can. We'll have to allocate cgrp->name in cgroup_remount() and > cgroup_init(), and free cgrp->name in cgroup_kill_sb(). It looks to me > the current version is a bit simpler. Can't we just set it to constant "/"? Root cgroup ini

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-26 Thread Li Zefan
On 2013/2/26 10:27, Tejun Heo wrote: > On Mon, Feb 25, 2013 at 02:17:49PM +0800, Li Zefan wrote: >> cgroup_name() returns the name of a cgroup and it must be called with >> rcu_read_lock() held. >> >> This will be used by cpuset. >> >> Signed-off-by: Li Zefan > ... >> /** >> + * cgroup_name - get

Re: [PATCH 2/3] cgroup: add cgroup_name() API

2013-02-25 Thread Tejun Heo
On Mon, Feb 25, 2013 at 02:17:49PM +0800, Li Zefan wrote: > cgroup_name() returns the name of a cgroup and it must be called with > rcu_read_lock() held. > > This will be used by cpuset. > > Signed-off-by: Li Zefan ... > /** > + * cgroup_name - get the name of a cgroup > + * @cgrp: the cgroup i