cgroup: replace cftype->write_string() with cftype->write()
[linux-2.6-block.git] / kernel / cpuset.c
index 37ca0a5c226d23b48325a6cb950c5231038a1a26..2f4b08b8db24f951d013a9c5b29ff1ec70b424cb 100644 (file)
@@ -1603,13 +1603,15 @@ out_unlock:
 /*
  * Common handling for a write to a "cpus" or "mems" file.
  */
-static int cpuset_write_resmask(struct cgroup_subsys_state *css,
-                               struct cftype *cft, char *buf)
+static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
+                                   char *buf, size_t nbytes, loff_t off)
 {
-       struct cpuset *cs = css_cs(css);
+       struct cpuset *cs = css_cs(of_css(of));
        struct cpuset *trialcs;
        int retval = -ENODEV;
 
+       buf = strstrip(buf);
+
        /*
         * CPU or memory hotunplug may leave @cs w/o any execution
         * resources, in which case the hotplug code asynchronously updates
@@ -1633,7 +1635,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
                goto out_unlock;
        }
 
-       switch (cft->private) {
+       switch (of_cft(of)->private) {
        case FILE_CPULIST:
                retval = update_cpumask(cs, trialcs, buf);
                break;
@@ -1648,7 +1650,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
        free_trial_cpuset(trialcs);
 out_unlock:
        mutex_unlock(&cpuset_mutex);
-       return retval;
+       return retval ?: nbytes;
 }
 
 /*
@@ -1750,7 +1752,7 @@ static struct cftype files[] = {
        {
                .name = "cpus",
                .seq_show = cpuset_common_seq_show,
-               .write_string = cpuset_write_resmask,
+               .write = cpuset_write_resmask,
                .max_write_len = (100U + 6 * NR_CPUS),
                .private = FILE_CPULIST,
        },
@@ -1758,7 +1760,7 @@ static struct cftype files[] = {
        {
                .name = "mems",
                .seq_show = cpuset_common_seq_show,
-               .write_string = cpuset_write_resmask,
+               .write = cpuset_write_resmask,
                .max_write_len = (100U + 6 * MAX_NUMNODES),
                .private = FILE_MEMLIST,
        },