aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/taskstats.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 9f4618eb51c8..13d2f7cd65db 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -673,17 +673,18 @@ err:
673 nlmsg_free(rep_skb); 673 nlmsg_free(rep_skb);
674} 674}
675 675
676static struct genl_ops taskstats_ops = { 676static const struct genl_ops taskstats_ops[] = {
677 .cmd = TASKSTATS_CMD_GET, 677 {
678 .doit = taskstats_user_cmd, 678 .cmd = TASKSTATS_CMD_GET,
679 .policy = taskstats_cmd_get_policy, 679 .doit = taskstats_user_cmd,
680 .flags = GENL_ADMIN_PERM, 680 .policy = taskstats_cmd_get_policy,
681}; 681 .flags = GENL_ADMIN_PERM,
682 682 },
683static struct genl_ops cgroupstats_ops = { 683 {
684 .cmd = CGROUPSTATS_CMD_GET, 684 .cmd = CGROUPSTATS_CMD_GET,
685 .doit = cgroupstats_user_cmd, 685 .doit = cgroupstats_user_cmd,
686 .policy = cgroupstats_cmd_get_policy, 686 .policy = cgroupstats_cmd_get_policy,
687 },
687}; 688};
688 689
689/* Needed early in initialization */ 690/* Needed early in initialization */
@@ -702,26 +703,13 @@ static int __init taskstats_init(void)
702{ 703{
703 int rc; 704 int rc;
704 705
705 rc = genl_register_family(&family); 706 rc = genl_register_family_with_ops(&family, taskstats_ops);
706 if (rc) 707 if (rc)
707 return rc; 708 return rc;
708 709
709 rc = genl_register_ops(&family, &taskstats_ops);
710 if (rc < 0)
711 goto err;
712
713 rc = genl_register_ops(&family, &cgroupstats_ops);
714 if (rc < 0)
715 goto err_cgroup_ops;
716
717 family_registered = 1; 710 family_registered = 1;
718 pr_info("registered taskstats version %d\n", TASKSTATS_GENL_VERSION); 711 pr_info("registered taskstats version %d\n", TASKSTATS_GENL_VERSION);
719 return 0; 712 return 0;
720err_cgroup_ops:
721 genl_unregister_ops(&family, &taskstats_ops);
722err:
723 genl_unregister_family(&family);
724 return rc;
725} 713}
726 714
727/* 715/*