aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-12-05 12:28:03 -0500
committerTejun Heo <tj@kernel.org>2013-12-05 12:28:03 -0500
commit6e0755b08dd6a3b5260fafc6969268c2ba261300 (patch)
tree286c49c3daad213f77735c77881c533489fc176f /kernel/cgroup.c
parent716f479d279fb456f58be44180d7479da75e5a4e (diff)
cgroup: remove cftype->read(), ->read_map() and ->write()
In preparation of conversion to kernfs, cgroup file handling is being consolidated so that it can be easily mapped to the seq_file based interface of kernfs. After recent updates, ->read() and ->read_map() don't have any user left and ->write() never had any user. Remove them. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f9f5fe3526ac..b132ff94fc6f 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2324,8 +2324,6 @@ static ssize_t cgroup_file_write(struct file *file, const char __user *buf,
2324 struct cftype *cft = __d_cft(file->f_dentry); 2324 struct cftype *cft = __d_cft(file->f_dentry);
2325 struct cgroup_subsys_state *css = cfe->css; 2325 struct cgroup_subsys_state *css = cfe->css;
2326 2326
2327 if (cft->write)
2328 return cft->write(css, cft, file, buf, nbytes, ppos);
2329 if (cft->write_u64 || cft->write_s64) 2327 if (cft->write_u64 || cft->write_s64)
2330 return cgroup_write_X64(css, cft, file, buf, nbytes, ppos); 2328 return cgroup_write_X64(css, cft, file, buf, nbytes, ppos);
2331 if (cft->write_string) 2329 if (cft->write_string)
@@ -2366,8 +2364,6 @@ static ssize_t cgroup_file_read(struct file *file, char __user *buf,
2366 struct cftype *cft = __d_cft(file->f_dentry); 2364 struct cftype *cft = __d_cft(file->f_dentry);
2367 struct cgroup_subsys_state *css = cfe->css; 2365 struct cgroup_subsys_state *css = cfe->css;
2368 2366
2369 if (cft->read)
2370 return cft->read(css, cft, file, buf, nbytes, ppos);
2371 if (cft->read_u64) 2367 if (cft->read_u64)
2372 return cgroup_read_u64(css, cft, file, buf, nbytes, ppos); 2368 return cgroup_read_u64(css, cft, file, buf, nbytes, ppos);
2373 if (cft->read_s64) 2369 if (cft->read_s64)
@@ -2380,25 +2376,12 @@ static ssize_t cgroup_file_read(struct file *file, char __user *buf,
2380 * supports string->u64 maps, but can be extended in future. 2376 * supports string->u64 maps, but can be extended in future.
2381 */ 2377 */
2382 2378
2383static int cgroup_map_add(struct cgroup_map_cb *cb, const char *key, u64 value)
2384{
2385 struct seq_file *sf = cb->state;
2386 return seq_printf(sf, "%s %llu\n", key, (unsigned long long)value);
2387}
2388
2389static int cgroup_seqfile_show(struct seq_file *m, void *arg) 2379static int cgroup_seqfile_show(struct seq_file *m, void *arg)
2390{ 2380{
2391 struct cfent *cfe = m->private; 2381 struct cfent *cfe = m->private;
2392 struct cftype *cft = cfe->type; 2382 struct cftype *cft = cfe->type;
2393 struct cgroup_subsys_state *css = cfe->css; 2383 struct cgroup_subsys_state *css = cfe->css;
2394 2384
2395 if (cft->read_map) {
2396 struct cgroup_map_cb cb = {
2397 .fill = cgroup_map_add,
2398 .state = m,
2399 };
2400 return cft->read_map(css, cft, &cb);
2401 }
2402 return cft->read_seq_string(css, cft, m); 2385 return cft->read_seq_string(css, cft, m);
2403} 2386}
2404 2387
@@ -2444,7 +2427,7 @@ static int cgroup_file_open(struct inode *inode, struct file *file)
2444 WARN_ON_ONCE(cfe->css && cfe->css != css); 2427 WARN_ON_ONCE(cfe->css && cfe->css != css);
2445 cfe->css = css; 2428 cfe->css = css;
2446 2429
2447 if (cft->read_map || cft->read_seq_string) { 2430 if (cft->read_seq_string) {
2448 file->f_op = &cgroup_seqfile_operations; 2431 file->f_op = &cgroup_seqfile_operations;
2449 err = single_open(file, cgroup_seqfile_show, cfe); 2432 err = single_open(file, cgroup_seqfile_show, cfe);
2450 } else if (cft->open) { 2433 } else if (cft->open) {
@@ -2658,12 +2641,11 @@ static umode_t cgroup_file_mode(const struct cftype *cft)
2658 if (cft->mode) 2641 if (cft->mode)
2659 return cft->mode; 2642 return cft->mode;
2660 2643
2661 if (cft->read || cft->read_u64 || cft->read_s64 || 2644 if (cft->read_u64 || cft->read_s64 || cft->read_seq_string)
2662 cft->read_map || cft->read_seq_string)
2663 mode |= S_IRUGO; 2645 mode |= S_IRUGO;
2664 2646
2665 if (cft->write || cft->write_u64 || cft->write_s64 || 2647 if (cft->write_u64 || cft->write_s64 || cft->write_string ||
2666 cft->write_string || cft->trigger) 2648 cft->trigger)
2667 mode |= S_IWUSR; 2649 mode |= S_IWUSR;
2668 2650
2669 return mode; 2651 return mode;