From: Jon M. <jon...@er...> - 2004-05-06 21:17:05
|
It looks ok, just go ahead and check it in. Un unrelated issue, which I hope you or somebody else on the list can answer: The TIPC code is currently distributed under a dual BSD/GPL licence, but the disclaimer we keep in the code is the BSD one. I had a short glance into other dual-licence modules in the kernel, and see that they also keep the BSD disclaimer, but they have added an extra clause: "ALTERNATIVELY, provided that this notice is retained in full, this product may be distributed under the terms of the GNU General Public License (GPL), in which case the provisions of the GPL apply INSTEAD OF those given above." So, which one is valid? Is it right to think that the code is distributed with GPL when it goes with the Linux kernel, and with BSD when downloaded from SourceForge? Must the latter case be stated explicitly in some way ? Regards /jon Mark Haverkamp wrote: Jon, Here are more conversions to list_head macros. I think that there are just a few more to go. Mark. cvs diff -u name_distr.c port.h name_table.c name_table.h port.c Index: name_distr.c =================================================================== RCS file: /cvsroot/tipc/source/unstable/net/tipc/name_distr.c,v retrieving revision 1.7 diff -u -r1.7 name_distr.c --- name_distr.c 5 May 2004 15:41:28 -0000 1.7 +++ name_distr.c 6 May 2004 20:11:32 -0000 @@ -159,7 +159,6 @@ { struct sk_buff* buf = named_prepare_buf(WITHDRAWAL,ITEM_SIZE,0); struct distr_item *item = (struct distr_item*) msg_data(buf_msg(buf)); - list_del_init(&publ->local_list); publ_cnt--; publ_to_item(item,publ); cluster_broadcast(buf); Index: port.h =================================================================== RCS file: /cvsroot/tipc/source/unstable/net/tipc/port.h,v retrieving revision 1.8 diff -u -r1.8 port.h --- port.h 5 May 2004 15:41:28 -0000 1.8 +++ port.h 6 May 2004 20:11:32 -0000 @@ -152,7 +152,7 @@ uint waiting_pkts; uint sent; uint acked; - struct publication *publications; + struct list_head publications; uint max_pkt; /* hint */ uint probing_state; uint last_in_seqno; Index: name_table.c =================================================================== RCS file: /cvsroot/tipc/source/unstable/net/tipc/name_table.c,v retrieving revision 1.16 diff -u -r1.16 name_table.c --- name_table.c 5 May 2004 19:09:03 -0000 1.16 +++ name_table.c 6 May 2004 20:11:32 -0000 @@ -162,6 +162,8 @@ this->node = node; this->scope = scope; this->key = key; + INIT_LIST_HEAD(&this->local_list); + INIT_LIST_HEAD(&this->pport_list); if (node != tipc_own_addr) { nodesub_subscribe(&this->subscr, node, this, (net_ev_handler) publ_handle_node_down); @@ -888,6 +890,8 @@ if (publ->scope != TIPC_NODE_SCOPE) named_withdraw(publ); write_unlock_bh(&nametbl_lock); + list_del_init(&publ->local_list); + list_del_init(&publ->pport_list); kfree(publ); return 1; } Index: name_table.h =================================================================== RCS file: /cvsroot/tipc/source/unstable/net/tipc/name_table.h,v retrieving revision 1.3 diff -u -r1.3 name_table.h --- name_table.h 5 May 2004 15:41:28 -0000 1.3 +++ name_table.h 6 May 2004 20:11:32 -0000 @@ -86,9 +86,7 @@ uint key; uint scope; struct list_head local_list; - struct { - struct publication *next; - }port_list; + struct list_head pport_list; struct { struct publication *next; }node_list; Index: port.c =================================================================== RCS file: /cvsroot/tipc/source/unstable/net/tipc/port.c,v retrieving revision 1.17 diff -u -r1.17 port.c --- port.c 5 May 2004 15:41:28 -0000 1.17 +++ port.c 6 May 2004 20:11:33 -0000 @@ -305,6 +305,7 @@ this->wakeup = wakeup; this->user_port = 0; spin_lock_bh(&port_lock); + INIT_LIST_HEAD(&this->publications); INIT_LIST_HEAD(&this->port_list); list_add_tail(&this->port_list, &ports); spin_unlock_bh(&port_lock); @@ -637,9 +638,10 @@ void port_print(struct port * this, struct print_buf * buf, const char *str) { - struct publication *publ = this->publications; + struct publication *publ; tipc_printf(buf, str); tipc_printf(buf, "Port: %u \n",this->publ.ref); + if (this->publ.connected) { uint dport = port_peerport(this); uint destnode = port_peernode(this); @@ -647,10 +649,10 @@ tipc_zone(destnode), tipc_cluster(destnode), tipc_node(destnode), dport); } - while (publ) { + + list_for_each_entry(publ, &this->publications, pport_list) { tipc_printf(buf, " bound to: <%u,%u,%u>\n", publ->type, publ->lower, publ->upper); - publ = publ->port_list.next; } } @@ -1001,10 +1003,9 @@ p = nametbl_publish(seq->type, seq->lower,seq->upper, this->publ.ref,scope); - if (p){ + if (p) { res = TIPC_OK; - p->port_list.next = this->publications; - this->publications = p; + list_add(&p->pport_list, &this->publications); this->publ.published = 1; } exit: @@ -1029,40 +1030,29 @@ tipc_withdraw(tipc_ref_t ref,struct tipc_name_seq const * seq) { struct port* this = port_lock_deref(ref); - struct publication *publ; - struct publication *prev = 0; + struct publication *publ, *tpub; uint key = 0; int res = TIPC_FAILURE; if (!this) - return TIPC_FAILURE; + return res; if (!this->publ.published) goto exit; - publ = this->publications; - if (!seq){ - while (this->publications) { - struct publication *next = - this->publications->port_list.next; - nametbl_withdraw(this->publications->type, - this->publications->lower, - this->publications->key); - this->publications = next; - } - this->publ.published = 0; - }else { - while (publ && (publ->lower != seq->lower)){ - prev = publ; - publ = publ->port_list.next; + if (!seq) { + list_for_each_entry_safe(publ, tpub, + &this->publications, pport_list) { + nametbl_withdraw(publ->type, publ->lower, publ->key); } - if (!publ) - goto exit; - key = publ->key; - if (prev) - prev->port_list.next = publ->port_list.next; - else - this->publications = publ->port_list.next; - nametbl_withdraw(seq->type,seq->lower,key); + } else { + list_for_each_entry_safe(publ, tpub, + &this->publications, pport_list) { + if (publ->lower != seq->lower) + continue; + key = publ->key; + nametbl_withdraw(seq->type, seq->lower, key); + res = TIPC_OK; + goto exit; + } } - res = TIPC_OK; exit: spin_unlock_bh(this->publ.lock); return res; |