aboutsummaryrefslogtreecommitdiffstats
path: root/security/device_cgroup.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 /security/device_cgroup.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 'security/device_cgroup.c')
-rw-r--r--security/device_cgroup.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 9134dbf70d3e..7dbac4061b1c 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -767,27 +767,27 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup,
767 return rc; 767 return rc;
768} 768}
769 769
770static int devcgroup_access_write(struct cgroup_subsys_state *css, 770static ssize_t devcgroup_access_write(struct kernfs_open_file *of,
771 struct cftype *cft, char *buffer) 771 char *buf, size_t nbytes, loff_t off)
772{ 772{
773 int retval; 773 int retval;
774 774
775 mutex_lock(&devcgroup_mutex); 775 mutex_lock(&devcgroup_mutex);
776 retval = devcgroup_update_access(css_to_devcgroup(css), 776 retval = devcgroup_update_access(css_to_devcgroup(of_css(of)),
777 cft->private, buffer); 777 of_cft(of)->private, strstrip(buf));
778 mutex_unlock(&devcgroup_mutex); 778 mutex_unlock(&devcgroup_mutex);
779 return retval; 779 return retval ?: nbytes;
780} 780}
781 781
782static struct cftype dev_cgroup_files[] = { 782static struct cftype dev_cgroup_files[] = {
783 { 783 {
784 .name = "allow", 784 .name = "allow",
785 .write_string = devcgroup_access_write, 785 .write = devcgroup_access_write,
786 .private = DEVCG_ALLOW, 786 .private = DEVCG_ALLOW,
787 }, 787 },
788 { 788 {
789 .name = "deny", 789 .name = "deny",
790 .write_string = devcgroup_access_write, 790 .write = devcgroup_access_write,
791 .private = DEVCG_DENY, 791 .private = DEVCG_DENY,
792 }, 792 },
793 { 793 {