Skip to content
  • Tejun Heo's avatar
    cgroup: unify pidlist and other file handling · 6612f05b
    Tejun Heo authored
    
    
    In preparation of conversion to kernfs, cgroup file handling is
    updated so that it can be easily mapped to kernfs.  With the previous
    changes, the difference between pidlist and other files are very
    small.  Both are served by seq_file in a pretty standard way with the
    only difference being !pidlist files use single_open().
    
    This patch adds cftype->seq_start(), ->seq_next and ->seq_stop() and
    implements the matching cgroup_seqfile_start/next/stop() which either
    emulates single_open() behavior or invokes cftype->seq_*() operations
    if specified.  This allows using single seq_operations for both
    pidlist and other files and makes cgroup_pidlist_operations and
    cgorup_pidlist_open() no longer necessary.  As cgroup_pidlist_open()
    was the only user of cftype->open(), the method is dropped together.
    
    This brings cftype file interface very close to kernfs interface and
    mapping shouldn't be too difficult.  Once converted to kernfs, most of
    the plumbing code including cgroup_seqfile_*() will be removed as
    kernfs provides those facilities.
    
    This patch does not introduce any behavior changes.
    
    v2: Refreshed on top of the updated "cgroup: introduce struct
        cgroup_pidlist_open_file".
    
    v3: Refreshed on top of the updated "cgroup: attach cgroup_open_file
        to all cgroup files".
    
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    6612f05b