Skip to contentSkip to conversation

TIPC cleanups for native API removal

PATCH In review Paul Gortmaker 2 participants 13 messages Nov 30, 2010 – Dec 2, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover TIPC cleanups for native API removal

The purge of the unused code that existed just to support the draft API spec (commit 31e3c3f6f1f9b154981a0e6620df700463db30ee) actually opens the door for several more cleanups of similar nature. It is possible to relocate and internalize header file content, reduce the number of exported symbols further, and manually inline some of the "used once" functions that used to be separate just to be exported.

Some other largely trivial one-off type cleanups are also included. Overall, this set of commits should largely be a no-op in terms of behaviour change though.

Thanks,
Paul.

#1 lore raw

PATCH 1/11 tipc: Remove obsolete native API files and exports

From: Allan Stephens <[email protected]>

As part of the removal of TIPC's native API support it is no longer necessary for TIPC to export symbols for routines that can be called by kernel-based applications, nor for it to have header files that kernel-based applications can include to access the declarations for those routines. This commit eliminates the exporting of symbols by TIPC and migrates the contents of each obsolete native API include file into its corresponding non-native API equivalent.

The code which was migrated in this commit was migrated intact, in that there are no technical changes combined with the relocation.

---
 include/net/tipc/tipc.h        |  186 ------------------------------------
 include/net/tipc/tipc_bearer.h |  138 --------------------------
 include/net/tipc/tipc_msg.h    |  207 ----------------------------------------
 include/net/tipc/tipc_port.h   |  101 -------------------
 net/tipc/bcast.c               |    1 +
 net/tipc/bearer.h              |   69 +++++++++++++-
 net/tipc/config.c              |    2 +-
 net/tipc/core.c                |   40 --------
 net/tipc/core.h                |   14 ++-
 net/tipc/eth_media.c           |    6 +-
 net/tipc/msg.h                 |  168 +++++++++++++++++++++++++++++++--
 net/tipc/port.h                |  131 +++++++++++++++++++++++++
 net/tipc/socket.c              |    3 +-
 net/tipc/subscr.c              |    1 +
 net/tipc/user_reg.h            |    5 +
 15 files changed, 382 insertions(+), 690 deletions(-)
 delete mode 100644 include/net/tipc/tipc.h
 delete mode 100644 include/net/tipc/tipc_bearer.h
 delete mode 100644 include/net/tipc/tipc_msg.h
 delete mode 100644 include/net/tipc/tipc_port.h
include/net/tipc/tipc.h deleted +0 -186
deleted file mode 100644
index 1e0645e..0000000
@@ -1,186 +0,0 @@
-/*
- * include/net/tipc/tipc.h: Main include file for TIPC users
- * 
- * Copyright (c) 2003-2006, Ericsson AB
- * Copyright (c) 2005,2010 Wind River Systems
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright holders nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NET_TIPC_H_
-#define _NET_TIPC_H_
-
-#ifdef __KERNEL__
-
-#include <linux/tipc.h>
-#include <linux/skbuff.h>
-
-/* 
- * Native API
- */
-
-/*
- * TIPC operating mode routines
- */
-
-#define TIPC_NOT_RUNNING  0
-#define TIPC_NODE_MODE    1
-#define TIPC_NET_MODE     2
-
-typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
-
-int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
-
-void tipc_detach(unsigned int userref);
-
-/*
- * TIPC port manipulation routines
- */
-
-typedef void (*tipc_msg_err_event) (void *usr_handle,
-				    u32 portref,
-				    struct sk_buff **buf,
-				    unsigned char const *data,
-				    unsigned int size,
-				    int reason, 
-				    struct tipc_portid const *attmpt_destid);
-
-typedef void (*tipc_named_msg_err_event) (void *usr_handle,
-					  u32 portref,
-					  struct sk_buff **buf,
-					  unsigned char const *data,
-					  unsigned int size,
-					  int reason, 
-					  struct tipc_name_seq const *attmpt_dest);
-
-typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
-					  u32 portref,
-					  struct sk_buff **buf,
-					  unsigned char const *data,
-					  unsigned int size,
-					  int reason);
-
-typedef void (*tipc_msg_event) (void *usr_handle,
-				u32 portref,
-				struct sk_buff **buf,
-				unsigned char const *data,
-				unsigned int size,
-				unsigned int importance, 
-				struct tipc_portid const *origin);
-
-typedef void (*tipc_named_msg_event) (void *usr_handle,
-				      u32 portref,
-				      struct sk_buff **buf,
-				      unsigned char const *data,
-				      unsigned int size,
-				      unsigned int importance, 
-				      struct tipc_portid const *orig,
-				      struct tipc_name_seq const *dest);
-
-typedef void (*tipc_conn_msg_event) (void *usr_handle,
-				     u32 portref,
-				     struct sk_buff **buf,
-				     unsigned char const *data,
-				     unsigned int size);
-
-typedef void (*tipc_continue_event) (void *usr_handle, 
-				     u32 portref);
-
-int tipc_createport(unsigned int tipc_user, 
-		    void *usr_handle, 
-		    unsigned int importance, 
-		    tipc_msg_err_event error_cb, 
-		    tipc_named_msg_err_event named_error_cb, 
-		    tipc_conn_shutdown_event conn_error_cb, 
-		    tipc_msg_event message_cb, 
-		    tipc_named_msg_event named_message_cb, 
-		    tipc_conn_msg_event conn_message_cb, 
-		    tipc_continue_event continue_event_cb,
-		    u32 *portref);
-
-int tipc_deleteport(u32 portref);
-
-int tipc_ownidentity(u32 portref, struct tipc_portid *port);
-
-int tipc_portimportance(u32 portref, unsigned int *importance);
-int tipc_set_portimportance(u32 portref, unsigned int importance);
-
-int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
-int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
-
-int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
-int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
-
-int tipc_publish(u32 portref, unsigned int scope, 
-		 struct tipc_name_seq const *name_seq);
-int tipc_withdraw(u32 portref, unsigned int scope,
-		  struct tipc_name_seq const *name_seq);
-
-int tipc_connect2port(u32 portref, struct tipc_portid const *port);
-
-int tipc_disconnect(u32 portref);
-
-int tipc_shutdown(u32 ref);
-
-/*
- * TIPC messaging routines
- */
-
-#define TIPC_PORT_IMPORTANCE 100	/* send using current port setting */
-
-
-int tipc_send(u32 portref,
-	      unsigned int num_sect,
-	      struct iovec const *msg_sect);
-
-int tipc_send2name(u32 portref, 
-		   struct tipc_name const *name, 
-		   u32 domain,
-		   unsigned int num_sect,
-		   struct iovec const *msg_sect);
-
-int tipc_send2port(u32 portref,
-		   struct tipc_portid const *dest,
-		   unsigned int num_sect,
-		   struct iovec const *msg_sect);
-
-int tipc_send_buf2port(u32 portref,
-		       struct tipc_portid const *dest,
-		       struct sk_buff *buf,
-		       unsigned int dsz);
-
-int tipc_multicast(u32 portref, 
-		   struct tipc_name_seq const *seq, 
-		   u32 domain,	/* currently unused */
-		   unsigned int section_count,
-		   struct iovec const *msg);
-#endif
-
-#endif
include/net/tipc/tipc_bearer.h deleted +0 -138

138 lines not on this page · raw message

include/net/tipc/tipc_msg.h deleted +0 -207

207 lines not on this page · raw message

include/net/tipc/tipc_port.h deleted +0 -101

101 lines not on this page · raw message

net/tipc/bcast.c +1 -0
index 22a60fc..7d449f0 100644
@@ -47,6 +47,7 @@
 #include "name_distr.h"
 #include "bearer.h"
 #include "name_table.h"
+#include "port.h"
 #include "bcast.h"
 
 #define MAX_PKT_DEFAULT_MCAST 1500	/* bcast link max packet size (fixed) */
net/tipc/bearer.h +68 -1

87 lines not on this page · raw message

net/tipc/config.c +1 -1
index 50a6133..82267f3 100644
@@ -43,8 +43,8 @@
 #include "addr.h"
 #include "name_table.h"
 #include "node.h"
+#include "user_reg.h"
 #include "config.h"
-#include "discover.h"
 
 struct subscr_data {
 	char usr_handle[8];
net/tipc/core.c +0 -40
index e2a09eb..785362f 100644
@@ -236,43 +236,3 @@ module_exit(tipc_exit);
 MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_VERSION(TIPC_MOD_VER);
-
-/* Native TIPC API for kernel-space applications (see tipc.h) */
-
-EXPORT_SYMBOL(tipc_attach);
-EXPORT_SYMBOL(tipc_detach);
-EXPORT_SYMBOL(tipc_createport);
-EXPORT_SYMBOL(tipc_deleteport);
-EXPORT_SYMBOL(tipc_ownidentity);
-EXPORT_SYMBOL(tipc_portimportance);
-EXPORT_SYMBOL(tipc_set_portimportance);
-EXPORT_SYMBOL(tipc_portunreliable);
-EXPORT_SYMBOL(tipc_set_portunreliable);
-EXPORT_SYMBOL(tipc_portunreturnable);
-EXPORT_SYMBOL(tipc_set_portunreturnable);
-EXPORT_SYMBOL(tipc_publish);
-EXPORT_SYMBOL(tipc_withdraw);
-EXPORT_SYMBOL(tipc_connect2port);
-EXPORT_SYMBOL(tipc_disconnect);
-EXPORT_SYMBOL(tipc_shutdown);
-EXPORT_SYMBOL(tipc_send);
-EXPORT_SYMBOL(tipc_send2name);
-EXPORT_SYMBOL(tipc_send2port);
-EXPORT_SYMBOL(tipc_multicast);
-
-/* TIPC API for external bearers (see tipc_bearer.h) */
-
-EXPORT_SYMBOL(tipc_block_bearer);
-EXPORT_SYMBOL(tipc_continue);
-EXPORT_SYMBOL(tipc_disable_bearer);
-EXPORT_SYMBOL(tipc_enable_bearer);
-EXPORT_SYMBOL(tipc_recv_msg);
-EXPORT_SYMBOL(tipc_register_media);
-
-/* TIPC API for external APIs (see tipc_port.h) */
-
-EXPORT_SYMBOL(tipc_createport_raw);
-EXPORT_SYMBOL(tipc_reject_msg);
-EXPORT_SYMBOL(tipc_send_buf_fast);
-EXPORT_SYMBOL(tipc_acknowledge);
-
net/tipc/core.h +10 -4
index e19389e..ca7e171 100644
@@ -39,10 +39,6 @@
 
 #include <linux/tipc.h>
 #include <linux/tipc_config.h>
-#include <net/tipc/tipc_msg.h>
-#include <net/tipc/tipc_port.h>
-#include <net/tipc/tipc_bearer.h>
-#include <net/tipc/tipc.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -62,6 +58,9 @@
 
 #define TIPC_MOD_VER "2.0.0"
 
+struct tipc_msg;	/* msg.h */
+struct print_buf;	/* dbg.h */
+
 /*
  * TIPC sanity test macros
  */
@@ -174,6 +173,13 @@ void tipc_dump_dbg(struct print_buf *, const char *fmt, ...);
 #define ELINKCONG EAGAIN	/* link congestion <=> resource unavailable */
 
 /*
+ * TIPC operating mode routines
+ */
+#define TIPC_NOT_RUNNING  0
+#define TIPC_NODE_MODE    1
+#define TIPC_NET_MODE     2
+
+/*
  * Global configuration variables
  */
 
net/tipc/eth_media.c +3 -3
index 6e988ba..ee683cc 100644
@@ -34,13 +34,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <net/tipc/tipc.h>
-#include <net/tipc/tipc_bearer.h>
-#include <net/tipc/tipc_msg.h>
 #include <linux/netdevice.h>
 #include <linux/slab.h>
 #include <net/net_namespace.h>
 
+#include "core.h"
+#include "bearer.h"
+
 #define MAX_ETH_BEARERS		2
 #define ETH_LINK_PRIORITY	TIPC_DEF_LINK_PRI
 #define ETH_LINK_TOLERANCE	TIPC_DEF_LINK_TOL
net/tipc/msg.h +161 -7

272 lines not on this page · raw message

net/tipc/port.h +131 -0

149 lines not on this page · raw message

net/tipc/socket.c +1 -2
index e9f0d50..23a12e4 100644
@@ -49,10 +49,9 @@
 
 #include <linux/tipc.h>
 #include <linux/tipc_config.h>
-#include <net/tipc/tipc_msg.h>
-#include <net/tipc/tipc_port.h>
 
 #include "core.h"
+#include "port.h"
 
 #define SS_LISTENING	-1	/* socket is listening */
 #define SS_READY	-2	/* socket is connectionless */
net/tipc/subscr.c +1 -0
index 3331396..a857e6e 100644
@@ -37,6 +37,7 @@
 #include "core.h"
 #include "dbg.h"
 #include "name_table.h"
+#include "user_reg.h"
 #include "port.h"
 #include "ref.h"
 #include "subscr.h"
net/tipc/user_reg.h +5 -0
index 81dc12e..a05981f 100644
@@ -42,6 +42,11 @@
 int tipc_reg_start(void);
 void tipc_reg_stop(void);
 
+typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
+
+int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
+void tipc_detach(unsigned int userref);
+
 int tipc_reg_add_port(struct user_port *up_ptr);
 int tipc_reg_remove_port(struct user_port *up_ptr);
 
Signature · 1 line
1.7.3.2.146.g2d444
#2 lore raw

PATCH 2/11 tipc: Remove obsolete inclusions of header files

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Gets rid of #include statements that are no longer required as a result of the merging of obsolete native API header file content into other TIPC include files.

---
 net/tipc/addr.c        |    2 --
 net/tipc/bcast.c       |    9 ---------
 net/tipc/bearer.c      |    3 ---
 net/tipc/bearer.h      |    1 -
 net/tipc/cluster.c     |    6 ------
 net/tipc/config.c      |    5 -----
 net/tipc/config.h      |    1 -
 net/tipc/core.c        |    1 -
 net/tipc/discover.c    |    2 --
 net/tipc/discover.h    |    2 --
 net/tipc/link.c        |    8 --------
 net/tipc/link.h        |    1 -
 net/tipc/msg.c         |    2 --
 net/tipc/name_distr.c  |    2 --
 net/tipc/name_table.c  |    5 -----
 net/tipc/net.c         |    5 -----
 net/tipc/node.c        |    6 ------
 net/tipc/node_subscr.c |    2 --
 net/tipc/port.c        |    6 ------
 net/tipc/port.h        |    2 --
 net/tipc/subscr.c      |    3 ---
 net/tipc/zone.c        |    3 ---
 22 files changed, 0 insertions(+), 77 deletions(-)
net/tipc/addr.c +0 -2
index 8a2e89b..886715a 100644
@@ -35,11 +35,9 @@
  */
 
 #include "core.h"
-#include "dbg.h"
 #include "addr.h"
 #include "zone.h"
 #include "cluster.h"
-#include "net.h"
 
 /**
  * tipc_addr_domain_valid - validates a network domain address
net/tipc/bcast.c +0 -9
index 7d449f0..6d828d9 100644
@@ -36,18 +36,9 @@
  */
 
 #include "core.h"
-#include "msg.h"
-#include "dbg.h"
 #include "link.h"
-#include "net.h"
-#include "node.h"
 #include "port.h"
-#include "addr.h"
-#include "node_subscr.h"
 #include "name_distr.h"
-#include "bearer.h"
-#include "name_table.h"
-#include "port.h"
 #include "bcast.h"
 
 #define MAX_PKT_DEFAULT_MCAST 1500	/* bcast link max packet size (fixed) */
net/tipc/bearer.c +0 -3
index 9927d1d..347f255 100644
@@ -36,12 +36,9 @@
 
 #include "core.h"
 #include "config.h"
-#include "dbg.h"
 #include "bearer.h"
-#include "link.h"
 #include "port.h"
 #include "discover.h"
-#include "bcast.h"
 
 #define MAX_ADDR_STR 32
 
net/tipc/bearer.h +0 -1
index 49af7fa..8dc0e92 100644
@@ -37,7 +37,6 @@
 #ifndef _TIPC_BEARER_H
 #define _TIPC_BEARER_H
 
-#include "core.h"
 #include "bcast.h"
 
 #define MAX_BEARERS 8
net/tipc/cluster.c +0 -6
index 7fea14b..ee25179 100644
@@ -36,13 +36,7 @@
 
 #include "core.h"
 #include "cluster.h"
-#include "addr.h"
-#include "node_subscr.h"
 #include "link.h"
-#include "node.h"
-#include "net.h"
-#include "msg.h"
-#include "bearer.h"
 
 static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
 				u32 lower, u32 upper);
net/tipc/config.c +0 -5
index 82267f3..5bb3696 100644
@@ -35,14 +35,9 @@
  */
 
 #include "core.h"
-#include "dbg.h"
-#include "bearer.h"
 #include "port.h"
 #include "link.h"
-#include "zone.h"
-#include "addr.h"
 #include "name_table.h"
-#include "node.h"
 #include "user_reg.h"
 #include "config.h"
 
net/tipc/config.h +0 -1
index 481e12e..443159a 100644
@@ -39,7 +39,6 @@
 
 /* ---------------------------------------------------------------------- */
 
-#include "core.h"
 #include "link.h"
 
 struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
net/tipc/core.c +0 -1
index 785362f..f5d62c1 100644
@@ -40,7 +40,6 @@
 #include <linux/random.h>
 
 #include "core.h"
-#include "dbg.h"
 #include "ref.h"
 #include "net.h"
 #include "user_reg.h"
net/tipc/discover.c +0 -2
index 4a7cd37..f2ce36b 100644
@@ -35,9 +35,7 @@
  */
 
 #include "core.h"
-#include "dbg.h"
 #include "link.h"
-#include "zone.h"
 #include "discover.h"
 #include "port.h"
 #include "name_table.h"
net/tipc/discover.h +0 -2
index f8e7506..d2c3cff 100644
@@ -37,8 +37,6 @@
 #ifndef _TIPC_DISCOVER_H
 #define _TIPC_DISCOVER_H
 
-#include "core.h"
-
 struct link_req;
 
 struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
net/tipc/link.c +0 -8
index b31992c..aee6579 100644
@@ -35,19 +35,11 @@
  */
 
 #include "core.h"
-#include "dbg.h"
 #include "link.h"
-#include "net.h"
-#include "node.h"
 #include "port.h"
-#include "addr.h"
-#include "node_subscr.h"
 #include "name_distr.h"
-#include "bearer.h"
-#include "name_table.h"
 #include "discover.h"
 #include "config.h"
-#include "bcast.h"
 
 
 /*
net/tipc/link.h +0 -1
index f98bc61..c562888 100644
@@ -39,7 +39,6 @@
 
 #include "dbg.h"
 #include "msg.h"
-#include "bearer.h"
 #include "node.h"
 
 #define PUSH_FAILED   1
net/tipc/msg.c +0 -2
index ecb532f..ee6b4c6 100644
@@ -36,9 +36,7 @@
 
 #include "core.h"
 #include "addr.h"
-#include "dbg.h"
 #include "msg.h"
-#include "bearer.h"
 
 u32 tipc_msg_tot_importance(struct tipc_msg *m)
 {
net/tipc/name_distr.c +0 -2
index 7b90717..10ff48b 100644
@@ -36,9 +36,7 @@
 
 #include "core.h"
 #include "cluster.h"
-#include "dbg.h"
 #include "link.h"
-#include "msg.h"
 #include "name_distr.h"
 
 #define ITEM_SIZE sizeof(struct distr_item)
net/tipc/name_table.c +0 -5
index 3a8de43..d5adb04 100644
@@ -36,15 +36,10 @@
 
 #include "core.h"
 #include "config.h"
-#include "dbg.h"
 #include "name_table.h"
 #include "name_distr.h"
-#include "addr.h"
-#include "node_subscr.h"
 #include "subscr.h"
 #include "port.h"
-#include "cluster.h"
-#include "bcast.h"
 
 static int tipc_nametbl_size = 1024;		/* must be a power of 2 */
 
net/tipc/net.c +0 -5
index 1a621cf..c2b4b86 100644
@@ -35,18 +35,13 @@
  */
 
 #include "core.h"
-#include "bearer.h"
 #include "net.h"
 #include "zone.h"
-#include "addr.h"
 #include "name_table.h"
 #include "name_distr.h"
 #include "subscr.h"
 #include "link.h"
-#include "msg.h"
 #include "port.h"
-#include "bcast.h"
-#include "discover.h"
 #include "config.h"
 
 /*
net/tipc/node.c +0 -6
index b4d87eb..bd959a8 100644
@@ -37,13 +37,7 @@
 #include "core.h"
 #include "config.h"
 #include "node.h"
-#include "cluster.h"
-#include "net.h"
-#include "addr.h"
-#include "node_subscr.h"
-#include "link.h"
 #include "port.h"
-#include "bearer.h"
 #include "name_distr.h"
 
 void node_print(struct print_buf *buf, struct tipc_node *n_ptr, char *str);
net/tipc/node_subscr.c +0 -2
index 19194d4..018a553 100644
@@ -35,10 +35,8 @@
  */
 
 #include "core.h"
-#include "dbg.h"
 #include "node_subscr.h"
 #include "node.h"
-#include "addr.h"
 
 /**
  * tipc_nodesub_subscribe - create "node down" subscription for specified node
net/tipc/port.c +0 -6
index 82092ea..e822117 100644
@@ -36,15 +36,9 @@
 
 #include "core.h"
 #include "config.h"
-#include "dbg.h"
 #include "port.h"
-#include "addr.h"
-#include "link.h"
-#include "node.h"
 #include "name_table.h"
 #include "user_reg.h"
-#include "msg.h"
-#include "bcast.h"
 
 /* Connection management: */
 #define PROBING_INTERVAL 3600000	/* [ms] => 1 h */
net/tipc/port.h +0 -2
index 8b9d87a..e038ce1 100644
@@ -37,11 +37,9 @@
 #ifndef _TIPC_PORT_H
 #define _TIPC_PORT_H
 
-#include "core.h"
 #include "ref.h"
 #include "net.h"
 #include "msg.h"
-#include "dbg.h"
 #include "node_subscr.h"
 
 #define TIPC_FLOW_CONTROL_WIN 512
net/tipc/subscr.c +0 -3
index a857e6e..e7fb38b 100644
@@ -35,11 +35,8 @@
  */
 
 #include "core.h"
-#include "dbg.h"
 #include "name_table.h"
 #include "user_reg.h"
-#include "port.h"
-#include "ref.h"
 #include "subscr.h"
 
 /**
net/tipc/zone.c +0 -3
index 83f8b5e..1b61ca8 100644
@@ -36,9 +36,6 @@
 
 #include "core.h"
 #include "zone.h"
-#include "net.h"
-#include "addr.h"
-#include "node_subscr.h"
 #include "cluster.h"
 #include "node.h"
 
Signature · 1 line
1.7.3.2.146.g2d444
#3 lore raw

PATCH 3/11 tipc: Delete unused configuration service structure definition

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Removes a structure definition that is no longer used by TIPC's configuration service.

---
 net/tipc/config.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
net/tipc/config.c +0 -7
index 5bb3696..2ee5a9a 100644
@@ -41,13 +41,6 @@
 #include "user_reg.h"
 #include "config.h"
 
-struct subscr_data {
-	char usr_handle[8];
-	u32 domain;
-	u32 port_ref;
-	struct list_head subd_list;
-};
-
 struct manager {
 	u32 user_ref;
 	u32 port_ref;
Signature · 1 line
1.7.3.2.146.g2d444
#4 lore raw

PATCH 4/11 tipc: Eliminate useless return value when disabling a bearer

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Modifies bearer_disable() to return void since it always indicates success anyway.

---
 net/tipc/bearer.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
net/tipc/bearer.c +5 -4
index 347f255..885da94 100644
@@ -622,7 +622,7 @@ int tipc_block_bearer(const char *name)
  * Note: This routine assumes caller holds tipc_net_lock.
  */
 
-static int bearer_disable(struct bearer *b_ptr)
+static void bearer_disable(struct bearer *b_ptr)
 {
 	struct link *l_ptr;
 	struct link *temp_l_ptr;
@@ -638,7 +638,6 @@ static int bearer_disable(struct bearer *b_ptr)
 	}
 	spin_unlock_bh(&b_ptr->publ.lock);
 	memset(b_ptr, 0, sizeof(struct bearer));
-	return 0;
 }
 
 int tipc_disable_bearer(const char *name)
@@ -651,8 +650,10 @@ int tipc_disable_bearer(const char *name)
 	if (b_ptr == NULL) {
 		warn("Attempt to disable unknown bearer <%s>\n", name);
 		res = -EINVAL;
-	} else
-		res = bearer_disable(b_ptr);
+	} else {
+		bearer_disable(b_ptr);
+		res = 0;
+	}
 	write_unlock_bh(&tipc_net_lock);
 	return res;
 }
Signature · 1 line
1.7.3.2.146.g2d444
#5 lore raw

PATCH 5/11 tipc: Delete useless function prototypes

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Removes several function declarations that aren't used anywhere, either because they reference routines that no longer exist or because all users of the function reference it after it has already been defined.

---
 net/tipc/bearer.h  |    1 -
 net/tipc/cluster.c |    1 -
 net/tipc/node.c    |    1 -
 net/tipc/port.h    |    1 -
 4 files changed, 0 insertions(+), 4 deletions(-)
net/tipc/bearer.h +0 -1
index 8dc0e92..85f451d 100644
@@ -192,7 +192,6 @@ void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr);
 struct bearer *tipc_bearer_find_interface(const char *if_name);
 int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr);
 int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr);
-int tipc_bearer_init(void);
 void tipc_bearer_stop(void);
 void tipc_bearer_lock_push(struct bearer *b_ptr);
 
net/tipc/cluster.c +0 -1
index ee25179..405be87 100644
@@ -40,7 +40,6 @@
 
 static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
 				u32 lower, u32 upper);
-static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest);
 
 struct tipc_node **tipc_local_nodes = NULL;
 struct tipc_node_map tipc_cltr_bcast_nodes = {0,{0,}};
net/tipc/node.c +0 -1
index bd959a8..df71dfc 100644
@@ -40,7 +40,6 @@
 #include "port.h"
 #include "name_distr.h"
 
-void node_print(struct print_buf *buf, struct tipc_node *n_ptr, char *str);
 static void node_lost_contact(struct tipc_node *n_ptr);
 static void node_established_contact(struct tipc_node *n_ptr);
 
net/tipc/port.h +0 -1
index e038ce1..547cd6e 100644
@@ -242,7 +242,6 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
 			      struct iovec const *msg_sect, u32 num_sect,
 			      int err);
 struct sk_buff *tipc_port_get_ports(void);
-struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space);
 void tipc_port_recv_proto_msg(struct sk_buff *buf);
 void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp);
 void tipc_port_reinit(void);
Signature · 1 line
1.7.3.2.146.g2d444
#6 lore raw

PATCH 6/11 tipc: Remove support for TIPC mode change callback

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Eliminates support for the callback routine invoked when TIPC changes its mode of operation from inactive to standalone or from standalone to networked. This callback was part of TIPC's obsolete native API and is not used by TIPC internally.

---
 net/tipc/config.c   |    2 +-
 net/tipc/subscr.c   |    2 +-
 net/tipc/user_reg.c |   50 ++------------------------------------------------
 net/tipc/user_reg.h |    4 +---
 4 files changed, 5 insertions(+), 53 deletions(-)
net/tipc/config.c +1 -1
index 2ee5a9a..bdde39f 100644
@@ -560,7 +560,7 @@ int tipc_cfg_init(void)
 	struct tipc_name_seq seq;
 	int res;
 
-	res = tipc_attach(&mng.user_ref, NULL, NULL);
+	res = tipc_attach(&mng.user_ref);
 	if (res)
 		goto failed;
 
net/tipc/subscr.c +1 -1
index e7fb38b..e13c89a 100644
@@ -549,7 +549,7 @@ int tipc_subscr_start(void)
 	INIT_LIST_HEAD(&topsrv.subscriber_list);
 
 	spin_lock_bh(&topsrv.lock);
-	res = tipc_attach(&topsrv.user_ref, NULL, NULL);
+	res = tipc_attach(&topsrv.user_ref);
 	if (res) {
 		spin_unlock_bh(&topsrv.lock);
 		return res;
net/tipc/user_reg.c +2 -48

105 lines not on this page · raw message

net/tipc/user_reg.h +1 -3
index a05981f..109eed0 100644
@@ -42,9 +42,7 @@
 int tipc_reg_start(void);
 void tipc_reg_stop(void);
 
-typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
-
-int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
+int tipc_attach(unsigned int *userref);
 void tipc_detach(unsigned int userref);
 
 int tipc_reg_add_port(struct user_port *up_ptr);
Signature · 1 line
1.7.3.2.146.g2d444
#7 lore raw

PATCH 7/11 tipc: Remove unused domain argument from multicast send routine

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Eliminates an unused argument from tipc_multicast(), now that this routine can no longer be called by kernel-based applications.

---
 net/tipc/port.c   |    2 +-
 net/tipc/port.h   |    2 +-
 net/tipc/socket.c |    1 -
 3 files changed, 2 insertions(+), 3 deletions(-)
net/tipc/port.c +1 -1
index e822117..01dcfee 100644
@@ -88,7 +88,7 @@ static void port_incr_out_seqno(struct port *p_ptr)
  * tipc_multicast - send a multicast message to local and remote destinations
  */
 
-int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
+int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
 		   u32 num_sect, struct iovec const *msg_sect)
 {
 	struct tipc_msg *hdr;
net/tipc/port.h +1 -1
index 547cd6e..711b4a0 100644
@@ -235,7 +235,7 @@ int tipc_send2port(u32 portref, struct tipc_portid const *dest,
 int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest,
 		struct sk_buff *buf, unsigned int dsz);
 
-int tipc_multicast(u32 portref, struct tipc_name_seq const *seq, u32 domain,
+int tipc_multicast(u32 portref, struct tipc_name_seq const *seq,
 		unsigned int section_count, struct iovec const *msg);
 
 int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
net/tipc/socket.c +0 -1
index 23a12e4..34f96ed 100644
@@ -596,7 +596,6 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
 				break;
 			res = tipc_multicast(tport->ref,
 					     &dest->addr.nameseq,
-					     0,
 					     m->msg_iovlen,
 					     m->msg_iov);
 		}
Signature · 1 line
1.7.3.2.146.g2d444
#8 lore raw

PATCH 8/11 tipc: Eliminate useless initialization when creating subscriber

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Removes initialization of a local variable that is always assigned a different value before it is referenced.

---
 net/tipc/subscr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/tipc/subscr.c +1 -1
index e13c89a..23f43d0 100644
@@ -542,7 +542,7 @@ static void subscr_named_msg_event(void *usr_handle,
 int tipc_subscr_start(void)
 {
 	struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV};
-	int res = -1;
+	int res;
 
 	memset(&topsrv, 0, sizeof (topsrv));
 	spin_lock_init(&topsrv.lock);
Signature · 1 line
1.7.3.2.146.g2d444
#9 lore raw

PATCH 9/11 tipc: Eliminate an unused symbolic constant in link code

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Removes a symbol that is not referenced anywhere by TIPC's link code.

---
 net/tipc/link.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
net/tipc/link.c +0 -6
index aee6579..cf414cf 100644
@@ -49,12 +49,6 @@
 #define INVALID_SESSION 0x10000
 
 /*
- * Limit for deferred reception queue:
- */
-
-#define DEF_QUEUE_LIMIT 256u
-
-/*
  * Link state events:
  */
 
Signature · 1 line
1.7.3.2.146.g2d444
#10 lore raw

PATCH 10/11 tipc: Eliminate obsolete native API forwarding routines

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Moves the content of each native API message forwarding routine into the sole routine that calls it, since the forwarding routines no longer be called in isolation. Also removes code in each routine that altered the outgoing message's importance level since this is now no longer possible.

The previous function mapping (parent function, and child API) was as follows:

tipc_send2name
\--tipc_forward2name

tipc_send2port
\--tipc_forward2port

tipc_send_buf2port
\--tipc_forward_buf2port

After this commit, the children don't exist and their functionality is completely in the respective parent.

---
 net/tipc/port.c |  100 ++++++++----------------------------------------------
 net/tipc/port.h |    2 -
 2 files changed, 15 insertions(+), 87 deletions(-)
net/tipc/port.c +15 -85
index 01dcfee..73f232c 100644
@@ -1265,16 +1265,11 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
 }
 
 /**
- * tipc_forward2name - forward message sections to port name
+ * tipc_send2name - send message sections to port name
  */
 
-static int tipc_forward2name(u32 ref,
-			     struct tipc_name const *name,
-			     u32 domain,
-			     u32 num_sect,
-			     struct iovec const *msg_sect,
-			     struct tipc_portid const *orig,
-			     unsigned int importance)
+int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
+	   unsigned int num_sect, struct iovec const *msg_sect)
 {
 	struct port *p_ptr;
 	struct tipc_msg *msg;
@@ -1288,14 +1283,12 @@ static int tipc_forward2name(u32 ref,
 
 	msg = &p_ptr->publ.phdr;
 	msg_set_type(msg, TIPC_NAMED_MSG);
-	msg_set_orignode(msg, orig->node);
-	msg_set_origport(msg, orig->ref);
+	msg_set_orignode(msg, tipc_own_addr);
+	msg_set_origport(msg, ref);
 	msg_set_hdr_sz(msg, LONG_H_SIZE);
 	msg_set_nametype(msg, name->type);
 	msg_set_nameinst(msg, name->instance);
 	msg_set_lookup_scope(msg, tipc_addr_scope(domain));
-	if (importance <= TIPC_CRITICAL_IMPORTANCE)
-		msg_set_importance(msg,importance);
 	destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
 	msg_set_destnode(msg, destnode);
 	msg_set_destport(msg, destport);
@@ -1319,33 +1312,11 @@ static int tipc_forward2name(u32 ref,
 }
 
 /**
- * tipc_send2name - send message sections to port name
- */
-
-int tipc_send2name(u32 ref,
-		   struct tipc_name const *name,
-		   unsigned int domain,
-		   unsigned int num_sect,
-		   struct iovec const *msg_sect)
-{
-	struct tipc_portid orig;
-
-	orig.ref = ref;
-	orig.node = tipc_own_addr;
-	return tipc_forward2name(ref, name, domain, num_sect, msg_sect, &orig,
-				 TIPC_PORT_IMPORTANCE);
-}
-
-/**
- * tipc_forward2port - forward message sections to port identity
+ * tipc_send2port - send message sections to port identity
  */
 
-static int tipc_forward2port(u32 ref,
-			     struct tipc_portid const *dest,
-			     unsigned int num_sect,
-			     struct iovec const *msg_sect,
-			     struct tipc_portid const *orig,
-			     unsigned int importance)
+int tipc_send2port(u32 ref, struct tipc_portid const *dest,
+	   unsigned int num_sect, struct iovec const *msg_sect)
 {
 	struct port *p_ptr;
 	struct tipc_msg *msg;
@@ -1357,13 +1328,11 @@ static int tipc_forward2port(u32 ref,
 
 	msg = &p_ptr->publ.phdr;
 	msg_set_type(msg, TIPC_DIRECT_MSG);
-	msg_set_orignode(msg, orig->node);
-	msg_set_origport(msg, orig->ref);
+	msg_set_orignode(msg, tipc_own_addr);
+	msg_set_origport(msg, ref);
 	msg_set_destnode(msg, dest->node);
 	msg_set_destport(msg, dest->ref);
 	msg_set_hdr_sz(msg, DIR_MSG_H_SIZE);
-	if (importance <= TIPC_CRITICAL_IMPORTANCE)
-		msg_set_importance(msg, importance);
 	p_ptr->sent++;
 	if (dest->node == tipc_own_addr)
 		return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
@@ -1378,31 +1347,11 @@ static int tipc_forward2port(u32 ref,
 }
 
 /**
- * tipc_send2port - send message sections to port identity
+ * tipc_send_buf2port - send message buffer to port identity
  */
 
-int tipc_send2port(u32 ref,
-		   struct tipc_portid const *dest,
-		   unsigned int num_sect,
-		   struct iovec const *msg_sect)
-{
-	struct tipc_portid orig;
-
-	orig.ref = ref;
-	orig.node = tipc_own_addr;
-	return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig,
-				 TIPC_PORT_IMPORTANCE);
-}
-
-/**
- * tipc_forward_buf2port - forward message buffer to port identity
- */
-static int tipc_forward_buf2port(u32 ref,
-				 struct tipc_portid const *dest,
-				 struct sk_buff *buf,
-				 unsigned int dsz,
-				 struct tipc_portid const *orig,
-				 unsigned int importance)
+int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest,
+	       struct sk_buff *buf, unsigned int dsz)
 {
 	struct port *p_ptr;
 	struct tipc_msg *msg;
@@ -1414,13 +1363,11 @@ static int tipc_forward_buf2port(u32 ref,
 
 	msg = &p_ptr->publ.phdr;
 	msg_set_type(msg, TIPC_DIRECT_MSG);
-	msg_set_orignode(msg, orig->node);
-	msg_set_origport(msg, orig->ref);
+	msg_set_orignode(msg, tipc_own_addr);
+	msg_set_origport(msg, ref);
 	msg_set_destnode(msg, dest->node);
 	msg_set_destport(msg, dest->ref);
 	msg_set_hdr_sz(msg, DIR_MSG_H_SIZE);
-	if (importance <= TIPC_CRITICAL_IMPORTANCE)
-		msg_set_importance(msg, importance);
 	msg_set_size(msg, DIR_MSG_H_SIZE + dsz);
 	if (skb_cow(buf, DIR_MSG_H_SIZE))
 		return -ENOMEM;
@@ -1439,20 +1386,3 @@ static int tipc_forward_buf2port(u32 ref,
 	return -ELINKCONG;
 }
 
-/**
- * tipc_send_buf2port - send message buffer to port identity
- */
-
-int tipc_send_buf2port(u32 ref,
-		       struct tipc_portid const *dest,
-		       struct sk_buff *buf,
-		       unsigned int dsz)
-{
-	struct tipc_portid orig;
-
-	orig.ref = ref;
-	orig.node = tipc_own_addr;
-	return tipc_forward_buf2port(ref, dest, buf, dsz, &orig,
-				     TIPC_PORT_IMPORTANCE);
-}
-
net/tipc/port.h +0 -2
index 711b4a0..3f6c0aa 100644
@@ -222,8 +222,6 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr);
 /*
  * TIPC messaging routines
  */
-#define TIPC_PORT_IMPORTANCE 100	/* send using current port setting */
-
 int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect);
 
 int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain,
Signature · 1 line
1.7.3.2.146.g2d444
#11 lore raw

PATCH 11/11 tipc: Delete tipc_ownidentity()

In reply to Paul Gortmaker

From: Allan Stephens <[email protected]>

Moves the content of the native API routine tipc_ownidentity() into the sole routine that calls it, since it can no longer be called in isolation.

---
 net/tipc/port.c   |    7 -------
 net/tipc/port.h   |    2 --
 net/tipc/socket.c |    3 ++-
 3 files changed, 2 insertions(+), 10 deletions(-)
net/tipc/port.c +0 -7
index 73f232c..7873283 100644
@@ -983,13 +983,6 @@ int tipc_createport(u32 user_ref,
 	return 0;
 }
 
-int tipc_ownidentity(u32 ref, struct tipc_portid *id)
-{
-	id->ref = ref;
-	id->node = tipc_own_addr;
-	return 0;
-}
-
 int tipc_portimportance(u32 ref, unsigned int *importance)
 {
 	struct port *p_ptr;
net/tipc/port.h +0 -2
index 3f6c0aa..3a807fc 100644
@@ -191,8 +191,6 @@ int tipc_createport(unsigned int tipc_user, void *usr_handle,
 
 int tipc_deleteport(u32 portref);
 
-int tipc_ownidentity(u32 portref, struct tipc_portid *port);
-
 int tipc_portimportance(u32 portref, unsigned int *importance);
 int tipc_set_portimportance(u32 portref, unsigned int importance);
 
net/tipc/socket.c +2 -1
index 34f96ed..cd0bb77 100644
@@ -403,7 +403,8 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
 		addr->addr.id.ref = tsock->peer_name.ref;
 		addr->addr.id.node = tsock->peer_name.node;
 	} else {
-		tipc_ownidentity(tsock->p->ref, &addr->addr.id);
+		addr->addr.id.ref = tsock->p->ref;
+		addr->addr.id.node = tipc_own_addr;
 	}
 
 	*uaddr_len = sizeof(*addr);
Signature · 1 line
1.7.3.2.146.g2d444
maintainer
#12 lore raw
In reply to Paul Gortmaker

From: Paul Gortmaker <[email protected]>
Date: Tue, 30 Nov 2010 17:00:52 -0500

Quoted 10 lines

The purge of the unused code that existed just to support the draft API spec (commit 31e3c3f6f1f9b154981a0e6620df700463db30ee) actually opens the door for several more cleanups of similar nature. It is possible to relocate and internalize header file content, reduce the number of exported symbols further, and manually inline some of the "used once" functions that used to be separate just to be exported.

Some other largely trivial one-off type cleanups are also included. Overall, this set of commits should largely be a no-op in terms of behaviour change though.

Looks great, all applied, thanks!