aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlabel/netlabel_cipso_v4.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-02-18 01:33:16 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-18 01:33:16 -0500
commit227c43c3bca76df704231324405980851dc7f528 (patch)
tree6b6f32246a974382cc6b7d6474a18c225603a856 /net/netlabel/netlabel_cipso_v4.c
parentf47b7257c7368698eabff6fd7b340071932af640 (diff)
[NETLABEL]: Shrink the genl-ops registration code.
Turning them to array and registration in a loop saves 80 lines of code and ~300 bytes from text section. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlabel/netlabel_cipso_v4.c')
-rw-r--r--net/netlabel/netlabel_cipso_v4.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index c7ad64d664ad..283ff4a527fd 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -718,36 +718,35 @@ static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info)
718 * NetLabel Generic NETLINK Command Definitions 718 * NetLabel Generic NETLINK Command Definitions
719 */ 719 */
720 720
721static struct genl_ops netlbl_cipsov4_genl_c_add = { 721static struct genl_ops netlbl_cipsov4_ops[] = {
722 {
722 .cmd = NLBL_CIPSOV4_C_ADD, 723 .cmd = NLBL_CIPSOV4_C_ADD,
723 .flags = GENL_ADMIN_PERM, 724 .flags = GENL_ADMIN_PERM,
724 .policy = netlbl_cipsov4_genl_policy, 725 .policy = netlbl_cipsov4_genl_policy,
725 .doit = netlbl_cipsov4_add, 726 .doit = netlbl_cipsov4_add,
726 .dumpit = NULL, 727 .dumpit = NULL,
727}; 728 },
728 729 {
729static struct genl_ops netlbl_cipsov4_genl_c_remove = {
730 .cmd = NLBL_CIPSOV4_C_REMOVE, 730 .cmd = NLBL_CIPSOV4_C_REMOVE,
731 .flags = GENL_ADMIN_PERM, 731 .flags = GENL_ADMIN_PERM,
732 .policy = netlbl_cipsov4_genl_policy, 732 .policy = netlbl_cipsov4_genl_policy,
733 .doit = netlbl_cipsov4_remove, 733 .doit = netlbl_cipsov4_remove,
734 .dumpit = NULL, 734 .dumpit = NULL,
735}; 735 },
736 736 {
737static struct genl_ops netlbl_cipsov4_genl_c_list = {
738 .cmd = NLBL_CIPSOV4_C_LIST, 737 .cmd = NLBL_CIPSOV4_C_LIST,
739 .flags = 0, 738 .flags = 0,
740 .policy = netlbl_cipsov4_genl_policy, 739 .policy = netlbl_cipsov4_genl_policy,
741 .doit = netlbl_cipsov4_list, 740 .doit = netlbl_cipsov4_list,
742 .dumpit = NULL, 741 .dumpit = NULL,
743}; 742 },
744 743 {
745static struct genl_ops netlbl_cipsov4_genl_c_listall = {
746 .cmd = NLBL_CIPSOV4_C_LISTALL, 744 .cmd = NLBL_CIPSOV4_C_LISTALL,
747 .flags = 0, 745 .flags = 0,
748 .policy = netlbl_cipsov4_genl_policy, 746 .policy = netlbl_cipsov4_genl_policy,
749 .doit = NULL, 747 .doit = NULL,
750 .dumpit = netlbl_cipsov4_listall, 748 .dumpit = netlbl_cipsov4_listall,
749 },
751}; 750};
752 751
753/* 752/*
@@ -764,28 +763,18 @@ static struct genl_ops netlbl_cipsov4_genl_c_listall = {
764 */ 763 */
765int netlbl_cipsov4_genl_init(void) 764int netlbl_cipsov4_genl_init(void)
766{ 765{
767 int ret_val; 766 int ret_val, i;
768 767
769 ret_val = genl_register_family(&netlbl_cipsov4_gnl_family); 768 ret_val = genl_register_family(&netlbl_cipsov4_gnl_family);
770 if (ret_val != 0) 769 if (ret_val != 0)
771 return ret_val; 770 return ret_val;
772 771
773 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family, 772 for (i = 0; i < ARRAY_SIZE(netlbl_cipsov4_ops); i++) {
774 &netlbl_cipsov4_genl_c_add); 773 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
775 if (ret_val != 0) 774 &netlbl_cipsov4_ops[i]);
776 return ret_val; 775 if (ret_val != 0)
777 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family, 776 return ret_val;
778 &netlbl_cipsov4_genl_c_remove); 777 }
779 if (ret_val != 0)
780 return ret_val;
781 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
782 &netlbl_cipsov4_genl_c_list);
783 if (ret_val != 0)
784 return ret_val;
785 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
786 &netlbl_cipsov4_genl_c_listall);
787 if (ret_val != 0)
788 return ret_val;
789 778
790 return 0; 779 return 0;
791} 780}