Lines Matching refs:cft

567 	struct cftype *cft = of_cft(of);  in of_css()  local
577 if (cft->ss) in of_css()
578 return rcu_dereference_raw(cgrp->subsys[cft->ss->id]); in of_css()
1395 static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft, in cgroup_file_name() argument
1398 struct cgroup_subsys *ss = cft->ss; in cgroup_file_name()
1400 if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) && in cgroup_file_name()
1404 cft->name); in cgroup_file_name()
1406 strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX); in cgroup_file_name()
1416 static umode_t cgroup_file_mode(const struct cftype *cft) in cgroup_file_mode() argument
1420 if (cft->read_u64 || cft->read_s64 || cft->seq_show) in cgroup_file_mode()
1423 if (cft->write_u64 || cft->write_s64 || cft->write) { in cgroup_file_mode()
1424 if (cft->flags & CFTYPE_WORLD_WRITABLE) in cgroup_file_mode()
1550 static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) in cgroup_rm_file() argument
1556 if (cft->file_offset) { in cgroup_rm_file()
1557 struct cgroup_subsys_state *css = cgroup_css(cgrp, cft->ss); in cgroup_rm_file()
1558 struct cgroup_file *cfile = (void *)css + cft->file_offset; in cgroup_rm_file()
1567 kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); in cgroup_rm_file()
3421 struct cftype *cft = of->kn->priv; in cgroup_file_open() local
3423 if (cft->open) in cgroup_file_open()
3424 return cft->open(of); in cgroup_file_open()
3430 struct cftype *cft = of->kn->priv; in cgroup_file_release() local
3432 if (cft->release) in cgroup_file_release()
3433 cft->release(of); in cgroup_file_release()
3441 struct cftype *cft = of->kn->priv; in cgroup_file_write() local
3452 !(cft->flags & CFTYPE_NS_DELEGATABLE) && in cgroup_file_write()
3456 if (cft->write) in cgroup_file_write()
3457 return cft->write(of, buf, nbytes, off); in cgroup_file_write()
3466 css = cgroup_css(cgrp, cft->ss); in cgroup_file_write()
3469 if (cft->write_u64) { in cgroup_file_write()
3473 ret = cft->write_u64(css, cft, v); in cgroup_file_write()
3474 } else if (cft->write_s64) { in cgroup_file_write()
3478 ret = cft->write_s64(css, cft, v); in cgroup_file_write()
3504 struct cftype *cft = seq_cft(m); in cgroup_seqfile_show() local
3507 if (cft->seq_show) in cgroup_seqfile_show()
3508 return cft->seq_show(m, arg); in cgroup_seqfile_show()
3510 if (cft->read_u64) in cgroup_seqfile_show()
3511 seq_printf(m, "%llu\n", cft->read_u64(css, cft)); in cgroup_seqfile_show()
3512 else if (cft->read_s64) in cgroup_seqfile_show()
3513 seq_printf(m, "%lld\n", cft->read_s64(css, cft)); in cgroup_seqfile_show()
3559 struct cftype *cft) in cgroup_add_file() argument
3567 key = &cft->lockdep_key; in cgroup_add_file()
3569 kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), in cgroup_add_file()
3570 cgroup_file_mode(cft), in cgroup_add_file()
3572 0, cft->kf_ops, cft, in cgroup_add_file()
3583 if (cft->file_offset) { in cgroup_add_file()
3584 struct cgroup_file *cfile = (void *)css + cft->file_offset; in cgroup_add_file()
3610 struct cftype *cft, *cft_end = NULL; in cgroup_addrm_files() local
3616 for (cft = cfts; cft != cft_end && cft->name[0] != '\0'; cft++) { in cgroup_addrm_files()
3618 if ((cft->flags & __CFTYPE_ONLY_ON_DFL) && !cgroup_on_dfl(cgrp)) in cgroup_addrm_files()
3620 if ((cft->flags & __CFTYPE_NOT_ON_DFL) && cgroup_on_dfl(cgrp)) in cgroup_addrm_files()
3622 if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgroup_parent(cgrp)) in cgroup_addrm_files()
3624 if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgroup_parent(cgrp)) in cgroup_addrm_files()
3628 ret = cgroup_add_file(css, cgrp, cft); in cgroup_addrm_files()
3631 __func__, cft->name, ret); in cgroup_addrm_files()
3632 cft_end = cft; in cgroup_addrm_files()
3637 cgroup_rm_file(cgrp, cft); in cgroup_addrm_files()
3671 struct cftype *cft; in cgroup_exit_cftypes() local
3673 for (cft = cfts; cft->name[0] != '\0'; cft++) { in cgroup_exit_cftypes()
3675 if (cft->max_write_len && cft->max_write_len != PAGE_SIZE) in cgroup_exit_cftypes()
3676 kfree(cft->kf_ops); in cgroup_exit_cftypes()
3677 cft->kf_ops = NULL; in cgroup_exit_cftypes()
3678 cft->ss = NULL; in cgroup_exit_cftypes()
3681 cft->flags &= ~(__CFTYPE_ONLY_ON_DFL | __CFTYPE_NOT_ON_DFL); in cgroup_exit_cftypes()
3687 struct cftype *cft; in cgroup_init_cftypes() local
3689 for (cft = cfts; cft->name[0] != '\0'; cft++) { in cgroup_init_cftypes()
3692 WARN_ON(cft->ss || cft->kf_ops); in cgroup_init_cftypes()
3694 if (cft->seq_start) in cgroup_init_cftypes()
3703 if (cft->max_write_len && cft->max_write_len != PAGE_SIZE) { in cgroup_init_cftypes()
3709 kf_ops->atomic_write_len = cft->max_write_len; in cgroup_init_cftypes()
3712 cft->kf_ops = kf_ops; in cgroup_init_cftypes()
3713 cft->ss = ss; in cgroup_init_cftypes()
3802 struct cftype *cft; in cgroup_add_dfl_cftypes() local
3804 for (cft = cfts; cft && cft->name[0] != '\0'; cft++) in cgroup_add_dfl_cftypes()
3805 cft->flags |= __CFTYPE_ONLY_ON_DFL; in cgroup_add_dfl_cftypes()
3819 struct cftype *cft; in cgroup_add_legacy_cftypes() local
3821 for (cft = cfts; cft && cft->name[0] != '\0'; cft++) in cgroup_add_legacy_cftypes()
3822 cft->flags |= __CFTYPE_NOT_ON_DFL; in cgroup_add_legacy_cftypes()
5928 struct cftype *cft; in show_delegatable_files() local
5931 for (cft = files; cft && cft->name[0] != '\0'; cft++) { in show_delegatable_files()
5932 if (!(cft->flags & CFTYPE_NS_DELEGATABLE)) in show_delegatable_files()
5938 ret += snprintf(buf + ret, size - ret, "%s\n", cft->name); in show_delegatable_files()