Skip to content

Commit 7368ddf

Browse files
Paul Gortmakerdavem330
authored andcommitted
tipc: clean out all instances of #if 0'd unused code
Remove all instances of legacy, or as yet to be implemented code that is currently living within an #if 0 ... #endif block. In the rare instance that some of it be needed in the future, it can still be dragged out of history, but there is no need for it to sit in mainline. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9fbb711 commit 7368ddf

9 files changed

Lines changed: 1 addition & 375 deletions

File tree

‎net/tipc/config.c‎

Lines changed: 0 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -120,139 +120,6 @@ struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
120120
return buf;
121121
}
122122

123-
124-
#if 0
125-
126-
/* Now obsolete code for handling commands not yet implemented the new way */
127-
128-
/*
129-
* Some of this code assumed that the manager structure contains two added
130-
* fields:
131-
* u32 link_subscriptions;
132-
* struct list_head link_subscribers;
133-
* which are currently not present. These fields may need to be re-introduced
134-
* if and when support for link subscriptions is added.
135-
*/
136-
137-
void tipc_cfg_link_event(u32 addr, char *name, int up)
138-
{
139-
/* TIPC DOESN'T HANDLE LINK EVENT SUBSCRIPTIONS AT THE MOMENT */
140-
}
141-
142-
int tipc_cfg_cmd(const struct tipc_cmd_msg * msg,
143-
char *data,
144-
u32 sz,
145-
u32 *ret_size,
146-
struct tipc_portid *orig)
147-
{
148-
int rv = -EINVAL;
149-
u32 cmd = msg->cmd;
150-
151-
*ret_size = 0;
152-
switch (cmd) {
153-
case TIPC_REMOVE_LINK:
154-
case TIPC_CMD_BLOCK_LINK:
155-
case TIPC_CMD_UNBLOCK_LINK:
156-
if (!cfg_check_connection(orig))
157-
rv = link_control(msg->argv.link_name, msg->cmd, 0);
158-
break;
159-
case TIPC_ESTABLISH:
160-
{
161-
int connected;
162-
163-
tipc_isconnected(mng.conn_port_ref, &connected);
164-
if (connected || !orig) {
165-
rv = TIPC_FAILURE;
166-
break;
167-
}
168-
rv = tipc_connect2port(mng.conn_port_ref, orig);
169-
if (rv == TIPC_OK)
170-
orig = 0;
171-
break;
172-
}
173-
case TIPC_GET_PEER_ADDRESS:
174-
*ret_size = link_peer_addr(msg->argv.link_name, data, sz);
175-
break;
176-
case TIPC_GET_ROUTES:
177-
rv = TIPC_OK;
178-
break;
179-
default: {}
180-
}
181-
if (*ret_size)
182-
rv = TIPC_OK;
183-
return rv;
184-
}
185-
186-
static void cfg_cmd_event(struct tipc_cmd_msg *msg,
187-
char *data,
188-
u32 sz,
189-
struct tipc_portid const *orig)
190-
{
191-
int rv = -EINVAL;
192-
struct tipc_cmd_result_msg rmsg;
193-
struct iovec msg_sect[2];
194-
int *arg;
195-
196-
msg->cmd = ntohl(msg->cmd);
197-
198-
cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect,
199-
data, 0);
200-
if (ntohl(msg->magic) != TIPC_MAGIC)
201-
goto exit;
202-
203-
switch (msg->cmd) {
204-
case TIPC_CREATE_LINK:
205-
if (!cfg_check_connection(orig))
206-
rv = disc_create_link(&msg->argv.create_link);
207-
break;
208-
case TIPC_LINK_SUBSCRIBE:
209-
{
210-
struct subscr_data *sub;
211-
212-
if (mng.link_subscriptions > 64)
213-
break;
214-
sub = kmalloc(sizeof(*sub),
215-
GFP_ATOMIC);
216-
if (sub == NULL) {
217-
warn("Memory squeeze; dropped remote link subscription\n");
218-
break;
219-
}
220-
INIT_LIST_HEAD(&sub->subd_list);
221-
tipc_createport(mng.user_ref,
222-
(void *)sub,
223-
TIPC_HIGH_IMPORTANCE,
224-
0,
225-
0,
226-
(tipc_conn_shutdown_event)cfg_linksubscr_cancel,
227-
0,
228-
0,
229-
(tipc_conn_msg_event)cfg_linksubscr_cancel,
230-
0,
231-
&sub->port_ref);
232-
if (!sub->port_ref) {
233-
kfree(sub);
234-
break;
235-
}
236-
memcpy(sub->usr_handle,msg->usr_handle,
237-
sizeof(sub->usr_handle));
238-
sub->domain = msg->argv.domain;
239-
list_add_tail(&sub->subd_list, &mng.link_subscribers);
240-
tipc_connect2port(sub->port_ref, orig);
241-
rmsg.retval = TIPC_OK;
242-
tipc_send(sub->port_ref, 2u, msg_sect);
243-
mng.link_subscriptions++;
244-
return;
245-
}
246-
default:
247-
rv = tipc_cfg_cmd(msg, data, sz, (u32 *)&msg_sect[1].iov_len, orig);
248-
}
249-
exit:
250-
rmsg.result_len = htonl(msg_sect[1].iov_len);
251-
rmsg.retval = htonl(rv);
252-
tipc_cfg_respond(msg_sect, 2u, orig);
253-
}
254-
#endif
255-
256123
#define MAX_STATS_INFO 2000
257124

258125
static struct sk_buff *tipc_show_stats(void)
@@ -557,14 +424,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
557424
case TIPC_CMD_SHOW_PORTS:
558425
rep_tlv_buf = tipc_port_get_ports();
559426
break;
560-
#if 0
561-
case TIPC_CMD_SHOW_PORT_STATS:
562-
rep_tlv_buf = port_show_stats(req_tlv_area, req_tlv_space);
563-
break;
564-
case TIPC_CMD_RESET_PORT_STATS:
565-
rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED);
566-
break;
567-
#endif
568427
case TIPC_CMD_SET_LOG_SIZE:
569428
rep_tlv_buf = tipc_log_resize_cmd(req_tlv_area, req_tlv_space);
570429
break;

‎net/tipc/discover.c‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@
4646
#define TIPC_LINK_REQ_FAST 2000 /* normal delay if bearer has no links */
4747
#define TIPC_LINK_REQ_SLOW 600000 /* normal delay if bearer has links */
4848

49-
#if 0
50-
#define GET_NODE_INFO 300
51-
#define GET_NODE_INFO_RESULT 301
52-
#define FORWARD_LINK_PROBE 302
53-
#define LINK_REQUEST_REJECTED 303
54-
#define LINK_REQUEST_ACCEPTED 304
55-
#define DROP_LINK_REQUEST 305
56-
#define CHECK_LINK_COUNT 306
57-
#endif
58-
5949
/*
6050
* TODO: Most of the inter-cluster setup stuff should be
6151
* rewritten, and be made conformant with specification.
@@ -79,16 +69,6 @@ struct link_req {
7969
};
8070

8171

82-
#if 0
83-
int disc_create_link(const struct tipc_link_create *argv)
84-
{
85-
/*
86-
* Code for inter cluster link setup here
87-
*/
88-
return TIPC_OK;
89-
}
90-
#endif
91-
9272
/*
9373
* disc_lost_link(): A link has lost contact
9474
*/

‎net/tipc/discover.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,5 @@ void tipc_disc_stop_link_req(struct link_req *req);
5151
void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr);
5252

5353
void tipc_disc_link_event(u32 addr, char *name, int up);
54-
#if 0
55-
int disc_create_link(const struct tipc_link_create *argv);
56-
#endif
5754

5855
#endif

‎net/tipc/link.c‎

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,6 @@ struct link_name {
9999
char if_peer[TIPC_MAX_IF_NAME];
100100
};
101101

102-
#if 0
103-
104-
/* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */
105-
106-
/**
107-
* struct link_event - link up/down event notification
108-
*/
109-
110-
struct link_event {
111-
u32 addr;
112-
int up;
113-
void (*fcn)(u32, char *, int);
114-
char name[TIPC_MAX_LINK_NAME];
115-
};
116-
117-
#endif
118-
119102
static void link_handle_out_of_seq_msg(struct link *l_ptr,
120103
struct sk_buff *buf);
121104
static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf);
@@ -634,39 +617,9 @@ void tipc_link_stop(struct link *l_ptr)
634617
l_ptr->proto_msg_queue = NULL;
635618
}
636619

637-
#if 0
638-
639620
/* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */
640-
641-
static void link_recv_event(struct link_event *ev)
642-
{
643-
ev->fcn(ev->addr, ev->name, ev->up);
644-
kfree(ev);
645-
}
646-
647-
static void link_send_event(void (*fcn)(u32 a, char *n, int up),
648-
struct link *l_ptr, int up)
649-
{
650-
struct link_event *ev;
651-
652-
ev = kmalloc(sizeof(*ev), GFP_ATOMIC);
653-
if (!ev) {
654-
warn("Link event allocation failure\n");
655-
return;
656-
}
657-
ev->addr = l_ptr->addr;
658-
ev->up = up;
659-
ev->fcn = fcn;
660-
memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME);
661-
tipc_k_signal((Handler)link_recv_event, (unsigned long)ev);
662-
}
663-
664-
#else
665-
666621
#define link_send_event(fcn, l_ptr, up) do { } while (0)
667622

668-
#endif
669-
670623
void tipc_link_reset(struct link *l_ptr)
671624
{
672625
struct sk_buff *buf;
@@ -690,10 +643,7 @@ void tipc_link_reset(struct link *l_ptr)
690643

691644
tipc_node_link_down(l_ptr->owner, l_ptr);
692645
tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr);
693-
#if 0
694-
tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name);
695-
dbg_link_dump();
696-
#endif
646+
697647
if (was_active_link && tipc_node_has_active_links(l_ptr->owner) &&
698648
l_ptr->owner->permit_changeover) {
699649
l_ptr->reset_checkpoint = checkpoint;
@@ -3197,44 +3147,6 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
31973147
return buf;
31983148
}
31993149

3200-
#if 0
3201-
int link_control(const char *name, u32 op, u32 val)
3202-
{
3203-
int res = -EINVAL;
3204-
struct link *l_ptr;
3205-
u32 bearer_id;
3206-
struct tipc_node * node;
3207-
u32 a;
3208-
3209-
a = link_name2addr(name, &bearer_id);
3210-
read_lock_bh(&tipc_net_lock);
3211-
node = tipc_node_find(a);
3212-
if (node) {
3213-
tipc_node_lock(node);
3214-
l_ptr = node->links[bearer_id];
3215-
if (l_ptr) {
3216-
if (op == TIPC_REMOVE_LINK) {
3217-
struct bearer *b_ptr = l_ptr->b_ptr;
3218-
spin_lock_bh(&b_ptr->publ.lock);
3219-
tipc_link_delete(l_ptr);
3220-
spin_unlock_bh(&b_ptr->publ.lock);
3221-
}
3222-
if (op == TIPC_CMD_BLOCK_LINK) {
3223-
tipc_link_reset(l_ptr);
3224-
l_ptr->blocked = 1;
3225-
}
3226-
if (op == TIPC_CMD_UNBLOCK_LINK) {
3227-
l_ptr->blocked = 0;
3228-
}
3229-
res = 0;
3230-
}
3231-
tipc_node_unlock(node);
3232-
}
3233-
read_unlock_bh(&tipc_net_lock);
3234-
return res;
3235-
}
3236-
#endif
3237-
32383150
/**
32393151
* tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
32403152
* @dest: network address of destination node
@@ -3265,28 +3177,6 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
32653177
return res;
32663178
}
32673179

3268-
#if 0
3269-
static void link_dump_rec_queue(struct link *l_ptr)
3270-
{
3271-
struct sk_buff *crs;
3272-
3273-
if (!l_ptr->oldest_deferred_in) {
3274-
info("Reception queue empty\n");
3275-
return;
3276-
}
3277-
info("Contents of Reception queue:\n");
3278-
crs = l_ptr->oldest_deferred_in;
3279-
while (crs) {
3280-
if (crs->data == (void *)0x0000a3a3) {
3281-
info("buffer %x invalid\n", crs);
3282-
return;
3283-
}
3284-
msg_dbg(buf_msg(crs), "In rec queue:\n");
3285-
crs = crs->next;
3286-
}
3287-
}
3288-
#endif
3289-
32903180
static void link_dump_send_queue(struct link *l_ptr)
32913181
{
32923182
if (l_ptr->next_out) {

‎net/tipc/link.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ struct link {
210210
u32 msg_length_counts;
211211
u32 msg_lengths_total;
212212
u32 msg_length_profile[7];
213-
#if 0
214-
u32 sent_tunneled;
215-
u32 recv_tunneled;
216-
#endif
217213
} stats;
218214

219215
struct print_buf print_buf;

‎net/tipc/name_table.c‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,16 +1009,6 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
10091009
}
10101010
}
10111011

1012-
#if 0
1013-
void tipc_nametbl_print(struct print_buf *buf, const char *str)
1014-
{
1015-
tipc_printf(buf, str);
1016-
read_lock_bh(&tipc_nametbl_lock);
1017-
nametbl_list(buf, 0, 0, 0, 0);
1018-
read_unlock_bh(&tipc_nametbl_lock);
1019-
}
1020-
#endif
1021-
10221012
#define MAX_NAME_TBL_QUERY 32768
10231013

10241014
struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
@@ -1051,13 +1041,6 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
10511041
return buf;
10521042
}
10531043

1054-
#if 0
1055-
void tipc_nametbl_dump(void)
1056-
{
1057-
nametbl_list(TIPC_CONS, 0, 0, 0, 0);
1058-
}
1059-
#endif
1060-
10611044
int tipc_nametbl_init(void)
10621045
{
10631046
table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head),

0 commit comments

Comments
 (0)