Skip to content

Commit

Permalink
tipc: cleanup function namespace
Browse files Browse the repository at this point in the history
Do some cleanups of TIPC based on make namespacecheck
  1. Don't export unused symbols
  2. Eliminate dead code
  3. Make functions and variables local
  4. Rename buf_acquire to tipc_buf_acquire since it is used in several files

Compile tested only.
This make break out of tree kernel modules that depend on TIPC routines.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
stephen hemminger authored and davem330 committed Oct 16, 2010
1 parent 1541922 commit 31e3c3f
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 462 deletions.
71 changes: 0 additions & 71 deletions include/net/tipc/tipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
* TIPC operating mode routines
*/

u32 tipc_get_addr(void);

#define TIPC_NOT_RUNNING 0
#define TIPC_NODE_MODE 1
#define TIPC_NET_MODE 2
Expand All @@ -62,8 +60,6 @@ int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);

void tipc_detach(unsigned int userref);

int tipc_get_mode(void);

/*
* TIPC port manipulation routines
*/
Expand Down Expand Up @@ -153,12 +149,6 @@ int tipc_disconnect(u32 portref);

int tipc_shutdown(u32 ref);

int tipc_isconnected(u32 portref, int *isconnected);

int tipc_peer(u32 portref, struct tipc_portid *peer);

int tipc_ref_valid(u32 portref);

/*
* TIPC messaging routines
*/
Expand All @@ -170,38 +160,12 @@ int tipc_send(u32 portref,
unsigned int num_sect,
struct iovec const *msg_sect);

int tipc_send_buf(u32 portref,
struct sk_buff *buf,
unsigned int dsz);

int tipc_send2name(u32 portref,
struct tipc_name const *name,
u32 domain,
unsigned int num_sect,
struct iovec const *msg_sect);

int tipc_send_buf2name(u32 portref,
struct tipc_name const *name,
u32 domain,
struct sk_buff *buf,
unsigned int dsz);

int tipc_forward2name(u32 portref,
struct tipc_name const *name,
u32 domain,
unsigned int section_count,
struct iovec const *msg_sect,
struct tipc_portid const *origin,
unsigned int importance);

int tipc_forward_buf2name(u32 portref,
struct tipc_name const *name,
u32 domain,
struct sk_buff *buf,
unsigned int dsz,
struct tipc_portid const *orig,
unsigned int importance);

int tipc_send2port(u32 portref,
struct tipc_portid const *dest,
unsigned int num_sect,
Expand All @@ -212,46 +176,11 @@ int tipc_send_buf2port(u32 portref,
struct sk_buff *buf,
unsigned int dsz);

int tipc_forward2port(u32 portref,
struct tipc_portid const *dest,
unsigned int num_sect,
struct iovec const *msg_sect,
struct tipc_portid const *origin,
unsigned int importance);

int tipc_forward_buf2port(u32 portref,
struct tipc_portid const *dest,
struct sk_buff *buf,
unsigned int dsz,
struct tipc_portid const *orig,
unsigned int importance);

int tipc_multicast(u32 portref,
struct tipc_name_seq const *seq,
u32 domain, /* currently unused */
unsigned int section_count,
struct iovec const *msg);

#if 0
int tipc_multicast_buf(u32 portref,
struct tipc_name_seq const *seq,
u32 domain,
void *buf,
unsigned int size);
#endif

/*
* TIPC subscription routines
*/

int tipc_ispublished(struct tipc_name const *name);

/*
* Get number of available nodes within specified domain (excluding own node)
*/

unsigned int tipc_available_nodes(const u32 domain);

#endif

#endif
2 changes: 0 additions & 2 deletions include/net/tipc/tipc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ void tipc_acknowledge(u32 port_ref,u32 ack);

struct tipc_port *tipc_get_port(const u32 ref);

void *tipc_get_handle(const u32 ref);

/*
* The following routines require that the port be locked on entry
*/
Expand Down
5 changes: 0 additions & 5 deletions net/tipc/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
#include "cluster.h"
#include "net.h"

u32 tipc_get_addr(void)
{
return tipc_own_addr;
}

/**
* tipc_addr_domain_valid - validates a network domain address
*
Expand Down
10 changes: 7 additions & 3 deletions net/tipc/bcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ static DEFINE_SPINLOCK(bc_lock);

const char tipc_bclink_name[] = "broadcast-link";

static void tipc_nmap_diff(struct tipc_node_map *nm_a,
struct tipc_node_map *nm_b,
struct tipc_node_map *nm_diff);

static u32 buf_seqno(struct sk_buff *buf)
{
Expand Down Expand Up @@ -287,7 +290,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr)
if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
return;

buf = buf_acquire(INT_H_SIZE);
buf = tipc_buf_acquire(INT_H_SIZE);
if (buf) {
msg = buf_msg(buf);
tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
Expand Down Expand Up @@ -871,8 +874,9 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node)
* @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
*/

void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
struct tipc_node_map *nm_diff)
static void tipc_nmap_diff(struct tipc_node_map *nm_a,
struct tipc_node_map *nm_b,
struct tipc_node_map *nm_diff)
{
int stop = ARRAY_SIZE(nm_a->map);
int w;
Expand Down
3 changes: 0 additions & 3 deletions net/tipc/bcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_m
return !memcmp(nm_a, nm_b, sizeof(*nm_a));
}

void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
struct tipc_node_map *nm_diff);

void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
void tipc_port_list_free(struct port_list *pl_ptr);

Expand Down
21 changes: 1 addition & 20 deletions net/tipc/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,6 @@ void tipc_cltr_delete(struct cluster *c_ptr)
kfree(c_ptr);
}

u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
{
struct tipc_node *n_ptr;
u32 n_num = tipc_node(addr) + 1;

if (!c_ptr)
return addr;
for (; n_num <= c_ptr->highest_node; n_num++) {
n_ptr = c_ptr->nodes[n_num];
if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr->addr;
}
for (n_num = 1; n_num < tipc_node(addr); n_num++) {
n_ptr = c_ptr->nodes[n_num];
if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr->addr;
}
return 0;
}

void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
{
Expand Down Expand Up @@ -232,7 +213,7 @@ struct tipc_node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
{
u32 size = INT_H_SIZE + data_size;
struct sk_buff *buf = buf_acquire(size);
struct sk_buff *buf = tipc_buf_acquire(size);
struct tipc_msg *msg;

if (buf) {
Expand Down
2 changes: 1 addition & 1 deletion net/tipc/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr);
void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
void tipc_cltr_broadcast(struct sk_buff *buf);
int tipc_cltr_init(void);
u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);

void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
Expand Down
7 changes: 6 additions & 1 deletion net/tipc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
return 1;
}

struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
static struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
{
struct sk_buff *buf;
__be32 value_net;
Expand All @@ -109,6 +109,11 @@ struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
return buf;
}

static struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
{
return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
}

struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
{
struct sk_buff *buf;
Expand Down
6 changes: 0 additions & 6 deletions net/tipc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,13 @@
struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
void *tlv_data, int tlv_data_size);
struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);

static inline struct sk_buff *tipc_cfg_reply_none(void)
{
return tipc_cfg_reply_alloc(0);
}

static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
{
return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
}

static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
{
return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
Expand Down
28 changes: 6 additions & 22 deletions net/tipc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ int tipc_net_id;
int tipc_remote_management;


int tipc_get_mode(void)
static int tipc_get_mode(void)
{
return tipc_mode;
}

/**
* buf_acquire - creates a TIPC message buffer
* tipc_buf_acquire - creates a TIPC message buffer
* @size: message size (including TIPC header)
*
* Returns a new buffer with data pointers set to the specified size.
Expand All @@ -111,7 +111,7 @@ int tipc_get_mode(void)
* There may also be unrequested tailroom present at the buffer's end.
*/

struct sk_buff *buf_acquire(u32 size)
struct sk_buff *tipc_buf_acquire(u32 size)
{
struct sk_buff *skb;
unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
Expand All @@ -129,7 +129,7 @@ struct sk_buff *buf_acquire(u32 size)
* tipc_core_stop_net - shut down TIPC networking sub-systems
*/

void tipc_core_stop_net(void)
static void tipc_core_stop_net(void)
{
tipc_eth_media_stop();
tipc_net_stop();
Expand All @@ -154,7 +154,7 @@ int tipc_core_start_net(unsigned long addr)
* tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
*/

void tipc_core_stop(void)
static void tipc_core_stop(void)
{
if (tipc_mode != TIPC_NODE_MODE)
return;
Expand All @@ -176,7 +176,7 @@ void tipc_core_stop(void)
* tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
*/

int tipc_core_start(void)
static int tipc_core_start(void)
{
int res;

Expand Down Expand Up @@ -246,7 +246,6 @@ MODULE_VERSION(TIPC_MOD_VER);

EXPORT_SYMBOL(tipc_attach);
EXPORT_SYMBOL(tipc_detach);
EXPORT_SYMBOL(tipc_get_addr);
EXPORT_SYMBOL(tipc_get_mode);
EXPORT_SYMBOL(tipc_createport);
EXPORT_SYMBOL(tipc_deleteport);
Expand All @@ -262,23 +261,10 @@ EXPORT_SYMBOL(tipc_withdraw);
EXPORT_SYMBOL(tipc_connect2port);
EXPORT_SYMBOL(tipc_disconnect);
EXPORT_SYMBOL(tipc_shutdown);
EXPORT_SYMBOL(tipc_isconnected);
EXPORT_SYMBOL(tipc_peer);
EXPORT_SYMBOL(tipc_ref_valid);
EXPORT_SYMBOL(tipc_send);
EXPORT_SYMBOL(tipc_send_buf);
EXPORT_SYMBOL(tipc_send2name);
EXPORT_SYMBOL(tipc_forward2name);
EXPORT_SYMBOL(tipc_send_buf2name);
EXPORT_SYMBOL(tipc_forward_buf2name);
EXPORT_SYMBOL(tipc_send2port);
EXPORT_SYMBOL(tipc_forward2port);
EXPORT_SYMBOL(tipc_send_buf2port);
EXPORT_SYMBOL(tipc_forward_buf2port);
EXPORT_SYMBOL(tipc_multicast);
/* EXPORT_SYMBOL(tipc_multicast_buf); not available yet */
EXPORT_SYMBOL(tipc_ispublished);
EXPORT_SYMBOL(tipc_available_nodes);

/* TIPC API for external bearers (see tipc_bearer.h) */

Expand All @@ -295,6 +281,4 @@ EXPORT_SYMBOL(tipc_createport_raw);
EXPORT_SYMBOL(tipc_reject_msg);
EXPORT_SYMBOL(tipc_send_buf_fast);
EXPORT_SYMBOL(tipc_acknowledge);
EXPORT_SYMBOL(tipc_get_port);
EXPORT_SYMBOL(tipc_get_handle);

9 changes: 2 additions & 7 deletions net/tipc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@
* Note: TIPC_LOG is configured to echo its output to the system console;
* user-defined buffers can be configured to do the same thing.
*/

extern struct print_buf *const TIPC_NULL;
extern struct print_buf *const TIPC_CONS;
extern struct print_buf *const TIPC_LOG;

void tipc_printf(struct print_buf *, const char *fmt, ...);
Expand Down Expand Up @@ -204,10 +202,7 @@ extern atomic_t tipc_user_count;
* Routines available to privileged subsystems
*/

extern int tipc_core_start(void);
extern void tipc_core_stop(void);
extern int tipc_core_start_net(unsigned long addr);
extern void tipc_core_stop_net(void);
extern int tipc_core_start_net(unsigned long);
extern int tipc_handler_start(void);
extern void tipc_handler_stop(void);
extern int tipc_netlink_start(void);
Expand Down Expand Up @@ -328,7 +323,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
return (struct tipc_msg *)skb->data;
}

extern struct sk_buff *buf_acquire(u32 size);
extern struct sk_buff *tipc_buf_acquire(u32 size);

/**
* buf_discard - frees a TIPC message buffer
Expand Down
Loading

0 comments on commit 31e3c3f

Please sign in to comment.