Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tipc: convert legacy nl link stat reset to nl compat

Convert TIPC_CMD_RESET_LINK_STATS to compat doit.

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>

authored by

Richard Alpe and committed by
David S. Miller
1817877b 37e2d484

+27 -41
-4
net/tipc/config.c
··· 209 209 rep_tlv_buf = tipc_node_get_nodes(net, req_tlv_area, 210 210 req_tlv_space); 211 211 break; 212 - case TIPC_CMD_RESET_LINK_STATS: 213 - rep_tlv_buf = tipc_link_cmd_reset_stats(net, req_tlv_area, 214 - req_tlv_space); 215 - break; 216 212 case TIPC_CMD_SHOW_NAME_TABLE: 217 213 rep_tlv_buf = tipc_nametbl_get(net, req_tlv_area, 218 214 req_tlv_space);
+1 -34
net/tipc/link.c
··· 1969 1969 l_ptr->stats.recv_info = l_ptr->next_in_no; 1970 1970 } 1971 1971 1972 - struct sk_buff *tipc_link_cmd_reset_stats(struct net *net, 1973 - const void *req_tlv_area, 1974 - int req_tlv_space) 1975 - { 1976 - char *link_name; 1977 - struct tipc_link *l_ptr; 1978 - struct tipc_node *node; 1979 - unsigned int bearer_id; 1980 - 1981 - if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 1982 - return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 1983 - 1984 - link_name = (char *)TLV_DATA(req_tlv_area); 1985 - if (!strcmp(link_name, tipc_bclink_name)) { 1986 - if (tipc_bclink_reset_stats(net)) 1987 - return tipc_cfg_reply_error_string("link not found"); 1988 - return tipc_cfg_reply_none(); 1989 - } 1990 - node = tipc_link_find_owner(net, link_name, &bearer_id); 1991 - if (!node) 1992 - return tipc_cfg_reply_error_string("link not found"); 1993 - 1994 - tipc_node_lock(node); 1995 - l_ptr = node->links[bearer_id]; 1996 - if (!l_ptr) { 1997 - tipc_node_unlock(node); 1998 - return tipc_cfg_reply_error_string("link not found"); 1999 - } 2000 - link_reset_statistics(l_ptr); 2001 - tipc_node_unlock(node); 2002 - return tipc_cfg_reply_none(); 2003 - } 2004 - 2005 1972 static void link_print(struct tipc_link *l_ptr, const char *str) 2006 1973 { 2007 1974 struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id); ··· 2391 2424 struct tipc_link *link; 2392 2425 struct tipc_node *node; 2393 2426 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; 2394 - struct net *net = genl_info_net(info); 2427 + struct net *net = sock_net(skb->sk); 2395 2428 2396 2429 if (!info->attrs[TIPC_NLA_LINK]) 2397 2430 return -EINVAL;
-3
net/tipc/link.h
··· 215 215 int tipc_link_is_up(struct tipc_link *l_ptr); 216 216 int tipc_link_is_active(struct tipc_link *l_ptr); 217 217 void tipc_link_purge_queues(struct tipc_link *l_ptr); 218 - struct sk_buff *tipc_link_cmd_reset_stats(struct net *net, 219 - const void *req_tlv_area, 220 - int req_tlv_space); 221 218 void tipc_link_reset_all(struct tipc_node *node); 222 219 void tipc_link_reset(struct tipc_link *l_ptr); 223 220 void tipc_link_reset_list(struct net *net, unsigned int bearer_id);