Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 279087
b: refs/heads/master
c: a31abe8
h: refs/heads/master
i:
  279085: ed8e534
  279083: bc3f4aa
  279079: ac1e567
  279071: 405a4b2
v: v3
  • Loading branch information
Allan Stephens authored and Paul Gortmaker committed Dec 27, 2011
1 parent 0c46958 commit a947243
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c79be4549ae39edc026aa67eb64a25424542943f
refs/heads/master: a31abe8daee5dd618aecb1484dbe9bf68c5c8a4a
35 changes: 15 additions & 20 deletions trunk/net/tipc/bearer.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#define MAX_ADDR_STR 32

static struct media media_list[MAX_MEDIA];
static struct media *media_list[MAX_MEDIA];
static u32 media_count;

struct tipc_bearer tipc_bearers[MAX_BEARERS];
Expand Down Expand Up @@ -70,12 +70,11 @@ static int media_name_valid(const char *name)

static struct media *media_find(const char *name)
{
struct media *m_ptr;
u32 i;

for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
if (!strcmp(m_ptr->name, name))
return m_ptr;
for (i = 0; i < media_count; i++) {
if (!strcmp(media_list[i]->name, name))
return media_list[i];
}
return NULL;
}
Expand All @@ -89,8 +88,8 @@ static struct media *media_find_id(u8 type)
u32 i;

for (i = 0; i < media_count; i++) {
if (media_list[i].type_id == type)
return &media_list[i];
if (media_list[i]->type_id == type)
return media_list[i];
}
return NULL;
}
Expand Down Expand Up @@ -144,7 +143,7 @@ int tipc_register_media(struct media *m_ptr)
goto exit;
}

media_list[media_count] = *m_ptr;
media_list[media_count] = m_ptr;
media_count++;
res = 0;
exit:
Expand All @@ -163,12 +162,9 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
u32 i;

media_type = ntohl(a->type);
for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
if (m_ptr->type_id == media_type)
break;
}
m_ptr = media_find_id(media_type);

if ((i < media_count) && (m_ptr->addr2str != NULL)) {
if (m_ptr && (m_ptr->addr2str != NULL)) {
char addr_str[MAX_ADDR_STR];

tipc_printf(pb, "%s(%s)", m_ptr->name,
Expand All @@ -189,17 +185,17 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
struct sk_buff *tipc_media_get_names(void)
{
struct sk_buff *buf;
struct media *m_ptr;
int i;

buf = tipc_cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME));
if (!buf)
return NULL;

read_lock_bh(&tipc_net_lock);
for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name,
strlen(m_ptr->name) + 1);
for (i = 0; i < media_count; i++) {
tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME,
media_list[i]->name,
strlen(media_list[i]->name) + 1);
}
read_unlock_bh(&tipc_net_lock);
return buf;
Expand Down Expand Up @@ -300,7 +296,6 @@ struct tipc_bearer *tipc_bearer_find_interface(const char *if_name)
struct sk_buff *tipc_bearer_get_names(void)
{
struct sk_buff *buf;
struct media *m_ptr;
struct tipc_bearer *b_ptr;
int i, j;

Expand All @@ -309,10 +304,10 @@ struct sk_buff *tipc_bearer_get_names(void)
return NULL;

read_lock_bh(&tipc_net_lock);
for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
for (i = 0; i < media_count; i++) {
for (j = 0; j < MAX_BEARERS; j++) {
b_ptr = &tipc_bearers[j];
if (b_ptr->active && (b_ptr->media == m_ptr)) {
if (b_ptr->active && (b_ptr->media == media_list[i])) {
tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
b_ptr->name,
strlen(b_ptr->name) + 1);
Expand Down

0 comments on commit a947243

Please sign in to comment.