• Tejun Heo's avatar
    cgroup: unify read path so that seq_file is always used · 896f5199
    Tejun Heo authored
    With the recent removal of cftype->read() and ->read_map(), only three
    operations are remaining, ->read_u64(), ->read_s64() and
    ->read_seq_string().  Currently, the first two are handled directly
    while the last is handled through seq_file.
    
    It is trivial to serve the first two through the seq_file path too.
    This patch restructures read path so that all operations are served
    through cgroup_seqfile_show().  This makes all cgroup files seq_file -
    single_open/release() are now used by default,
    cgroup_seqfile_operations is dropped, and cgroup_file_operations uses
    seq_read() for read.
    
    This simplifies the code and makes the read path easy to convert to
    use kernfs.
    
    Note that, while cgroup_file_operations uses seq_read() for read, it
    still uses generic_file_llseek() for seeking instead of seq_lseek().
    This is different from cgroup_seqfile_operations but shouldn't break
    anything and brings the seeking behavior aligned with kernfs.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    896f5199
cgroup.c 146 KB