Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cgroup: replace cftype->read_seq_string() with cftype->seq_show()

In preparation of conversion to kernfs, cgroup file handling is
updated so that it can be easily mapped to kernfs. This patch
replaces cftype->read_seq_string() with cftype->seq_show() which is
not limited to single_open() operation and will map directcly to
kernfs seq_file interface.

The conversions are mechanical. As ->seq_show() doesn't have @css and
@cft, the functions which make use of them are converted to use
seq_css() and seq_cft() respectively. In several occassions, e.f. if
it has seq_string in its name, the function name is updated to fit the
new method better.

This patch does not introduce any behavior changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Aristeu Rozanski <arozansk@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Neil Horman <nhorman@tuxdriver.com>

Tejun Heo 2da8ca82 7da11279

+128 -164
+15 -20
block/blk-throttle.c
··· 1303 1303 return __blkg_prfill_rwstat(sf, pd, &rwstat); 1304 1304 } 1305 1305 1306 - static int tg_print_cpu_rwstat(struct cgroup_subsys_state *css, 1307 - struct cftype *cft, struct seq_file *sf) 1306 + static int tg_print_cpu_rwstat(struct seq_file *sf, void *v) 1308 1307 { 1309 - struct blkcg *blkcg = css_to_blkcg(css); 1310 - 1311 - blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl, 1312 - cft->private, true); 1308 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_cpu_rwstat, 1309 + &blkcg_policy_throtl, seq_cft(sf)->private, true); 1313 1310 return 0; 1314 1311 } 1315 1312 ··· 1332 1335 return __blkg_prfill_u64(sf, pd, v); 1333 1336 } 1334 1337 1335 - static int tg_print_conf_u64(struct cgroup_subsys_state *css, 1336 - struct cftype *cft, struct seq_file *sf) 1338 + static int tg_print_conf_u64(struct seq_file *sf, void *v) 1337 1339 { 1338 - blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_u64, 1339 - &blkcg_policy_throtl, cft->private, false); 1340 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_conf_u64, 1341 + &blkcg_policy_throtl, seq_cft(sf)->private, false); 1340 1342 return 0; 1341 1343 } 1342 1344 1343 - static int tg_print_conf_uint(struct cgroup_subsys_state *css, 1344 - struct cftype *cft, struct seq_file *sf) 1345 + static int tg_print_conf_uint(struct seq_file *sf, void *v) 1345 1346 { 1346 - blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_uint, 1347 - &blkcg_policy_throtl, cft->private, false); 1347 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_conf_uint, 1348 + &blkcg_policy_throtl, seq_cft(sf)->private, false); 1348 1349 return 0; 1349 1350 } 1350 1351 ··· 1423 1428 { 1424 1429 .name = "throttle.read_bps_device", 1425 1430 .private = offsetof(struct throtl_grp, bps[READ]), 1426 - .read_seq_string = tg_print_conf_u64, 1431 + .seq_show = tg_print_conf_u64, 1427 1432 .write_string = tg_set_conf_u64, 1428 1433 .max_write_len = 256, 1429 1434 }, 1430 1435 { 1431 1436 .name = "throttle.write_bps_device", 1432 1437 .private = offsetof(struct throtl_grp, bps[WRITE]), 1433 - .read_seq_string = tg_print_conf_u64, 1438 + .seq_show = tg_print_conf_u64, 1434 1439 .write_string = tg_set_conf_u64, 1435 1440 .max_write_len = 256, 1436 1441 }, 1437 1442 { 1438 1443 .name = "throttle.read_iops_device", 1439 1444 .private = offsetof(struct throtl_grp, iops[READ]), 1440 - .read_seq_string = tg_print_conf_uint, 1445 + .seq_show = tg_print_conf_uint, 1441 1446 .write_string = tg_set_conf_uint, 1442 1447 .max_write_len = 256, 1443 1448 }, 1444 1449 { 1445 1450 .name = "throttle.write_iops_device", 1446 1451 .private = offsetof(struct throtl_grp, iops[WRITE]), 1447 - .read_seq_string = tg_print_conf_uint, 1452 + .seq_show = tg_print_conf_uint, 1448 1453 .write_string = tg_set_conf_uint, 1449 1454 .max_write_len = 256, 1450 1455 }, 1451 1456 { 1452 1457 .name = "throttle.io_service_bytes", 1453 1458 .private = offsetof(struct tg_stats_cpu, service_bytes), 1454 - .read_seq_string = tg_print_cpu_rwstat, 1459 + .seq_show = tg_print_cpu_rwstat, 1455 1460 }, 1456 1461 { 1457 1462 .name = "throttle.io_serviced", 1458 1463 .private = offsetof(struct tg_stats_cpu, serviced), 1459 - .read_seq_string = tg_print_cpu_rwstat, 1464 + .seq_show = tg_print_cpu_rwstat, 1460 1465 }, 1461 1466 { } /* terminate */ 1462 1467 };
+58 -73
block/cfq-iosched.c
··· 1632 1632 return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); 1633 1633 } 1634 1634 1635 - static int cfqg_print_weight_device(struct cgroup_subsys_state *css, 1636 - struct cftype *cft, struct seq_file *sf) 1635 + static int cfqg_print_weight_device(struct seq_file *sf, void *v) 1637 1636 { 1638 - blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_weight_device, 1639 - &blkcg_policy_cfq, 0, false); 1637 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), 1638 + cfqg_prfill_weight_device, &blkcg_policy_cfq, 1639 + 0, false); 1640 1640 return 0; 1641 1641 } 1642 1642 ··· 1650 1650 return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); 1651 1651 } 1652 1652 1653 - static int cfqg_print_leaf_weight_device(struct cgroup_subsys_state *css, 1654 - struct cftype *cft, 1655 - struct seq_file *sf) 1653 + static int cfqg_print_leaf_weight_device(struct seq_file *sf, void *v) 1656 1654 { 1657 - blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_leaf_weight_device, 1658 - &blkcg_policy_cfq, 0, false); 1655 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), 1656 + cfqg_prfill_leaf_weight_device, &blkcg_policy_cfq, 1657 + 0, false); 1659 1658 return 0; 1660 1659 } 1661 1660 1662 - static int cfq_print_weight(struct cgroup_subsys_state *css, struct cftype *cft, 1663 - struct seq_file *sf) 1661 + static int cfq_print_weight(struct seq_file *sf, void *v) 1664 1662 { 1665 - seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_weight); 1663 + seq_printf(sf, "%u\n", css_to_blkcg(seq_css(sf))->cfq_weight); 1666 1664 return 0; 1667 1665 } 1668 1666 1669 - static int cfq_print_leaf_weight(struct cgroup_subsys_state *css, 1670 - struct cftype *cft, struct seq_file *sf) 1667 + static int cfq_print_leaf_weight(struct seq_file *sf, void *v) 1671 1668 { 1672 - seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_leaf_weight); 1669 + seq_printf(sf, "%u\n", css_to_blkcg(seq_css(sf))->cfq_leaf_weight); 1673 1670 return 0; 1674 1671 } 1675 1672 ··· 1759 1762 return __cfq_set_weight(css, cft, val, true); 1760 1763 } 1761 1764 1762 - static int cfqg_print_stat(struct cgroup_subsys_state *css, struct cftype *cft, 1763 - struct seq_file *sf) 1765 + static int cfqg_print_stat(struct seq_file *sf, void *v) 1764 1766 { 1765 - struct blkcg *blkcg = css_to_blkcg(css); 1766 - 1767 - blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq, 1768 - cft->private, false); 1767 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_stat, 1768 + &blkcg_policy_cfq, seq_cft(sf)->private, false); 1769 1769 return 0; 1770 1770 } 1771 1771 1772 - static int cfqg_print_rwstat(struct cgroup_subsys_state *css, 1773 - struct cftype *cft, struct seq_file *sf) 1772 + static int cfqg_print_rwstat(struct seq_file *sf, void *v) 1774 1773 { 1775 - struct blkcg *blkcg = css_to_blkcg(css); 1776 - 1777 - blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq, 1778 - cft->private, true); 1774 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_rwstat, 1775 + &blkcg_policy_cfq, seq_cft(sf)->private, true); 1779 1776 return 0; 1780 1777 } 1781 1778 ··· 1789 1798 return __blkg_prfill_rwstat(sf, pd, &sum); 1790 1799 } 1791 1800 1792 - static int cfqg_print_stat_recursive(struct cgroup_subsys_state *css, 1793 - struct cftype *cft, struct seq_file *sf) 1801 + static int cfqg_print_stat_recursive(struct seq_file *sf, void *v) 1794 1802 { 1795 - struct blkcg *blkcg = css_to_blkcg(css); 1796 - 1797 - blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, 1798 - &blkcg_policy_cfq, cft->private, false); 1803 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), 1804 + cfqg_prfill_stat_recursive, &blkcg_policy_cfq, 1805 + seq_cft(sf)->private, false); 1799 1806 return 0; 1800 1807 } 1801 1808 1802 - static int cfqg_print_rwstat_recursive(struct cgroup_subsys_state *css, 1803 - struct cftype *cft, struct seq_file *sf) 1809 + static int cfqg_print_rwstat_recursive(struct seq_file *sf, void *v) 1804 1810 { 1805 - struct blkcg *blkcg = css_to_blkcg(css); 1806 - 1807 - blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, 1808 - &blkcg_policy_cfq, cft->private, true); 1811 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), 1812 + cfqg_prfill_rwstat_recursive, &blkcg_policy_cfq, 1813 + seq_cft(sf)->private, true); 1809 1814 return 0; 1810 1815 } 1811 1816 ··· 1822 1835 } 1823 1836 1824 1837 /* print avg_queue_size */ 1825 - static int cfqg_print_avg_queue_size(struct cgroup_subsys_state *css, 1826 - struct cftype *cft, struct seq_file *sf) 1838 + static int cfqg_print_avg_queue_size(struct seq_file *sf, void *v) 1827 1839 { 1828 - struct blkcg *blkcg = css_to_blkcg(css); 1829 - 1830 - blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, 1831 - &blkcg_policy_cfq, 0, false); 1840 + blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), 1841 + cfqg_prfill_avg_queue_size, &blkcg_policy_cfq, 1842 + 0, false); 1832 1843 return 0; 1833 1844 } 1834 1845 #endif /* CONFIG_DEBUG_BLK_CGROUP */ ··· 1836 1851 { 1837 1852 .name = "weight_device", 1838 1853 .flags = CFTYPE_ONLY_ON_ROOT, 1839 - .read_seq_string = cfqg_print_leaf_weight_device, 1854 + .seq_show = cfqg_print_leaf_weight_device, 1840 1855 .write_string = cfqg_set_leaf_weight_device, 1841 1856 .max_write_len = 256, 1842 1857 }, 1843 1858 { 1844 1859 .name = "weight", 1845 1860 .flags = CFTYPE_ONLY_ON_ROOT, 1846 - .read_seq_string = cfq_print_leaf_weight, 1861 + .seq_show = cfq_print_leaf_weight, 1847 1862 .write_u64 = cfq_set_leaf_weight, 1848 1863 }, 1849 1864 ··· 1851 1866 { 1852 1867 .name = "weight_device", 1853 1868 .flags = CFTYPE_NOT_ON_ROOT, 1854 - .read_seq_string = cfqg_print_weight_device, 1869 + .seq_show = cfqg_print_weight_device, 1855 1870 .write_string = cfqg_set_weight_device, 1856 1871 .max_write_len = 256, 1857 1872 }, 1858 1873 { 1859 1874 .name = "weight", 1860 1875 .flags = CFTYPE_NOT_ON_ROOT, 1861 - .read_seq_string = cfq_print_weight, 1876 + .seq_show = cfq_print_weight, 1862 1877 .write_u64 = cfq_set_weight, 1863 1878 }, 1864 1879 1865 1880 { 1866 1881 .name = "leaf_weight_device", 1867 - .read_seq_string = cfqg_print_leaf_weight_device, 1882 + .seq_show = cfqg_print_leaf_weight_device, 1868 1883 .write_string = cfqg_set_leaf_weight_device, 1869 1884 .max_write_len = 256, 1870 1885 }, 1871 1886 { 1872 1887 .name = "leaf_weight", 1873 - .read_seq_string = cfq_print_leaf_weight, 1888 + .seq_show = cfq_print_leaf_weight, 1874 1889 .write_u64 = cfq_set_leaf_weight, 1875 1890 }, 1876 1891 ··· 1878 1893 { 1879 1894 .name = "time", 1880 1895 .private = offsetof(struct cfq_group, stats.time), 1881 - .read_seq_string = cfqg_print_stat, 1896 + .seq_show = cfqg_print_stat, 1882 1897 }, 1883 1898 { 1884 1899 .name = "sectors", 1885 1900 .private = offsetof(struct cfq_group, stats.sectors), 1886 - .read_seq_string = cfqg_print_stat, 1901 + .seq_show = cfqg_print_stat, 1887 1902 }, 1888 1903 { 1889 1904 .name = "io_service_bytes", 1890 1905 .private = offsetof(struct cfq_group, stats.service_bytes), 1891 - .read_seq_string = cfqg_print_rwstat, 1906 + .seq_show = cfqg_print_rwstat, 1892 1907 }, 1893 1908 { 1894 1909 .name = "io_serviced", 1895 1910 .private = offsetof(struct cfq_group, stats.serviced), 1896 - .read_seq_string = cfqg_print_rwstat, 1911 + .seq_show = cfqg_print_rwstat, 1897 1912 }, 1898 1913 { 1899 1914 .name = "io_service_time", 1900 1915 .private = offsetof(struct cfq_group, stats.service_time), 1901 - .read_seq_string = cfqg_print_rwstat, 1916 + .seq_show = cfqg_print_rwstat, 1902 1917 }, 1903 1918 { 1904 1919 .name = "io_wait_time", 1905 1920 .private = offsetof(struct cfq_group, stats.wait_time), 1906 - .read_seq_string = cfqg_print_rwstat, 1921 + .seq_show = cfqg_print_rwstat, 1907 1922 }, 1908 1923 { 1909 1924 .name = "io_merged", 1910 1925 .private = offsetof(struct cfq_group, stats.merged), 1911 - .read_seq_string = cfqg_print_rwstat, 1926 + .seq_show = cfqg_print_rwstat, 1912 1927 }, 1913 1928 { 1914 1929 .name = "io_queued", 1915 1930 .private = offsetof(struct cfq_group, stats.queued), 1916 - .read_seq_string = cfqg_print_rwstat, 1931 + .seq_show = cfqg_print_rwstat, 1917 1932 }, 1918 1933 1919 1934 /* the same statictics which cover the cfqg and its descendants */ 1920 1935 { 1921 1936 .name = "time_recursive", 1922 1937 .private = offsetof(struct cfq_group, stats.time), 1923 - .read_seq_string = cfqg_print_stat_recursive, 1938 + .seq_show = cfqg_print_stat_recursive, 1924 1939 }, 1925 1940 { 1926 1941 .name = "sectors_recursive", 1927 1942 .private = offsetof(struct cfq_group, stats.sectors), 1928 - .read_seq_string = cfqg_print_stat_recursive, 1943 + .seq_show = cfqg_print_stat_recursive, 1929 1944 }, 1930 1945 { 1931 1946 .name = "io_service_bytes_recursive", 1932 1947 .private = offsetof(struct cfq_group, stats.service_bytes), 1933 - .read_seq_string = cfqg_print_rwstat_recursive, 1948 + .seq_show = cfqg_print_rwstat_recursive, 1934 1949 }, 1935 1950 { 1936 1951 .name = "io_serviced_recursive", 1937 1952 .private = offsetof(struct cfq_group, stats.serviced), 1938 - .read_seq_string = cfqg_print_rwstat_recursive, 1953 + .seq_show = cfqg_print_rwstat_recursive, 1939 1954 }, 1940 1955 { 1941 1956 .name = "io_service_time_recursive", 1942 1957 .private = offsetof(struct cfq_group, stats.service_time), 1943 - .read_seq_string = cfqg_print_rwstat_recursive, 1958 + .seq_show = cfqg_print_rwstat_recursive, 1944 1959 }, 1945 1960 { 1946 1961 .name = "io_wait_time_recursive", 1947 1962 .private = offsetof(struct cfq_group, stats.wait_time), 1948 - .read_seq_string = cfqg_print_rwstat_recursive, 1963 + .seq_show = cfqg_print_rwstat_recursive, 1949 1964 }, 1950 1965 { 1951 1966 .name = "io_merged_recursive", 1952 1967 .private = offsetof(struct cfq_group, stats.merged), 1953 - .read_seq_string = cfqg_print_rwstat_recursive, 1968 + .seq_show = cfqg_print_rwstat_recursive, 1954 1969 }, 1955 1970 { 1956 1971 .name = "io_queued_recursive", 1957 1972 .private = offsetof(struct cfq_group, stats.queued), 1958 - .read_seq_string = cfqg_print_rwstat_recursive, 1973 + .seq_show = cfqg_print_rwstat_recursive, 1959 1974 }, 1960 1975 #ifdef CONFIG_DEBUG_BLK_CGROUP 1961 1976 { 1962 1977 .name = "avg_queue_size", 1963 - .read_seq_string = cfqg_print_avg_queue_size, 1978 + .seq_show = cfqg_print_avg_queue_size, 1964 1979 }, 1965 1980 { 1966 1981 .name = "group_wait_time", 1967 1982 .private = offsetof(struct cfq_group, stats.group_wait_time), 1968 - .read_seq_string = cfqg_print_stat, 1983 + .seq_show = cfqg_print_stat, 1969 1984 }, 1970 1985 { 1971 1986 .name = "idle_time", 1972 1987 .private = offsetof(struct cfq_group, stats.idle_time), 1973 - .read_seq_string = cfqg_print_stat, 1988 + .seq_show = cfqg_print_stat, 1974 1989 }, 1975 1990 { 1976 1991 .name = "empty_time", 1977 1992 .private = offsetof(struct cfq_group, stats.empty_time), 1978 - .read_seq_string = cfqg_print_stat, 1993 + .seq_show = cfqg_print_stat, 1979 1994 }, 1980 1995 { 1981 1996 .name = "dequeue", 1982 1997 .private = offsetof(struct cfq_group, stats.dequeue), 1983 - .read_seq_string = cfqg_print_stat, 1998 + .seq_show = cfqg_print_stat, 1984 1999 }, 1985 2000 { 1986 2001 .name = "unaccounted_time", 1987 2002 .private = offsetof(struct cfq_group, stats.unaccounted_time), 1988 - .read_seq_string = cfqg_print_stat, 2003 + .seq_show = cfqg_print_stat, 1989 2004 }, 1990 2005 #endif /* CONFIG_DEBUG_BLK_CGROUP */ 1991 2006 { } /* terminate */
+3 -6
include/linux/cgroup.h
··· 444 444 * read_s64() is a signed version of read_u64() 445 445 */ 446 446 s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft); 447 - /* 448 - * read_seq_string() is used for outputting a simple sequence 449 - * using seqfile. 450 - */ 451 - int (*read_seq_string)(struct cgroup_subsys_state *css, 452 - struct cftype *cft, struct seq_file *m); 447 + 448 + /* generic seq_file read interface */ 449 + int (*seq_show)(struct seq_file *sf, void *v); 453 450 454 451 /* 455 452 * write_u64() is a shortcut for the common case of accepting
+16 -18
kernel/cgroup.c
··· 2212 2212 return 0; 2213 2213 } 2214 2214 2215 - static int cgroup_release_agent_show(struct cgroup_subsys_state *css, 2216 - struct cftype *cft, struct seq_file *seq) 2215 + static int cgroup_release_agent_show(struct seq_file *seq, void *v) 2217 2216 { 2218 - struct cgroup *cgrp = css->cgroup; 2217 + struct cgroup *cgrp = seq_css(seq)->cgroup; 2219 2218 2220 2219 if (!cgroup_lock_live_group(cgrp)) 2221 2220 return -ENODEV; ··· 2224 2225 return 0; 2225 2226 } 2226 2227 2227 - static int cgroup_sane_behavior_show(struct cgroup_subsys_state *css, 2228 - struct cftype *cft, struct seq_file *seq) 2228 + static int cgroup_sane_behavior_show(struct seq_file *seq, void *v) 2229 2229 { 2230 - seq_printf(seq, "%d\n", cgroup_sane_behavior(css->cgroup)); 2230 + struct cgroup *cgrp = seq_css(seq)->cgroup; 2231 + 2232 + seq_printf(seq, "%d\n", cgroup_sane_behavior(cgrp)); 2231 2233 return 0; 2232 2234 } 2233 2235 ··· 2291 2291 struct cftype *cft = seq_cft(m); 2292 2292 struct cgroup_subsys_state *css = seq_css(m); 2293 2293 2294 - if (cft->read_seq_string) 2295 - return cft->read_seq_string(css, cft, m); 2294 + if (cft->seq_show) 2295 + return cft->seq_show(m, arg); 2296 2296 2297 2297 if (cft->read_u64) 2298 2298 seq_printf(m, "%llu\n", cft->read_u64(css, cft)); ··· 2559 2559 if (cft->mode) 2560 2560 return cft->mode; 2561 2561 2562 - if (cft->read_u64 || cft->read_s64 || cft->read_seq_string) 2562 + if (cft->read_u64 || cft->read_s64 || cft->seq_show) 2563 2563 mode |= S_IRUGO; 2564 2564 2565 2565 if (cft->write_u64 || cft->write_s64 || cft->write_string || ··· 3874 3874 { 3875 3875 .name = "cgroup.sane_behavior", 3876 3876 .flags = CFTYPE_ONLY_ON_ROOT, 3877 - .read_seq_string = cgroup_sane_behavior_show, 3877 + .seq_show = cgroup_sane_behavior_show, 3878 3878 }, 3879 3879 3880 3880 /* ··· 3899 3899 { 3900 3900 .name = "release_agent", 3901 3901 .flags = CFTYPE_INSANE | CFTYPE_ONLY_ON_ROOT, 3902 - .read_seq_string = cgroup_release_agent_show, 3902 + .seq_show = cgroup_release_agent_show, 3903 3903 .write_string = cgroup_release_agent_write, 3904 3904 .max_write_len = PATH_MAX, 3905 3905 }, ··· 5274 5274 return count; 5275 5275 } 5276 5276 5277 - static int current_css_set_cg_links_read(struct cgroup_subsys_state *css, 5278 - struct cftype *cft, 5279 - struct seq_file *seq) 5277 + static int current_css_set_cg_links_read(struct seq_file *seq, void *v) 5280 5278 { 5281 5279 struct cgrp_cset_link *link; 5282 5280 struct css_set *cset; ··· 5299 5301 } 5300 5302 5301 5303 #define MAX_TASKS_SHOWN_PER_CSS 25 5302 - static int cgroup_css_links_read(struct cgroup_subsys_state *css, 5303 - struct cftype *cft, struct seq_file *seq) 5304 + static int cgroup_css_links_read(struct seq_file *seq, void *v) 5304 5305 { 5306 + struct cgroup_subsys_state *css = seq_css(seq); 5305 5307 struct cgrp_cset_link *link; 5306 5308 5307 5309 read_lock(&css_set_lock); ··· 5347 5349 5348 5350 { 5349 5351 .name = "current_css_set_cg_links", 5350 - .read_seq_string = current_css_set_cg_links_read, 5352 + .seq_show = current_css_set_cg_links_read, 5351 5353 }, 5352 5354 5353 5355 { 5354 5356 .name = "cgroup_css_links", 5355 - .read_seq_string = cgroup_css_links_read, 5357 + .seq_show = cgroup_css_links_read, 5356 5358 }, 5357 5359 5358 5360 {
+3 -4
kernel/cgroup_freezer.c
··· 301 301 spin_unlock_irq(&freezer->lock); 302 302 } 303 303 304 - static int freezer_read(struct cgroup_subsys_state *css, struct cftype *cft, 305 - struct seq_file *m) 304 + static int freezer_read(struct seq_file *m, void *v) 306 305 { 307 - struct cgroup_subsys_state *pos; 306 + struct cgroup_subsys_state *css = seq_css(m), *pos; 308 307 309 308 rcu_read_lock(); 310 309 ··· 457 458 { 458 459 .name = "state", 459 460 .flags = CFTYPE_NOT_ON_ROOT, 460 - .read_seq_string = freezer_read, 461 + .seq_show = freezer_read, 461 462 .write_string = freezer_write, 462 463 }, 463 464 {
+5 -7
kernel/cpuset.c
··· 1732 1732 * and since these maps can change value dynamically, one could read 1733 1733 * gibberish by doing partial reads while a list was changing. 1734 1734 */ 1735 - static int cpuset_common_read_seq_string(struct cgroup_subsys_state *css, 1736 - struct cftype *cft, 1737 - struct seq_file *sf) 1735 + static int cpuset_common_seq_show(struct seq_file *sf, void *v) 1738 1736 { 1739 - struct cpuset *cs = css_cs(css); 1740 - cpuset_filetype_t type = cft->private; 1737 + struct cpuset *cs = css_cs(seq_css(sf)); 1738 + cpuset_filetype_t type = seq_cft(sf)->private; 1741 1739 ssize_t count; 1742 1740 char *buf, *s; 1743 1741 int ret = 0; ··· 1822 1824 static struct cftype files[] = { 1823 1825 { 1824 1826 .name = "cpus", 1825 - .read_seq_string = cpuset_common_read_seq_string, 1827 + .seq_show = cpuset_common_seq_show, 1826 1828 .write_string = cpuset_write_resmask, 1827 1829 .max_write_len = (100U + 6 * NR_CPUS), 1828 1830 .private = FILE_CPULIST, ··· 1830 1832 1831 1833 { 1832 1834 .name = "mems", 1833 - .read_seq_string = cpuset_common_read_seq_string, 1835 + .seq_show = cpuset_common_seq_show, 1834 1836 .write_string = cpuset_write_resmask, 1835 1837 .max_write_len = (100U + 6 * MAX_NUMNODES), 1836 1838 .private = FILE_MEMLIST,
+3 -4
kernel/sched/core.c
··· 7256 7256 return ret; 7257 7257 } 7258 7258 7259 - static int cpu_stats_show(struct cgroup_subsys_state *css, struct cftype *cft, 7260 - struct seq_file *sf) 7259 + static int cpu_stats_show(struct seq_file *sf, void *v) 7261 7260 { 7262 - struct task_group *tg = css_tg(css); 7261 + struct task_group *tg = css_tg(seq_css(sf)); 7263 7262 struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; 7264 7263 7265 7264 seq_printf(sf, "nr_periods %d\n", cfs_b->nr_periods); ··· 7317 7318 }, 7318 7319 { 7319 7320 .name = "stat", 7320 - .read_seq_string = cpu_stats_show, 7321 + .seq_show = cpu_stats_show, 7321 7322 }, 7322 7323 #endif 7323 7324 #ifdef CONFIG_RT_GROUP_SCHED
+6 -8
kernel/sched/cpuacct.c
··· 163 163 return err; 164 164 } 165 165 166 - static int cpuacct_percpu_seq_read(struct cgroup_subsys_state *css, 167 - struct cftype *cft, struct seq_file *m) 166 + static int cpuacct_percpu_seq_show(struct seq_file *m, void *V) 168 167 { 169 - struct cpuacct *ca = css_ca(css); 168 + struct cpuacct *ca = css_ca(seq_css(m)); 170 169 u64 percpu; 171 170 int i; 172 171 ··· 182 183 [CPUACCT_STAT_SYSTEM] = "system", 183 184 }; 184 185 185 - static int cpuacct_stats_show(struct cgroup_subsys_state *css, 186 - struct cftype *cft, struct seq_file *sf) 186 + static int cpuacct_stats_show(struct seq_file *sf, void *v) 187 187 { 188 - struct cpuacct *ca = css_ca(css); 188 + struct cpuacct *ca = css_ca(seq_css(sf)); 189 189 int cpu; 190 190 s64 val = 0; 191 191 ··· 218 220 }, 219 221 { 220 222 .name = "usage_percpu", 221 - .read_seq_string = cpuacct_percpu_seq_read, 223 + .seq_show = cpuacct_percpu_seq_show, 222 224 }, 223 225 { 224 226 .name = "stat", 225 - .read_seq_string = cpuacct_stats_show, 227 + .seq_show = cpuacct_stats_show, 226 228 }, 227 229 { } /* terminate */ 228 230 };
+12 -16
mm/memcontrol.c
··· 3014 3014 } 3015 3015 3016 3016 #ifdef CONFIG_SLABINFO 3017 - static int mem_cgroup_slabinfo_read(struct cgroup_subsys_state *css, 3018 - struct cftype *cft, struct seq_file *m) 3017 + static int mem_cgroup_slabinfo_read(struct seq_file *m, void *v) 3019 3018 { 3020 - struct mem_cgroup *memcg = mem_cgroup_from_css(css); 3019 + struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); 3021 3020 struct memcg_cache_params *params; 3022 3021 3023 3022 if (!memcg_can_account_kmem(memcg)) ··· 5417 5418 #endif 5418 5419 5419 5420 #ifdef CONFIG_NUMA 5420 - static int memcg_numa_stat_show(struct cgroup_subsys_state *css, 5421 - struct cftype *cft, struct seq_file *m) 5421 + static int memcg_numa_stat_show(struct seq_file *m, void *v) 5422 5422 { 5423 5423 struct numa_stat { 5424 5424 const char *name; ··· 5433 5435 const struct numa_stat *stat; 5434 5436 int nid; 5435 5437 unsigned long nr; 5436 - struct mem_cgroup *memcg = mem_cgroup_from_css(css); 5438 + struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); 5437 5439 5438 5440 for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) { 5439 5441 nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask); ··· 5472 5474 BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); 5473 5475 } 5474 5476 5475 - static int memcg_stat_show(struct cgroup_subsys_state *css, struct cftype *cft, 5476 - struct seq_file *m) 5477 + static int memcg_stat_show(struct seq_file *m, void *v) 5477 5478 { 5478 - struct mem_cgroup *memcg = mem_cgroup_from_css(css); 5479 + struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); 5479 5480 struct mem_cgroup *mi; 5480 5481 unsigned int i; 5481 5482 ··· 5904 5907 spin_unlock(&memcg_oom_lock); 5905 5908 } 5906 5909 5907 - static int mem_cgroup_oom_control_read(struct cgroup_subsys_state *css, 5908 - struct cftype *cft, struct seq_file *sf) 5910 + static int mem_cgroup_oom_control_read(struct seq_file *sf, void *v) 5909 5911 { 5910 - struct mem_cgroup *memcg = mem_cgroup_from_css(css); 5912 + struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(sf)); 5911 5913 5912 5914 seq_printf(sf, "oom_kill_disable %d\n", memcg->oom_kill_disable); 5913 5915 seq_printf(sf, "under_oom %d\n", (bool)atomic_read(&memcg->under_oom)); ··· 6256 6260 }, 6257 6261 { 6258 6262 .name = "stat", 6259 - .read_seq_string = memcg_stat_show, 6263 + .seq_show = memcg_stat_show, 6260 6264 }, 6261 6265 { 6262 6266 .name = "force_empty", ··· 6286 6290 }, 6287 6291 { 6288 6292 .name = "oom_control", 6289 - .read_seq_string = mem_cgroup_oom_control_read, 6293 + .seq_show = mem_cgroup_oom_control_read, 6290 6294 .write_u64 = mem_cgroup_oom_control_write, 6291 6295 .private = MEMFILE_PRIVATE(_OOM_TYPE, OOM_CONTROL), 6292 6296 }, ··· 6296 6300 #ifdef CONFIG_NUMA 6297 6301 { 6298 6302 .name = "numa_stat", 6299 - .read_seq_string = memcg_numa_stat_show, 6303 + .seq_show = memcg_numa_stat_show, 6300 6304 }, 6301 6305 #endif 6302 6306 #ifdef CONFIG_MEMCG_KMEM ··· 6326 6330 #ifdef CONFIG_SLABINFO 6327 6331 { 6328 6332 .name = "kmem.slabinfo", 6329 - .read_seq_string = mem_cgroup_slabinfo_read, 6333 + .seq_show = mem_cgroup_slabinfo_read, 6330 6334 }, 6331 6335 #endif 6332 6336 #endif
+4 -4
net/core/netprio_cgroup.c
··· 173 173 return css->cgroup->id; 174 174 } 175 175 176 - static int read_priomap(struct cgroup_subsys_state *css, struct cftype *cft, 177 - struct seq_file *sf) 176 + static int read_priomap(struct seq_file *sf, void *v) 178 177 { 179 178 struct net_device *dev; 180 179 181 180 rcu_read_lock(); 182 181 for_each_netdev_rcu(&init_net, dev) 183 - seq_printf(sf, "%s %u\n", dev->name, netprio_prio(css, dev)); 182 + seq_printf(sf, "%s %u\n", dev->name, 183 + netprio_prio(seq_css(sf), dev)); 184 184 rcu_read_unlock(); 185 185 return 0; 186 186 } ··· 238 238 }, 239 239 { 240 240 .name = "ifpriomap", 241 - .read_seq_string = read_priomap, 241 + .seq_show = read_priomap, 242 242 .write_string = write_priomap, 243 243 }, 244 244 { } /* terminate */
+3 -4
security/device_cgroup.c
··· 274 274 sprintf(str, "%u", m); 275 275 } 276 276 277 - static int devcgroup_seq_read(struct cgroup_subsys_state *css, 278 - struct cftype *cft, struct seq_file *m) 277 + static int devcgroup_seq_show(struct seq_file *m, void *v) 279 278 { 280 - struct dev_cgroup *devcgroup = css_to_devcgroup(css); 279 + struct dev_cgroup *devcgroup = css_to_devcgroup(seq_css(m)); 281 280 struct dev_exception_item *ex; 282 281 char maj[MAJMINLEN], min[MAJMINLEN], acc[ACCLEN]; 283 282 ··· 678 679 }, 679 680 { 680 681 .name = "list", 681 - .read_seq_string = devcgroup_seq_read, 682 + .seq_show = devcgroup_seq_show, 682 683 .private = DEVCG_LIST, 683 684 }, 684 685 { } /* terminate */