diff options
author | Richard Alpe <richard.alpe@ericsson.com> | 2015-02-09 03:50:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-09 16:20:49 -0500 |
commit | 5a81a6377b6083fccffdfb7a21ec080b8d58475b (patch) | |
tree | c7fd10b1e5a0a49f2d4859e478ca19d022178e45 /net/tipc | |
parent | 3c26181c5b1b0b49e147bac8a8d012234f813a5e (diff) |
tipc: convert legacy nl stats show to nl compat
Convert TIPC_CMD_SHOW_STATS to compat layer. This command does not
have any counterpart in the new API, meaning it now solely exists as a
function in the compat layer.
Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/config.c | 35 | ||||
-rw-r--r-- | net/tipc/netlink_compat.c | 15 |
2 files changed, 15 insertions, 35 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c index 019f46c0690c..c2ad2ff32a15 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -83,38 +83,6 @@ struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string) | |||
83 | return buf; | 83 | return buf; |
84 | } | 84 | } |
85 | 85 | ||
86 | static struct sk_buff *tipc_show_stats(void) | ||
87 | { | ||
88 | struct sk_buff *buf; | ||
89 | struct tlv_desc *rep_tlv; | ||
90 | char *pb; | ||
91 | int pb_len; | ||
92 | int str_len; | ||
93 | u32 value; | ||
94 | |||
95 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | ||
96 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | ||
97 | |||
98 | value = ntohl(*(u32 *)TLV_DATA(req_tlv_area)); | ||
99 | if (value != 0) | ||
100 | return tipc_cfg_reply_error_string("unsupported argument"); | ||
101 | |||
102 | buf = tipc_cfg_reply_alloc(TLV_SPACE(ULTRA_STRING_MAX_LEN)); | ||
103 | if (buf == NULL) | ||
104 | return NULL; | ||
105 | |||
106 | rep_tlv = (struct tlv_desc *)buf->data; | ||
107 | pb = TLV_DATA(rep_tlv); | ||
108 | pb_len = ULTRA_STRING_MAX_LEN; | ||
109 | |||
110 | str_len = tipc_snprintf(pb, pb_len, "TIPC version " TIPC_MOD_VER "\n"); | ||
111 | str_len += 1; /* for "\0" */ | ||
112 | skb_put(buf, TLV_SPACE(str_len)); | ||
113 | TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); | ||
114 | |||
115 | return buf; | ||
116 | } | ||
117 | |||
118 | struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd, | 86 | struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd, |
119 | const void *request_area, int request_space, | 87 | const void *request_area, int request_space, |
120 | int reply_headroom) | 88 | int reply_headroom) |
@@ -142,9 +110,6 @@ struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd, | |||
142 | case TIPC_CMD_NOOP: | 110 | case TIPC_CMD_NOOP: |
143 | rep_tlv_buf = tipc_cfg_reply_none(); | 111 | rep_tlv_buf = tipc_cfg_reply_none(); |
144 | break; | 112 | break; |
145 | case TIPC_CMD_SHOW_STATS: | ||
146 | rep_tlv_buf = tipc_show_stats(); | ||
147 | break; | ||
148 | case TIPC_CMD_NOT_NET_ADMIN: | 113 | case TIPC_CMD_NOT_NET_ADMIN: |
149 | rep_tlv_buf = | 114 | rep_tlv_buf = |
150 | tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); | 115 | tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); |
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index 415909054ec0..cb9086d259df 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c | |||
@@ -888,6 +888,18 @@ static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, | |||
888 | return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); | 888 | return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); |
889 | } | 889 | } |
890 | 890 | ||
891 | static int tipc_cmd_show_stats_compat(struct tipc_nl_compat_msg *msg) | ||
892 | { | ||
893 | msg->rep = tipc_tlv_alloc(ULTRA_STRING_MAX_LEN); | ||
894 | if (!msg->rep) | ||
895 | return -ENOMEM; | ||
896 | |||
897 | tipc_tlv_init(msg->rep, TIPC_TLV_ULTRA_STRING); | ||
898 | tipc_tlv_sprintf(msg->rep, "TIPC version " TIPC_MOD_VER "\n"); | ||
899 | |||
900 | return 0; | ||
901 | } | ||
902 | |||
891 | static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) | 903 | static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) |
892 | { | 904 | { |
893 | struct tipc_nl_compat_cmd_dump dump; | 905 | struct tipc_nl_compat_cmd_dump dump; |
@@ -976,6 +988,8 @@ static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) | |||
976 | dump.dumpit = tipc_nl_net_dump; | 988 | dump.dumpit = tipc_nl_net_dump; |
977 | dump.format = tipc_nl_compat_net_dump; | 989 | dump.format = tipc_nl_compat_net_dump; |
978 | return tipc_nl_compat_dumpit(&dump, msg); | 990 | return tipc_nl_compat_dumpit(&dump, msg); |
991 | case TIPC_CMD_SHOW_STATS: | ||
992 | return tipc_cmd_show_stats_compat(msg); | ||
979 | } | 993 | } |
980 | 994 | ||
981 | return -EOPNOTSUPP; | 995 | return -EOPNOTSUPP; |
@@ -1088,6 +1102,7 @@ static int tipc_nl_compat_tmp_wrap(struct sk_buff *skb, struct genl_info *info) | |||
1088 | case TIPC_CMD_SET_NODE_ADDR: | 1102 | case TIPC_CMD_SET_NODE_ADDR: |
1089 | case TIPC_CMD_SET_NETID: | 1103 | case TIPC_CMD_SET_NETID: |
1090 | case TIPC_CMD_GET_NETID: | 1104 | case TIPC_CMD_GET_NETID: |
1105 | case TIPC_CMD_SHOW_STATS: | ||
1091 | return tipc_nl_compat_recv(skb, info); | 1106 | return tipc_nl_compat_recv(skb, info); |
1092 | } | 1107 | } |
1093 | 1108 | ||