[Devel] Re: [PATCH 1/3] Typedefs the read and write functions in cftype

Paul Menage menage at google.com
Thu Oct 4 08:18:22 PDT 2007


On 10/4/07, Pavel Emelyanov <xemul at openvz.org> wrote:
> This is just to reduce the code amount in the future.
>
> Signed-off-by: Pavel Emelyanov <xemul at openvz.org>

Acked-by: Paul Menage <menage at google.com>

>
> ---
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 8747932..0635004 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -178,6 +178,15 @@ struct css_set {
>   *     - the 'cftype' of the file is file->f_dentry->d_fsdata
>   */
>
> +struct cftype;
> +
> +typedef ssize_t (*cft_read) (struct cgroup *cont, struct cftype *cft,
> +                        struct file *file,
> +                        char __user *buf, size_t nbytes, loff_t *ppos);
> +typedef ssize_t (*cft_write) (struct cgroup *cont, struct cftype *cft,
> +                         struct file *file,
> +                         const char __user *buf, size_t nbytes, loff_t *ppos);
> +
>  #define MAX_CFTYPE_NAME 64
>  struct cftype {
>         /* By convention, the name should begin with the name of the
> @@ -185,18 +194,14 @@ struct cftype {
>         char name[MAX_CFTYPE_NAME];
>         int private;
>         int (*open) (struct inode *inode, struct file *file);
> -       ssize_t (*read) (struct cgroup *cont, struct cftype *cft,
> -                        struct file *file,
> -                        char __user *buf, size_t nbytes, loff_t *ppos);
> +       cft_read read;
>         /*
>          * read_uint() is a shortcut for the common case of returning a
>          * single integer. Use it in place of read()
>          */
>         u64 (*read_uint) (struct cgroup *cont, struct cftype *cft);
> -       ssize_t (*write) (struct cgroup *cont, struct cftype *cft,
> -                         struct file *file,
> -                         const char __user *buf, size_t nbytes, loff_t *ppos);
>
> +       cft_write write;
>         /*
>          * write_uint() is a shortcut for the common case of accepting
>          * a single integer (as parsed by simple_strtoull) from
>
>
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list