diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-18 01:33:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-18 01:33:16 -0500 |
commit | 227c43c3bca76df704231324405980851dc7f528 (patch) | |
tree | 6b6f32246a974382cc6b7d6474a18c225603a856 /net/netlabel/netlabel_unlabeled.c | |
parent | f47b7257c7368698eabff6fd7b340071932af640 (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_unlabeled.c')
-rw-r--r-- | net/netlabel/netlabel_unlabeled.c | 86 |
1 files changed, 24 insertions, 62 deletions
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 3e745b72fded..f0f1322911de 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1553,68 +1553,63 @@ unlabel_staticlistdef_return: | |||
1553 | * NetLabel Generic NETLINK Command Definitions | 1553 | * NetLabel Generic NETLINK Command Definitions |
1554 | */ | 1554 | */ |
1555 | 1555 | ||
1556 | static struct genl_ops netlbl_unlabel_genl_c_staticadd = { | 1556 | static struct genl_ops netlbl_unlabel_genl_ops[] = { |
1557 | { | ||
1557 | .cmd = NLBL_UNLABEL_C_STATICADD, | 1558 | .cmd = NLBL_UNLABEL_C_STATICADD, |
1558 | .flags = GENL_ADMIN_PERM, | 1559 | .flags = GENL_ADMIN_PERM, |
1559 | .policy = netlbl_unlabel_genl_policy, | 1560 | .policy = netlbl_unlabel_genl_policy, |
1560 | .doit = netlbl_unlabel_staticadd, | 1561 | .doit = netlbl_unlabel_staticadd, |
1561 | .dumpit = NULL, | 1562 | .dumpit = NULL, |
1562 | }; | 1563 | }, |
1563 | 1564 | { | |
1564 | static struct genl_ops netlbl_unlabel_genl_c_staticremove = { | ||
1565 | .cmd = NLBL_UNLABEL_C_STATICREMOVE, | 1565 | .cmd = NLBL_UNLABEL_C_STATICREMOVE, |
1566 | .flags = GENL_ADMIN_PERM, | 1566 | .flags = GENL_ADMIN_PERM, |
1567 | .policy = netlbl_unlabel_genl_policy, | 1567 | .policy = netlbl_unlabel_genl_policy, |
1568 | .doit = netlbl_unlabel_staticremove, | 1568 | .doit = netlbl_unlabel_staticremove, |
1569 | .dumpit = NULL, | 1569 | .dumpit = NULL, |
1570 | }; | 1570 | }, |
1571 | 1571 | { | |
1572 | static struct genl_ops netlbl_unlabel_genl_c_staticlist = { | ||
1573 | .cmd = NLBL_UNLABEL_C_STATICLIST, | 1572 | .cmd = NLBL_UNLABEL_C_STATICLIST, |
1574 | .flags = 0, | 1573 | .flags = 0, |
1575 | .policy = netlbl_unlabel_genl_policy, | 1574 | .policy = netlbl_unlabel_genl_policy, |
1576 | .doit = NULL, | 1575 | .doit = NULL, |
1577 | .dumpit = netlbl_unlabel_staticlist, | 1576 | .dumpit = netlbl_unlabel_staticlist, |
1578 | }; | 1577 | }, |
1579 | 1578 | { | |
1580 | static struct genl_ops netlbl_unlabel_genl_c_staticadddef = { | ||
1581 | .cmd = NLBL_UNLABEL_C_STATICADDDEF, | 1579 | .cmd = NLBL_UNLABEL_C_STATICADDDEF, |
1582 | .flags = GENL_ADMIN_PERM, | 1580 | .flags = GENL_ADMIN_PERM, |
1583 | .policy = netlbl_unlabel_genl_policy, | 1581 | .policy = netlbl_unlabel_genl_policy, |
1584 | .doit = netlbl_unlabel_staticadddef, | 1582 | .doit = netlbl_unlabel_staticadddef, |
1585 | .dumpit = NULL, | 1583 | .dumpit = NULL, |
1586 | }; | 1584 | }, |
1587 | 1585 | { | |
1588 | static struct genl_ops netlbl_unlabel_genl_c_staticremovedef = { | ||
1589 | .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF, | 1586 | .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF, |
1590 | .flags = GENL_ADMIN_PERM, | 1587 | .flags = GENL_ADMIN_PERM, |
1591 | .policy = netlbl_unlabel_genl_policy, | 1588 | .policy = netlbl_unlabel_genl_policy, |
1592 | .doit = netlbl_unlabel_staticremovedef, | 1589 | .doit = netlbl_unlabel_staticremovedef, |
1593 | .dumpit = NULL, | 1590 | .dumpit = NULL, |
1594 | }; | 1591 | }, |
1595 | 1592 | { | |
1596 | static struct genl_ops netlbl_unlabel_genl_c_staticlistdef = { | ||
1597 | .cmd = NLBL_UNLABEL_C_STATICLISTDEF, | 1593 | .cmd = NLBL_UNLABEL_C_STATICLISTDEF, |
1598 | .flags = 0, | 1594 | .flags = 0, |
1599 | .policy = netlbl_unlabel_genl_policy, | 1595 | .policy = netlbl_unlabel_genl_policy, |
1600 | .doit = NULL, | 1596 | .doit = NULL, |
1601 | .dumpit = netlbl_unlabel_staticlistdef, | 1597 | .dumpit = netlbl_unlabel_staticlistdef, |
1602 | }; | 1598 | }, |
1603 | 1599 | { | |
1604 | static struct genl_ops netlbl_unlabel_genl_c_accept = { | ||
1605 | .cmd = NLBL_UNLABEL_C_ACCEPT, | 1600 | .cmd = NLBL_UNLABEL_C_ACCEPT, |
1606 | .flags = GENL_ADMIN_PERM, | 1601 | .flags = GENL_ADMIN_PERM, |
1607 | .policy = netlbl_unlabel_genl_policy, | 1602 | .policy = netlbl_unlabel_genl_policy, |
1608 | .doit = netlbl_unlabel_accept, | 1603 | .doit = netlbl_unlabel_accept, |
1609 | .dumpit = NULL, | 1604 | .dumpit = NULL, |
1610 | }; | 1605 | }, |
1611 | 1606 | { | |
1612 | static struct genl_ops netlbl_unlabel_genl_c_list = { | ||
1613 | .cmd = NLBL_UNLABEL_C_LIST, | 1607 | .cmd = NLBL_UNLABEL_C_LIST, |
1614 | .flags = 0, | 1608 | .flags = 0, |
1615 | .policy = netlbl_unlabel_genl_policy, | 1609 | .policy = netlbl_unlabel_genl_policy, |
1616 | .doit = netlbl_unlabel_list, | 1610 | .doit = netlbl_unlabel_list, |
1617 | .dumpit = NULL, | 1611 | .dumpit = NULL, |
1612 | }, | ||
1618 | }; | 1613 | }; |
1619 | 1614 | ||
1620 | /* | 1615 | /* |
@@ -1631,51 +1626,18 @@ static struct genl_ops netlbl_unlabel_genl_c_list = { | |||
1631 | */ | 1626 | */ |
1632 | int netlbl_unlabel_genl_init(void) | 1627 | int netlbl_unlabel_genl_init(void) |
1633 | { | 1628 | { |
1634 | int ret_val; | 1629 | int ret_val, i; |
1635 | 1630 | ||
1636 | ret_val = genl_register_family(&netlbl_unlabel_gnl_family); | 1631 | ret_val = genl_register_family(&netlbl_unlabel_gnl_family); |
1637 | if (ret_val != 0) | 1632 | if (ret_val != 0) |
1638 | return ret_val; | 1633 | return ret_val; |
1639 | 1634 | ||
1640 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | 1635 | for (i = 0; i < ARRAY_SIZE(netlbl_unlabel_genl_ops); i++) { |
1641 | &netlbl_unlabel_genl_c_staticadd); | 1636 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, |
1642 | if (ret_val != 0) | 1637 | &netlbl_unlabel_genl_ops[i]); |
1643 | return ret_val; | 1638 | if (ret_val != 0) |
1644 | 1639 | return ret_val; | |
1645 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | 1640 | } |
1646 | &netlbl_unlabel_genl_c_staticremove); | ||
1647 | if (ret_val != 0) | ||
1648 | return ret_val; | ||
1649 | |||
1650 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1651 | &netlbl_unlabel_genl_c_staticlist); | ||
1652 | if (ret_val != 0) | ||
1653 | return ret_val; | ||
1654 | |||
1655 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1656 | &netlbl_unlabel_genl_c_staticadddef); | ||
1657 | if (ret_val != 0) | ||
1658 | return ret_val; | ||
1659 | |||
1660 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1661 | &netlbl_unlabel_genl_c_staticremovedef); | ||
1662 | if (ret_val != 0) | ||
1663 | return ret_val; | ||
1664 | |||
1665 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1666 | &netlbl_unlabel_genl_c_staticlistdef); | ||
1667 | if (ret_val != 0) | ||
1668 | return ret_val; | ||
1669 | |||
1670 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1671 | &netlbl_unlabel_genl_c_accept); | ||
1672 | if (ret_val != 0) | ||
1673 | return ret_val; | ||
1674 | |||
1675 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1676 | &netlbl_unlabel_genl_c_list); | ||
1677 | if (ret_val != 0) | ||
1678 | return ret_val; | ||
1679 | 1641 | ||
1680 | return 0; | 1642 | return 0; |
1681 | } | 1643 | } |