提交 f4c753b7 编写于 作者: P Paul Menage 提交者: Linus Torvalds

CGroup API files: rename read/write_uint methods to read_write_u64

Several people have justifiably complained that the "_uint" suffix is
inappropriate for functions that handle u64 values, so this patch just renames
all these functions and their users to have the suffic _u64.

[peterz@infradead.org: build fix]
Signed-off-by: NPaul Menage <menage@google.com>
Cc: "Li Zefan" <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "YAMAMOTO Takashi" <yamamoto@valinux.co.jp>
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3ff31d0c
...@@ -190,20 +190,20 @@ struct cftype { ...@@ -190,20 +190,20 @@ struct cftype {
struct file *file, struct file *file,
char __user *buf, size_t nbytes, loff_t *ppos); char __user *buf, size_t nbytes, loff_t *ppos);
/* /*
* read_uint() is a shortcut for the common case of returning a * read_u64() is a shortcut for the common case of returning a
* single integer. Use it in place of read() * single integer. Use it in place of read()
*/ */
u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft); u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft);
ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
struct file *file, struct file *file,
const char __user *buf, size_t nbytes, loff_t *ppos); const char __user *buf, size_t nbytes, loff_t *ppos);
/* /*
* write_uint() is a shortcut for the common case of accepting * write_u64() is a shortcut for the common case of accepting
* a single integer (as parsed by simple_strtoull) from * a single integer (as parsed by simple_strtoull) from
* userspace. Use in place of write(); return 0 or error. * userspace. Use in place of write(); return 0 or error.
*/ */
int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val); int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val);
int (*release) (struct inode *inode, struct file *file); int (*release) (struct inode *inode, struct file *file);
}; };
......
...@@ -1311,10 +1311,10 @@ enum cgroup_filetype { ...@@ -1311,10 +1311,10 @@ enum cgroup_filetype {
FILE_RELEASE_AGENT, FILE_RELEASE_AGENT,
}; };
static ssize_t cgroup_write_uint(struct cgroup *cgrp, struct cftype *cft, static ssize_t cgroup_write_u64(struct cgroup *cgrp, struct cftype *cft,
struct file *file, struct file *file,
const char __user *userbuf, const char __user *userbuf,
size_t nbytes, loff_t *unused_ppos) size_t nbytes, loff_t *unused_ppos)
{ {
char buffer[64]; char buffer[64];
int retval = 0; int retval = 0;
...@@ -1338,7 +1338,7 @@ static ssize_t cgroup_write_uint(struct cgroup *cgrp, struct cftype *cft, ...@@ -1338,7 +1338,7 @@ static ssize_t cgroup_write_uint(struct cgroup *cgrp, struct cftype *cft,
return -EINVAL; return -EINVAL;
/* Pass to subsystem */ /* Pass to subsystem */
retval = cft->write_uint(cgrp, cft, val); retval = cft->write_u64(cgrp, cft, val);
if (!retval) if (!retval)
retval = nbytes; retval = nbytes;
return retval; return retval;
...@@ -1419,18 +1419,18 @@ static ssize_t cgroup_file_write(struct file *file, const char __user *buf, ...@@ -1419,18 +1419,18 @@ static ssize_t cgroup_file_write(struct file *file, const char __user *buf,
return -ENODEV; return -ENODEV;
if (cft->write) if (cft->write)
return cft->write(cgrp, cft, file, buf, nbytes, ppos); return cft->write(cgrp, cft, file, buf, nbytes, ppos);
if (cft->write_uint) if (cft->write_u64)
return cgroup_write_uint(cgrp, cft, file, buf, nbytes, ppos); return cgroup_write_u64(cgrp, cft, file, buf, nbytes, ppos);
return -EINVAL; return -EINVAL;
} }
static ssize_t cgroup_read_uint(struct cgroup *cgrp, struct cftype *cft, static ssize_t cgroup_read_u64(struct cgroup *cgrp, struct cftype *cft,
struct file *file, struct file *file,
char __user *buf, size_t nbytes, char __user *buf, size_t nbytes,
loff_t *ppos) loff_t *ppos)
{ {
char tmp[64]; char tmp[64];
u64 val = cft->read_uint(cgrp, cft); u64 val = cft->read_u64(cgrp, cft);
int len = sprintf(tmp, "%llu\n", (unsigned long long) val); int len = sprintf(tmp, "%llu\n", (unsigned long long) val);
return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
...@@ -1490,8 +1490,8 @@ static ssize_t cgroup_file_read(struct file *file, char __user *buf, ...@@ -1490,8 +1490,8 @@ static ssize_t cgroup_file_read(struct file *file, char __user *buf,
if (cft->read) if (cft->read)
return cft->read(cgrp, cft, file, buf, nbytes, ppos); return cft->read(cgrp, cft, file, buf, nbytes, ppos);
if (cft->read_uint) if (cft->read_u64)
return cgroup_read_uint(cgrp, cft, file, buf, nbytes, ppos); return cgroup_read_u64(cgrp, cft, file, buf, nbytes, ppos);
return -EINVAL; return -EINVAL;
} }
...@@ -2158,14 +2158,14 @@ static struct cftype files[] = { ...@@ -2158,14 +2158,14 @@ static struct cftype files[] = {
{ {
.name = "notify_on_release", .name = "notify_on_release",
.read_uint = cgroup_read_notify_on_release, .read_u64 = cgroup_read_notify_on_release,
.write = cgroup_common_file_write, .write = cgroup_common_file_write,
.private = FILE_NOTIFY_ON_RELEASE, .private = FILE_NOTIFY_ON_RELEASE,
}, },
{ {
.name = "releasable", .name = "releasable",
.read_uint = cgroup_read_releasable, .read_u64 = cgroup_read_releasable,
.private = FILE_RELEASABLE, .private = FILE_RELEASABLE,
} }
}; };
......
...@@ -65,21 +65,21 @@ static u64 current_css_set_refcount_read(struct cgroup *cont, ...@@ -65,21 +65,21 @@ static u64 current_css_set_refcount_read(struct cgroup *cont,
static struct cftype files[] = { static struct cftype files[] = {
{ {
.name = "cgroup_refcount", .name = "cgroup_refcount",
.read_uint = cgroup_refcount_read, .read_u64 = cgroup_refcount_read,
}, },
{ {
.name = "taskcount", .name = "taskcount",
.read_uint = taskcount_read, .read_u64 = taskcount_read,
}, },
{ {
.name = "current_css_set", .name = "current_css_set",
.read_uint = current_css_set_read, .read_u64 = current_css_set_read,
}, },
{ {
.name = "current_css_set_refcount", .name = "current_css_set_refcount",
.read_uint = current_css_set_refcount_read, .read_u64 = current_css_set_refcount_read,
}, },
}; };
......
...@@ -9057,13 +9057,13 @@ cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, ...@@ -9057,13 +9057,13 @@ cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
} }
#ifdef CONFIG_FAIR_GROUP_SCHED #ifdef CONFIG_FAIR_GROUP_SCHED
static int cpu_shares_write_uint(struct cgroup *cgrp, struct cftype *cftype, static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype,
u64 shareval) u64 shareval)
{ {
return sched_group_set_shares(cgroup_tg(cgrp), shareval); return sched_group_set_shares(cgroup_tg(cgrp), shareval);
} }
static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft) static u64 cpu_shares_read_u64(struct cgroup *cgrp, struct cftype *cft)
{ {
struct task_group *tg = cgroup_tg(cgrp); struct task_group *tg = cgroup_tg(cgrp);
...@@ -9133,8 +9133,8 @@ static struct cftype cpu_files[] = { ...@@ -9133,8 +9133,8 @@ static struct cftype cpu_files[] = {
#ifdef CONFIG_FAIR_GROUP_SCHED #ifdef CONFIG_FAIR_GROUP_SCHED
{ {
.name = "shares", .name = "shares",
.read_uint = cpu_shares_read_uint, .read_u64 = cpu_shares_read_u64,
.write_uint = cpu_shares_write_uint, .write_u64 = cpu_shares_write_u64,
}, },
#endif #endif
#ifdef CONFIG_RT_GROUP_SCHED #ifdef CONFIG_RT_GROUP_SCHED
...@@ -9145,8 +9145,8 @@ static struct cftype cpu_files[] = { ...@@ -9145,8 +9145,8 @@ static struct cftype cpu_files[] = {
}, },
{ {
.name = "rt_period_us", .name = "rt_period_us",
.read_uint = cpu_rt_period_read_uint, .read_u64 = cpu_rt_period_read_uint,
.write_uint = cpu_rt_period_write_uint, .write_u64 = cpu_rt_period_write_uint,
}, },
#endif #endif
}; };
...@@ -9277,8 +9277,8 @@ static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype, ...@@ -9277,8 +9277,8 @@ static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype,
static struct cftype files[] = { static struct cftype files[] = {
{ {
.name = "usage", .name = "usage",
.read_uint = cpuusage_read, .read_u64 = cpuusage_read,
.write_uint = cpuusage_write, .write_u64 = cpuusage_write,
}, },
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册