aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-05-13 12:16:21 -0400
committerTejun Heo <tj@kernel.org>2014-05-13 12:16:21 -0400
commit451af504df0c62f695a69b83c250486e77c66378 (patch)
treef89879cf3f88e9da346d8bd3fa1ae192a280d772 /kernel/cpuset.c
parentb41686401e501430ffe93b575ef7959d2ecc6f2e (diff)
cgroup: replace cftype->write_string() with cftype->write()
Convert all cftype->write_string() users to the new cftype->write() which maps directly to kernfs write operation and has full access to kernfs and cgroup contexts. The conversions are mostly mechanical. * @css and @cft are accessed using of_css() and of_cft() accessors respectively instead of being specified as arguments. * Should return @nbytes on success instead of 0. * @buf is not trimmed automatically. Trim if necessary. Note that blkcg and netprio don't need this as the parsers already handle whitespaces. cftype->write_string() has no user left after the conversions and removed. While at it, remove unnecessary local variable @p in cgroup_subtree_control_write() and stale comment about CGROUP_LOCAL_BUFFER_SIZE in cgroup_freezer.c. This patch doesn't introduce any visible behavior changes. v2: netprio was missing from conversion. Converted. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Aristeu Rozanski <arozansk@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: "David S. Miller" <davem@davemloft.net>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 37ca0a5c226d..2f4b08b8db24 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1603,13 +1603,15 @@ out_unlock:
1603/* 1603/*
1604 * Common handling for a write to a "cpus" or "mems" file. 1604 * Common handling for a write to a "cpus" or "mems" file.
1605 */ 1605 */
1606static int cpuset_write_resmask(struct cgroup_subsys_state *css, 1606static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
1607 struct cftype *cft, char *buf) 1607 char *buf, size_t nbytes, loff_t off)
1608{ 1608{
1609 struct cpuset *cs = css_cs(css); 1609 struct cpuset *cs = css_cs(of_css(of));
1610 struct cpuset *trialcs; 1610 struct cpuset *trialcs;
1611 int retval = -ENODEV; 1611 int retval = -ENODEV;
1612 1612
1613 buf = strstrip(buf);
1614
1613 /* 1615 /*
1614 * CPU or memory hotunplug may leave @cs w/o any execution 1616 * CPU or memory hotunplug may leave @cs w/o any execution
1615 * resources, in which case the hotplug code asynchronously updates 1617 * resources, in which case the hotplug code asynchronously updates
@@ -1633,7 +1635,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
1633 goto out_unlock; 1635 goto out_unlock;
1634 } 1636 }
1635 1637
1636 switch (cft->private) { 1638 switch (of_cft(of)->private) {
1637 case FILE_CPULIST: 1639 case FILE_CPULIST:
1638 retval = update_cpumask(cs, trialcs, buf); 1640 retval = update_cpumask(cs, trialcs, buf);
1639 break; 1641 break;
@@ -1648,7 +1650,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
1648 free_trial_cpuset(trialcs); 1650 free_trial_cpuset(trialcs);
1649out_unlock: 1651out_unlock:
1650 mutex_unlock(&cpuset_mutex); 1652 mutex_unlock(&cpuset_mutex);
1651 return retval; 1653 return retval ?: nbytes;
1652} 1654}
1653 1655
1654/* 1656/*
@@ -1750,7 +1752,7 @@ static struct cftype files[] = {
1750 { 1752 {
1751 .name = "cpus", 1753 .name = "cpus",
1752 .seq_show = cpuset_common_seq_show, 1754 .seq_show = cpuset_common_seq_show,
1753 .write_string = cpuset_write_resmask, 1755 .write = cpuset_write_resmask,
1754 .max_write_len = (100U + 6 * NR_CPUS), 1756 .max_write_len = (100U + 6 * NR_CPUS),
1755 .private = FILE_CPULIST, 1757 .private = FILE_CPULIST,
1756 }, 1758 },
@@ -1758,7 +1760,7 @@ static struct cftype files[] = {
1758 { 1760 {
1759 .name = "mems", 1761 .name = "mems",
1760 .seq_show = cpuset_common_seq_show, 1762 .seq_show = cpuset_common_seq_show,
1761 .write_string = cpuset_write_resmask, 1763 .write = cpuset_write_resmask,
1762 .max_write_len = (100U + 6 * MAX_NUMNODES), 1764 .max_write_len = (100U + 6 * MAX_NUMNODES),
1763 .private = FILE_MEMLIST, 1765 .private = FILE_MEMLIST,
1764 }, 1766 },