[Devel] Re: [PATCH 1/2] [RFC] Add file f_flags to cgroup write_string ops

Li Zefan lizf at cn.fujitsu.com
Tue Oct 27 18:04:10 PDT 2009


Matt Helsley wrote:
> cgroup subsystems may find the O_APPEND and O_NONBLOCK flags useful
> in determining the way they handle writes. For now only pass these
> flags through the write_string op.
> 
> A subsequent patch will make use of the O_NONBLOCK flag in the
> cgroup freezer write_string op.
> 
> Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
> Cc: Nathan Lynch <ntl at pobox.com>
> Cc: Paul Menage <menage at google.com>
> Cc: Li Zefan <lizf at cn.fujitsu.com>
> 
> (Cc'ing mem controller maintainers in case they find this useful..)
> Cc: Balbir Singh <balbir at linux.vnet.ibm.com>
> Cc: Pavel Emelyanov <xemul at openvz.org>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu at jp.fujitsu.com>
> ---
>  include/linux/cgroup.h   |    3 ++-
>  kernel/cgroup.c          |    5 +++--
>  kernel/cgroup_freezer.c  |    5 ++---
>  kernel/cpuset.c          |    2 +-
>  mm/memcontrol.c          |    2 +-
>  security/device_cgroup.c |    2 +-
>  6 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 90bba9e..627da35 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -315,8 +315,9 @@ struct cftype {
>  	 * buffer of maximum length determined by max_write_len.
>  	 * Returns 0 or -ve error code.
>  	 */
> +#define CFTYPE_F_FLAGS (O_APPEND|O_NONBLOCK)
>  	int (*write_string)(struct cgroup *cgrp, struct cftype *cft,
> -			    const char *buffer);
> +			    unsigned int f_flags, const char *buffer);

I think maybe it's better to store struct file *file to struct cftype,
so we don't need to change write_string(), write(), write_u64()
and write_s64().

>  	/*
>  	 * trigger() callback can be used to get some kick from the
>  	 * userspace, when the actual string written is not important

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list