diff options
Diffstat (limited to 'net/tipc/bearer.c')
-rw-r--r-- | net/tipc/bearer.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 39744a33bd36..271a375b49b7 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/bearer.c: TIPC bearer code | 2 | * net/tipc/bearer.c: TIPC bearer code |
3 | * | 3 | * |
4 | * Copyright (c) 1996-2006, Ericsson AB | 4 | * Copyright (c) 1996-2006, Ericsson AB |
5 | * Copyright (c) 2004-2006, Wind River Systems | 5 | * Copyright (c) 2004-2006, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
@@ -52,7 +52,7 @@ struct bearer *tipc_bearers = NULL; | |||
52 | 52 | ||
53 | /** | 53 | /** |
54 | * media_name_valid - validate media name | 54 | * media_name_valid - validate media name |
55 | * | 55 | * |
56 | * Returns 1 if media name is valid, otherwise 0. | 56 | * Returns 1 if media name is valid, otherwise 0. |
57 | */ | 57 | */ |
58 | 58 | ||
@@ -84,17 +84,17 @@ static struct media *media_find(const char *name) | |||
84 | 84 | ||
85 | /** | 85 | /** |
86 | * tipc_register_media - register a media type | 86 | * tipc_register_media - register a media type |
87 | * | 87 | * |
88 | * Bearers for this media type must be activated separately at a later stage. | 88 | * Bearers for this media type must be activated separately at a later stage. |
89 | */ | 89 | */ |
90 | 90 | ||
91 | int tipc_register_media(u32 media_type, | 91 | int tipc_register_media(u32 media_type, |
92 | char *name, | 92 | char *name, |
93 | int (*enable)(struct tipc_bearer *), | 93 | int (*enable)(struct tipc_bearer *), |
94 | void (*disable)(struct tipc_bearer *), | 94 | void (*disable)(struct tipc_bearer *), |
95 | int (*send_msg)(struct sk_buff *, | 95 | int (*send_msg)(struct sk_buff *, |
96 | struct tipc_bearer *, | 96 | struct tipc_bearer *, |
97 | struct tipc_media_addr *), | 97 | struct tipc_media_addr *), |
98 | char *(*addr2str)(struct tipc_media_addr *a, | 98 | char *(*addr2str)(struct tipc_media_addr *a, |
99 | char *str_buf, int str_size), | 99 | char *str_buf, int str_size), |
100 | struct tipc_media_addr *bcast_addr, | 100 | struct tipc_media_addr *bcast_addr, |
@@ -121,11 +121,11 @@ int tipc_register_media(u32 media_type, | |||
121 | } | 121 | } |
122 | if ((bearer_priority < TIPC_MIN_LINK_PRI) && | 122 | if ((bearer_priority < TIPC_MIN_LINK_PRI) && |
123 | (bearer_priority > TIPC_MAX_LINK_PRI)) { | 123 | (bearer_priority > TIPC_MAX_LINK_PRI)) { |
124 | warn("Media <%s> rejected, illegal priority (%u)\n", name, | 124 | warn("Media <%s> rejected, illegal priority (%u)\n", name, |
125 | bearer_priority); | 125 | bearer_priority); |
126 | goto exit; | 126 | goto exit; |
127 | } | 127 | } |
128 | if ((link_tolerance < TIPC_MIN_LINK_TOL) || | 128 | if ((link_tolerance < TIPC_MIN_LINK_TOL) || |
129 | (link_tolerance > TIPC_MAX_LINK_TOL)) { | 129 | (link_tolerance > TIPC_MAX_LINK_TOL)) { |
130 | warn("Media <%s> rejected, illegal tolerance (%u)\n", name, | 130 | warn("Media <%s> rejected, illegal tolerance (%u)\n", name, |
131 | link_tolerance); | 131 | link_tolerance); |
@@ -219,7 +219,7 @@ struct sk_buff *tipc_media_get_names(void) | |||
219 | 219 | ||
220 | read_lock_bh(&tipc_net_lock); | 220 | read_lock_bh(&tipc_net_lock); |
221 | for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { | 221 | for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { |
222 | tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, | 222 | tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, |
223 | strlen(m_ptr->name) + 1); | 223 | strlen(m_ptr->name) + 1); |
224 | } | 224 | } |
225 | read_unlock_bh(&tipc_net_lock); | 225 | read_unlock_bh(&tipc_net_lock); |
@@ -230,11 +230,11 @@ struct sk_buff *tipc_media_get_names(void) | |||
230 | * bearer_name_validate - validate & (optionally) deconstruct bearer name | 230 | * bearer_name_validate - validate & (optionally) deconstruct bearer name |
231 | * @name - ptr to bearer name string | 231 | * @name - ptr to bearer name string |
232 | * @name_parts - ptr to area for bearer name components (or NULL if not needed) | 232 | * @name_parts - ptr to area for bearer name components (or NULL if not needed) |
233 | * | 233 | * |
234 | * Returns 1 if bearer name is valid, otherwise 0. | 234 | * Returns 1 if bearer name is valid, otherwise 0. |
235 | */ | 235 | */ |
236 | 236 | ||
237 | static int bearer_name_validate(const char *name, | 237 | static int bearer_name_validate(const char *name, |
238 | struct bearer_name *name_parts) | 238 | struct bearer_name *name_parts) |
239 | { | 239 | { |
240 | char name_copy[TIPC_MAX_BEARER_NAME]; | 240 | char name_copy[TIPC_MAX_BEARER_NAME]; |
@@ -262,8 +262,8 @@ static int bearer_name_validate(const char *name, | |||
262 | 262 | ||
263 | /* validate component parts of bearer name */ | 263 | /* validate component parts of bearer name */ |
264 | 264 | ||
265 | if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || | 265 | if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || |
266 | (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || | 266 | (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || |
267 | (strspn(media_name, tipc_alphabet) != (media_len - 1)) || | 267 | (strspn(media_name, tipc_alphabet) != (media_len - 1)) || |
268 | (strspn(if_name, tipc_alphabet) != (if_len - 1))) | 268 | (strspn(if_name, tipc_alphabet) != (if_len - 1))) |
269 | return 0; | 269 | return 0; |
@@ -336,8 +336,8 @@ struct sk_buff *tipc_bearer_get_names(void) | |||
336 | for (j = 0; j < MAX_BEARERS; j++) { | 336 | for (j = 0; j < MAX_BEARERS; j++) { |
337 | b_ptr = &tipc_bearers[j]; | 337 | b_ptr = &tipc_bearers[j]; |
338 | if (b_ptr->active && (b_ptr->media == m_ptr)) { | 338 | if (b_ptr->active && (b_ptr->media == m_ptr)) { |
339 | tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, | 339 | tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, |
340 | b_ptr->publ.name, | 340 | b_ptr->publ.name, |
341 | strlen(b_ptr->publ.name) + 1); | 341 | strlen(b_ptr->publ.name) + 1); |
342 | } | 342 | } |
343 | } | 343 | } |
@@ -401,8 +401,8 @@ void tipc_bearer_lock_push(struct bearer *b_ptr) | |||
401 | 401 | ||
402 | 402 | ||
403 | /* | 403 | /* |
404 | * Interrupt enabling new requests after bearer congestion or blocking: | 404 | * Interrupt enabling new requests after bearer congestion or blocking: |
405 | * See bearer_send(). | 405 | * See bearer_send(). |
406 | */ | 406 | */ |
407 | void tipc_continue(struct tipc_bearer *tb_ptr) | 407 | void tipc_continue(struct tipc_bearer *tb_ptr) |
408 | { | 408 | { |
@@ -417,9 +417,9 @@ void tipc_continue(struct tipc_bearer *tb_ptr) | |||
417 | } | 417 | } |
418 | 418 | ||
419 | /* | 419 | /* |
420 | * Schedule link for sending of messages after the bearer | 420 | * Schedule link for sending of messages after the bearer |
421 | * has been deblocked by 'continue()'. This method is called | 421 | * has been deblocked by 'continue()'. This method is called |
422 | * when somebody tries to send a message via this link while | 422 | * when somebody tries to send a message via this link while |
423 | * the bearer is congested. 'tipc_net_lock' is in read_lock here | 423 | * the bearer is congested. 'tipc_net_lock' is in read_lock here |
424 | * bearer.lock is busy | 424 | * bearer.lock is busy |
425 | */ | 425 | */ |
@@ -430,9 +430,9 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p | |||
430 | } | 430 | } |
431 | 431 | ||
432 | /* | 432 | /* |
433 | * Schedule link for sending of messages after the bearer | 433 | * Schedule link for sending of messages after the bearer |
434 | * has been deblocked by 'continue()'. This method is called | 434 | * has been deblocked by 'continue()'. This method is called |
435 | * when somebody tries to send a message via this link while | 435 | * when somebody tries to send a message via this link while |
436 | * the bearer is congested. 'tipc_net_lock' is in read_lock here, | 436 | * the bearer is congested. 'tipc_net_lock' is in read_lock here, |
437 | * bearer.lock is free | 437 | * bearer.lock is free |
438 | */ | 438 | */ |
@@ -468,7 +468,7 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) | |||
468 | 468 | ||
469 | /** | 469 | /** |
470 | * tipc_enable_bearer - enable bearer with the given name | 470 | * tipc_enable_bearer - enable bearer with the given name |
471 | */ | 471 | */ |
472 | 472 | ||
473 | int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) | 473 | int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) |
474 | { | 474 | { |
@@ -490,7 +490,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) | |||
490 | warn("Bearer <%s> rejected, illegal name\n", name); | 490 | warn("Bearer <%s> rejected, illegal name\n", name); |
491 | return -EINVAL; | 491 | return -EINVAL; |
492 | } | 492 | } |
493 | if (!tipc_addr_domain_valid(bcast_scope) || | 493 | if (!tipc_addr_domain_valid(bcast_scope) || |
494 | !in_scope(bcast_scope, tipc_own_addr)) { | 494 | !in_scope(bcast_scope, tipc_own_addr)) { |
495 | warn("Bearer <%s> rejected, illegal broadcast scope\n", name); | 495 | warn("Bearer <%s> rejected, illegal broadcast scope\n", name); |
496 | return -EINVAL; | 496 | return -EINVAL; |
@@ -539,7 +539,7 @@ restart: | |||
539 | } | 539 | } |
540 | } | 540 | } |
541 | if (bearer_id >= MAX_BEARERS) { | 541 | if (bearer_id >= MAX_BEARERS) { |
542 | warn("Bearer <%s> rejected, bearer limit reached (%u)\n", | 542 | warn("Bearer <%s> rejected, bearer limit reached (%u)\n", |
543 | name, MAX_BEARERS); | 543 | name, MAX_BEARERS); |
544 | goto failed; | 544 | goto failed; |
545 | } | 545 | } |
@@ -612,7 +612,7 @@ int tipc_block_bearer(const char *name) | |||
612 | 612 | ||
613 | /** | 613 | /** |
614 | * bearer_disable - | 614 | * bearer_disable - |
615 | * | 615 | * |
616 | * Note: This routine assumes caller holds tipc_net_lock. | 616 | * Note: This routine assumes caller holds tipc_net_lock. |
617 | */ | 617 | */ |
618 | 618 | ||