genetlink: make all genl_ops users const
authorJohannes Berg <johannes.berg@intel.com>
Thu, 14 Nov 2013 16:14:46 +0000 (17:14 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Nov 2013 22:10:41 +0000 (17:10 -0500)
Now that genl_ops are no longer modified in place when
registering, they can be made const. This patch was done
mostly with spatch:

@@
identifier ops;
@@
+const
 struct genl_ops ops[] = {
 ...
 };

(except the struct thing in net/openvswitch/datapath.c)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 files changed:
drivers/net/team/team.c
drivers/net/wireless/mac80211_hwsim.c
kernel/taskstats.c
net/core/drop_monitor.c
net/hsr/hsr_netlink.c
net/ieee802154/netlink.c
net/ipv4/tcp_metrics.c
net/irda/irnetlink.c
net/l2tp/l2tp_netlink.c
net/netfilter/ipvs/ip_vs_ctl.c
net/netlabel/netlabel_cipso_v4.c
net/netlabel/netlabel_mgmt.c
net/netlabel/netlabel_unlabeled.c
net/nfc/netlink.c
net/openvswitch/datapath.c
net/wimax/stack.c
net/wireless/nl80211.c

index 50e43e64d51defbf84a399bdcfa048951ab2fdba..6390254beb7d2b8a577a177f234949bdc709da06 100644 (file)
@@ -2644,7 +2644,7 @@ static int team_nl_cmd_port_list_get(struct sk_buff *skb,
        return err;
 }
 
-static struct genl_ops team_nl_ops[] = {
+static const struct genl_ops team_nl_ops[] = {
        {
                .cmd = TEAM_CMD_NOOP,
                .doit = team_nl_cmd_noop,
index de0df86704e714778891b7fb1af6b2cfc1340bef..cfc3fda79a2d8522ed963154a64c107a6f45ada8 100644 (file)
@@ -2097,7 +2097,7 @@ out:
 }
 
 /* Generic Netlink operations array */
-static struct genl_ops hwsim_ops[] = {
+static const struct genl_ops hwsim_ops[] = {
        {
                .cmd = HWSIM_CMD_REGISTER,
                .policy = hwsim_genl_policy,
index 609e77f6868783b447c4aac7b10a5420fc0a67e5..76595cd9d211a41c4f59bba07ff38026bc0f398d 100644 (file)
@@ -673,7 +673,7 @@ err:
        nlmsg_free(rep_skb);
 }
 
-static struct genl_ops taskstats_ops[] = {
+static const struct genl_ops taskstats_ops[] = {
        {
                .cmd            = TASKSTATS_CMD_GET,
                .doit           = taskstats_user_cmd,
index 5e78d44333b9bc39fdb56fdd489d0ac4f7f5d4e8..f9fe2f22d20bcc5ff813bdd22c1263c5aa816367 100644 (file)
@@ -333,7 +333,7 @@ out:
        return NOTIFY_DONE;
 }
 
-static struct genl_ops dropmon_ops[] = {
+static const struct genl_ops dropmon_ops[] = {
        {
                .cmd = NET_DM_CMD_CONFIG,
                .doit = net_dm_cmd_config,
index 8f52a9fb7e85d11e7c27ef4cfeb4e28dde1cd270..79d72ca309cee8aa74ba0bc1a40519fc5e6cb850 100644 (file)
@@ -389,7 +389,7 @@ fail:
 }
 
 
-static struct genl_ops hsr_ops[] = {
+static const struct genl_ops hsr_ops[] = {
        {
                .cmd = HSR_C_GET_NODE_STATUS,
                .flags = 0,
index eb9faef6782a1d614f966f514fbe08d082b3ef13..3ffcdbb56aabd0dfaa0885401f2a039680e59c34 100644 (file)
@@ -109,7 +109,7 @@ out:
        return -ENOBUFS;
 }
 
-static struct genl_ops ieee8021154_ops[] = {
+static const struct genl_ops ieee8021154_ops[] = {
        /* see nl-phy.c */
        IEEE802154_DUMP(IEEE802154_LIST_PHY, ieee802154_list_phy,
                        ieee802154_dump_phy),
index d3ee2e0c28b6c0dcbfe93445563ee53e3ce52431..8c121b523eee524d1552411a9cfef31c7e898bad 100644 (file)
@@ -991,7 +991,7 @@ static int tcp_metrics_nl_cmd_del(struct sk_buff *skb, struct genl_info *info)
        return 0;
 }
 
-static struct genl_ops tcp_metrics_nl_ops[] = {
+static const struct genl_ops tcp_metrics_nl_ops[] = {
        {
                .cmd = TCP_METRICS_CMD_GET,
                .doit = tcp_metrics_nl_cmd_get,
index c32971269280116543c0bf560e1bbc3248df034d..bf5d7d476daefdb37f57e9354b795b0d875c7a23 100644 (file)
@@ -131,7 +131,7 @@ static const struct nla_policy irda_nl_policy[IRDA_NL_ATTR_MAX + 1] = {
        [IRDA_NL_ATTR_MODE] = { .type = NLA_U32 },
 };
 
-static struct genl_ops irda_nl_ops[] = {
+static const struct genl_ops irda_nl_ops[] = {
        {
                .cmd = IRDA_NL_CMD_SET_MODE,
                .doit = irda_nl_set_mode,
index be446d517bc96641d413dc0bba09d9150398a81e..57db66e24f1fcc78f8cdbd95d3e02744c8f20e43 100644 (file)
@@ -793,7 +793,7 @@ static struct nla_policy l2tp_nl_policy[L2TP_ATTR_MAX + 1] = {
        },
 };
 
-static struct genl_ops l2tp_nl_ops[] = {
+static const struct genl_ops l2tp_nl_ops[] = {
        {
                .cmd = L2TP_CMD_NOOP,
                .doit = l2tp_nl_cmd_noop,
index 62786a495cea481a3fd18d063b7174cdb36052ad..fc8a04ed88547fc033a1b92179aa056779bb767a 100644 (file)
@@ -3567,7 +3567,7 @@ out:
 }
 
 
-static struct genl_ops ip_vs_genl_ops[] __read_mostly = {
+static const struct genl_ops ip_vs_genl_ops[] __read_mostly = {
        {
                .cmd    = IPVS_CMD_NEW_SERVICE,
                .flags  = GENL_ADMIN_PERM,
index a1100640495d3d3b106e850e9af6a9cc4e1ed547..706691739b991f65de4b7a1e441c50cb480aed66 100644 (file)
@@ -737,7 +737,7 @@ static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info)
  * NetLabel Generic NETLINK Command Definitions
  */
 
-static struct genl_ops netlbl_cipsov4_ops[] = {
+static const struct genl_ops netlbl_cipsov4_ops[] = {
        {
        .cmd = NLBL_CIPSOV4_C_ADD,
        .flags = GENL_ADMIN_PERM,
index dd1c37d7acbcfa6d126a8056360b8d6a56985035..7de6f660b80a554d25feeeb328749e581e7205ee 100644 (file)
@@ -705,7 +705,7 @@ version_failure:
  * NetLabel Generic NETLINK Command Definitions
  */
 
-static struct genl_ops netlbl_mgmt_genl_ops[] = {
+static const struct genl_ops netlbl_mgmt_genl_ops[] = {
        {
        .cmd = NLBL_MGMT_C_ADD,
        .flags = GENL_ADMIN_PERM,
index 8f0897407a2cf950240082cfde9ab07969f96404..76ee9252daa774d073ffd3d90f9690c368f89312 100644 (file)
@@ -1323,7 +1323,7 @@ unlabel_staticlistdef_return:
  * NetLabel Generic NETLINK Command Definitions
  */
 
-static struct genl_ops netlbl_unlabel_genl_ops[] = {
+static const struct genl_ops netlbl_unlabel_genl_ops[] = {
        {
        .cmd = NLBL_UNLABEL_C_STATICADD,
        .flags = GENL_ADMIN_PERM,
index 84b7e3ea7b7ad7ce09e9256916589e4724d55969..f5585611c098977cd4553303ef0d7e92c3a11606 100644 (file)
@@ -1364,7 +1364,7 @@ static int nfc_genl_se_io(struct sk_buff *skb, struct genl_info *info)
        return dev->ops->se_io(dev, se_idx, apdu, apdu_len, se_io_cb, ctx);
 }
 
-static struct genl_ops nfc_genl_ops[] = {
+static const struct genl_ops nfc_genl_ops[] = {
        {
                .cmd = NFC_CMD_GET_DEVICE,
                .doit = nfc_genl_get_device,
index 1408adc2a2a7d2c47f4e32f71863bbd3a04cfdf2..91e1c927a46542dd838ebadbb9e63e3831706472 100644 (file)
@@ -557,7 +557,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
        [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
 };
 
-static struct genl_ops dp_packet_genl_ops[] = {
+static const struct genl_ops dp_packet_genl_ops[] = {
        { .cmd = OVS_PACKET_CMD_EXECUTE,
          .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
          .policy = packet_policy,
@@ -1034,7 +1034,7 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
        return skb->len;
 }
 
-static struct genl_ops dp_flow_genl_ops[] = {
+static const struct genl_ops dp_flow_genl_ops[] = {
        { .cmd = OVS_FLOW_CMD_NEW,
          .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
          .policy = flow_policy,
@@ -1392,7 +1392,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
        return skb->len;
 }
 
-static struct genl_ops dp_datapath_genl_ops[] = {
+static const struct genl_ops dp_datapath_genl_ops[] = {
        { .cmd = OVS_DP_CMD_NEW,
          .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
          .policy = datapath_policy,
@@ -1753,7 +1753,7 @@ out:
        return skb->len;
 }
 
-static struct genl_ops dp_vport_genl_ops[] = {
+static const struct genl_ops dp_vport_genl_ops[] = {
        { .cmd = OVS_VPORT_CMD_NEW,
          .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
          .policy = vport_policy,
@@ -1779,7 +1779,7 @@ static struct genl_ops dp_vport_genl_ops[] = {
 
 struct genl_family_and_ops {
        struct genl_family *family;
-       struct genl_ops *ops;
+       const struct genl_ops *ops;
        int n_ops;
        struct genl_multicast_group *group;
 };
index 4b7f15a500876a818eca8a6e76a0ed76260e21e9..47170c9495f14322e6c83ab504134e49e98b31dd 100644 (file)
@@ -415,7 +415,7 @@ static const struct nla_policy wimax_gnl_policy[WIMAX_GNL_ATTR_MAX + 1] = {
        },
 };
 
-static struct genl_ops wimax_gnl_ops[] = {
+static const struct genl_ops wimax_gnl_ops[] = {
        {
                .cmd = WIMAX_GNL_OP_MSG_FROM_USER,
                .flags = GENL_ADMIN_PERM,
index 3fef55958e982567242a8b5934b059e1ab0838c6..58c43c8e149fb236ccec6c8701d76ca0d21db206 100644 (file)
@@ -8937,7 +8937,7 @@ static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
                rtnl_unlock();
 }
 
-static struct genl_ops nl80211_ops[] = {
+static const struct genl_ops nl80211_ops[] = {
        {
                .cmd = NL80211_CMD_GET_WIPHY,
                .doit = nl80211_get_wiphy,