You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(9) |
Feb
(11) |
Mar
(22) |
Apr
(73) |
May
(78) |
Jun
(146) |
Jul
(80) |
Aug
(27) |
Sep
(5) |
Oct
(14) |
Nov
(18) |
Dec
(27) |
| 2005 |
Jan
(20) |
Feb
(30) |
Mar
(19) |
Apr
(28) |
May
(50) |
Jun
(31) |
Jul
(32) |
Aug
(14) |
Sep
(36) |
Oct
(43) |
Nov
(74) |
Dec
(63) |
| 2006 |
Jan
(34) |
Feb
(32) |
Mar
(21) |
Apr
(76) |
May
(106) |
Jun
(72) |
Jul
(70) |
Aug
(175) |
Sep
(130) |
Oct
(39) |
Nov
(81) |
Dec
(43) |
| 2007 |
Jan
(81) |
Feb
(36) |
Mar
(20) |
Apr
(43) |
May
(54) |
Jun
(34) |
Jul
(44) |
Aug
(55) |
Sep
(44) |
Oct
(54) |
Nov
(43) |
Dec
(41) |
| 2008 |
Jan
(42) |
Feb
(84) |
Mar
(73) |
Apr
(30) |
May
(119) |
Jun
(54) |
Jul
(54) |
Aug
(93) |
Sep
(173) |
Oct
(130) |
Nov
(145) |
Dec
(153) |
| 2009 |
Jan
(59) |
Feb
(12) |
Mar
(28) |
Apr
(18) |
May
(56) |
Jun
(9) |
Jul
(28) |
Aug
(62) |
Sep
(16) |
Oct
(19) |
Nov
(15) |
Dec
(17) |
| 2010 |
Jan
(14) |
Feb
(36) |
Mar
(37) |
Apr
(30) |
May
(33) |
Jun
(53) |
Jul
(42) |
Aug
(50) |
Sep
(67) |
Oct
(66) |
Nov
(69) |
Dec
(36) |
| 2011 |
Jan
(52) |
Feb
(45) |
Mar
(49) |
Apr
(21) |
May
(34) |
Jun
(13) |
Jul
(19) |
Aug
(37) |
Sep
(43) |
Oct
(10) |
Nov
(23) |
Dec
(30) |
| 2012 |
Jan
(42) |
Feb
(36) |
Mar
(46) |
Apr
(25) |
May
(96) |
Jun
(146) |
Jul
(40) |
Aug
(28) |
Sep
(61) |
Oct
(45) |
Nov
(100) |
Dec
(53) |
| 2013 |
Jan
(79) |
Feb
(24) |
Mar
(134) |
Apr
(156) |
May
(118) |
Jun
(75) |
Jul
(278) |
Aug
(145) |
Sep
(136) |
Oct
(168) |
Nov
(137) |
Dec
(439) |
| 2014 |
Jan
(284) |
Feb
(158) |
Mar
(231) |
Apr
(275) |
May
(259) |
Jun
(91) |
Jul
(222) |
Aug
(215) |
Sep
(165) |
Oct
(166) |
Nov
(211) |
Dec
(150) |
| 2015 |
Jan
(164) |
Feb
(324) |
Mar
(299) |
Apr
(214) |
May
(111) |
Jun
(109) |
Jul
(105) |
Aug
(36) |
Sep
(58) |
Oct
(131) |
Nov
(68) |
Dec
(30) |
| 2016 |
Jan
(46) |
Feb
(87) |
Mar
(135) |
Apr
(174) |
May
(132) |
Jun
(135) |
Jul
(149) |
Aug
(125) |
Sep
(79) |
Oct
(49) |
Nov
(95) |
Dec
(102) |
| 2017 |
Jan
(104) |
Feb
(75) |
Mar
(72) |
Apr
(53) |
May
(18) |
Jun
(5) |
Jul
(14) |
Aug
(19) |
Sep
(2) |
Oct
(13) |
Nov
(21) |
Dec
(67) |
| 2018 |
Jan
(56) |
Feb
(50) |
Mar
(148) |
Apr
(41) |
May
(37) |
Jun
(34) |
Jul
(34) |
Aug
(11) |
Sep
(52) |
Oct
(48) |
Nov
(28) |
Dec
(46) |
| 2019 |
Jan
(29) |
Feb
(63) |
Mar
(95) |
Apr
(54) |
May
(14) |
Jun
(71) |
Jul
(60) |
Aug
(49) |
Sep
(3) |
Oct
(64) |
Nov
(115) |
Dec
(57) |
| 2020 |
Jan
(15) |
Feb
(9) |
Mar
(38) |
Apr
(27) |
May
(60) |
Jun
(53) |
Jul
(35) |
Aug
(46) |
Sep
(37) |
Oct
(64) |
Nov
(20) |
Dec
(25) |
| 2021 |
Jan
(20) |
Feb
(31) |
Mar
(27) |
Apr
(23) |
May
(21) |
Jun
(30) |
Jul
(30) |
Aug
(7) |
Sep
(18) |
Oct
|
Nov
(15) |
Dec
(4) |
| 2022 |
Jan
(3) |
Feb
(1) |
Mar
(10) |
Apr
|
May
(2) |
Jun
(26) |
Jul
(5) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(9) |
Dec
(2) |
| 2023 |
Jan
(4) |
Feb
(4) |
Mar
(5) |
Apr
(10) |
May
(29) |
Jun
(17) |
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
|
| 2024 |
Jan
|
Feb
(6) |
Mar
|
Apr
(1) |
May
(6) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jon M. <jon...@er...> - 2004-01-23 17:01:46
|
Not as far as I know. If you are planning anything like that, I think you should wait until we habe the 1.3.x release stable. /Jon Mario Andjelic (AL/EAB) wrote: >Hi, > >Did anybody ported TIPC to Win, or is planning to do that? > >/Mario > > >------------------------------------------------------- >The SF.Net email is sponsored by EclipseCon 2004 >Premiere Conference on Open Tools Development and Integration >See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. >http://www.eclipsecon.org/osdn >_______________________________________________ >TIPC-discussion mailing list >TIP...@li... >https://lists.sourceforge.net/lists/listinfo/tipc-discussion > > |
|
From: Mario A. (AL/EAB) <mar...@er...> - 2004-01-23 16:17:39
|
Hi, Did anybody ported TIPC to Win, or is planning to do that? /Mario |
|
From: Jon M. <jon...@er...> - 2004-01-16 19:46:30
|
Good!
I will use this.
I was thinking about something else: The timer/signal item list in
"handler.c"
is a huge static area now, wasting memory and making the module
look unecessary big. Since this function is not particularly time critical
we could just as well allocate the individual items dynamically, when
needed.
It would be even better if it were possible to map the timer/signal handling
directly to the Linux native dito, hence avoiding any items at all.
Something that you could look into, in parallel with what I am doing ?
I am working on the code again now, so expect things to move the next weeks.
/Jon
Guo, Min wrote:
>Hi,jon
>
> With the below patch,the module can be inserted/removed correctly,but tipc_printf still has some problems.
>Thanks
>Guo Min
>
>Index: buf.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/buf.c,v
>retrieving revision 1.3
>diff -u -r1.3 buf.c
>--- buf.c 4 Dec 2003 02:22:20 -0000 1.3
>+++ buf.c 16 Jan 2004 08:59:14 -0000
>@@ -85,16 +85,16 @@
> UB(crs)->pool = pool;
> buf_set_next(crs,0);
> if (pool){
>- spin_lock_bh(buf_lock);
>+ spin_lock_bh(&buf_lock);
> buf_set_next(crs,*pool);
> *pool = crs;
>- spin_unlock_bh(buf_lock);
>+ spin_unlock_bh(&buf_lock);
> }
> }
> if (pool){
>- spin_lock_bh(buf_lock);
>+ spin_lock_bh(&buf_lock);
> *pool = buf_next(crs);
>- spin_unlock_bh(buf_lock);
>+ spin_unlock_bh(&buf_lock);
> }
> buf_set_next(crs, 0);
> return crs;
>Index: dbg.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/dbg.c,v
>retrieving revision 1.1
>diff -u -r1.1 dbg.c
>--- dbg.c 4 Dec 2003 02:22:20 -0000 1.1
>+++ dbg.c 16 Jan 2004 08:59:15 -0000
>@@ -135,6 +135,7 @@
> spin_lock_bh(&print_lock);
> if (b->tee[0]) {
> err("Init on TEE buffer\n");
>+ spin_unlock_bh(&print_lock);
> return;
> }
> memset(raw, 0, sz);
>@@ -161,7 +162,7 @@
> if (buf->tee[0]) {
> targets[0] = buf->tee[0];
> targets[1] = buf->tee[1];
>- kfree(buf);
>+ //kfree(buf);
> } else {
> targets[0] = buf;
> targets[1] = 0;
>@@ -171,16 +172,22 @@
> struct print_buf *b = targets[i++];
> if (!b)
> continue;
>- assert(!b->tee[0]);
>+ if (!b->tee[0])
>+ {
>+ spin_unlock_bh(&print_lock);
>+ return;
>+ }
> if ((b->size - (b->crs - b->buf)) < MAX_STRING)
> b->crs = b->buf;
> FORMAT(b->crs, len, fmt);
> if (((b->crs + len) - b->buf) > b->size) {
> assert(!"Overstepped print/log buffer!!!\n");
> }
>- if (b == CONS)
>+ if ((b == CONS) && ( b->crs))
> printk(b->crs);
>- b->crs += len;
>+ if (b->crs)
>+ b->crs += len;
>+
> }
> spin_unlock_bh(&print_lock);
> }
>@@ -218,7 +225,7 @@
> if (buf->tee[0]) {
> targets[0] = buf->tee[0];
> targets[1] = buf->tee[1];
>- kfree(buf);
>+ //kfree(buf);
> } else {
> targets[0] = buf;
> targets[1] = 0;
>
>
>Index: handler.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/handler.c,v
>retrieving revision 1.4
>diff -u -r1.4 handler.c
>--- handler.c 4 Dec 2003 02:22:20 -0000 1.4
>+++ handler.c 16 Jan 2004 08:59:16 -0000
>@@ -187,6 +187,7 @@
> struct queue_item *item;
>
> spin_lock_bh(&qitem_lock);
>+
> item = (struct queue_item *) __get_queue_item();
> item->handler = routine;
> item->data = eventInfo;
>@@ -197,8 +198,10 @@
> signal_queue_head = item;
> }
> signal_queue_tail = item;
>+
> spin_unlock_bh(&qitem_lock);
>- tasklet_schedule(&tipc_tasklet);
>+
>+ //tasklet_schedule(&tipc_tasklet);
> return 0;
> }
>
>@@ -280,6 +283,8 @@
> }
> }
> spin_unlock_bh(&qitem_lock);
>+
>+ buf_stop();
> }
>
> uint
>Index: link.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/link.c,v
>retrieving revision 1.2
>diff -u -r1.2 link.c
>--- link.c 11 Dec 2003 19:44:47 -0000 1.2
>+++ link.c 16 Jan 2004 08:59:18 -0000
>@@ -1406,19 +1406,19 @@
> head = link_insert_deferred_queue(this,head);
> if (likely(msg_is_dest(msg,tipc_own_addr))){
> if (likely(msg_isdata(msg))) {
>- spin_unlock_bh(this->owner->lock);
>+ spin_unlock_bh(&this->owner->lock);
> port_recv_msg(buf);
> continue;
> }
> link_recv_non_data_msg(this, buf);
> continue;
> }
>- spin_unlock_bh(this->owner->lock);
>+ spin_unlock_bh(&this->owner->lock);
> net_route_msg(buf);
> continue;
> }
> link_handle_non_seq_msg(this, buf);
>- spin_unlock_bh(this->owner->lock);
>+ spin_unlock_bh(&this->owner->lock);
> continue;
> }
>
>@@ -1431,7 +1431,7 @@
> else
> buf_discard(buf);
>
>- spin_unlock_bh(this->owner->lock);
>+ spin_unlock_bh(&this->owner->lock);
> continue;
> }
> }
>Index: link.h
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/link.h,v
>retrieving revision 1.1
>diff -u -r1.1 link.h
>--- link.h 4 Dec 2003 02:22:20 -0000 1.1
>+++ link.h 16 Jan 2004 08:59:19 -0000
>@@ -270,11 +270,11 @@
> struct node *node = node_find(addr);
> if (likely(node)){
> struct link* l;
>- spin_lock_bh(node->lock);
>+ spin_lock_bh(&node->lock);
> l = node->links[bearer_id];
> if (likely(l))
> return l;
>- spin_unlock_bh(node->lock);
>+ spin_unlock_bh(&node->lock);
> }
> return 0;
> }
>Index: media.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/media.c,v
>retrieving revision 1.1
>diff -u -r1.1 media.c
>--- media.c 4 Dec 2003 02:22:20 -0000 1.1
>+++ media.c 16 Jan 2004 08:59:19 -0000
>@@ -376,16 +376,18 @@
> struct media *media = &media_list[0];
> struct print_buf buf;
> printbuf_init(&buf,raw,sz);
> while (media->active) {
> uint i;
> for (i = 0; i < MAX_BEARERS; i++) {
> struct bearer *b = &bearers[i];
> if (b->active && (b->media == media)) {
>- tipc_printf(&buf, "%s\n", b->publ.name);
>+ // tipc_printf(&buf, "%s\n", b->publ.name);
> }
> }
> media++;
> }
>+
> return TIPC_OK;
> }
>
>Index: port.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/port.c,v
>retrieving revision 1.1
>diff -u -r1.1 port.c
>--- port.c 4 Dec 2003 02:22:20 -0000 1.1
>+++ port.c 16 Jan 2004 08:59:20 -0000
>@@ -751,13 +751,13 @@
> port_dispatcher_sigh(buf);
> return 1;
> }
>- spin_lock_bh(queue_lock);
>+ spin_lock_bh(&queue_lock);
> if (msg_queue_head)
> buf_set_next(msg_queue_tail, buf);
> else
> msg_queue_head = buf;
> msg_queue_tail = buf;
>- spin_lock_bh(queue_lock);
>+ spin_lock_bh(&queue_lock);
> k_signal((Handler)port_dispatcher_sigh, 0);
> return 1;
> }
>@@ -1272,10 +1272,10 @@
> {
> struct port* p = ports;
> struct sk_buff* b;
>- spin_lock_bh(queue_lock);
>+ spin_lock_bh(&queue_lock);
> b = msg_queue_head;
> msg_queue_head = 0;
>- spin_unlock_bh(queue_lock);
>+ spin_unlock_bh(&queue_lock);
> while (b) {
> struct sk_buff *next = buf_next(b);
> buf_discard(b);
>Index: reg.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/reg.c,v
>retrieving revision 1.1
>diff -u -r1.1 reg.c
>--- reg.c 4 Dec 2003 02:22:20 -0000 1.1
>+++ reg.c 16 Jan 2004 08:59:21 -0000
>@@ -92,7 +92,7 @@
> uint sz = 1 << 4;
> while (sz < requested_size)
> sz <<= 1;
>- write_lock(ref_lock);
>+ write_lock(&ref_lock);
> table = (struct reference *) k_malloc(sizeof (struct reference) * sz);
> table[0].object = 0;
> table[0].data.reference = ~0u;
>@@ -106,7 +106,7 @@
> ref_table.entries = table;
> ref_table.first_free = 1;
> ref_table.last_free = sz - 1;
>- write_unlock(ref_lock);
>+ write_unlock(&ref_lock);
> }
>
> uint
>@@ -136,7 +136,7 @@
> {
> struct reference *entry;
> uint index_mask,index;
>- write_lock(ref_lock);
>+ write_lock(&ref_lock);
> index_mask = ref_table.index_mask;
> index = ref_nb & index_mask;
> entry = &(ref_table.entries[index]);
>@@ -155,7 +155,7 @@
> }
> ref_table.last_free = index;
> entry->data.next_plus_upper = (ref_nb & ~index_mask) + index_mask + 1;
>- write_unlock(ref_lock);
>+ write_unlock(&ref_lock);
> }
>
>
>@@ -182,7 +182,7 @@
> return TIPC_FAILURE;
> if (p->reg_ref == 0)
> return TIPC_OK;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> user = &users[ref];
> p->reg_ref = ref;
> p->prev = 0;
>@@ -190,7 +190,7 @@
> if (p->next)
> p->next->prev = p;
> user->ports = p;
>- spin_unlock_bh(reg_lock);
>+ spin_unlock_bh(®_lock);
> return TIPC_OK;
> }
>
>@@ -203,7 +203,7 @@
> return TIPC_FAILURE;
> if (p->reg_ref == 0)
> return TIPC_OK;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> user = &users[p->reg_ref];
> if (p->prev)
> p->prev->next = p->next;
>@@ -211,7 +211,7 @@
> user->ports = p->next;
> if (p->next)
> p->next->prev = p->prev;
>- spin_unlock_bh(reg_lock);
>+ spin_unlock_bh(®_lock);
> return TIPC_OK;
> }
>
>@@ -225,7 +225,7 @@
> return TIPC_FAILURE;
> if (s->reg.ref == 0)
> return TIPC_OK;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> user = &users[s->reg.ref];
> s->reg.ref = ref;
> s->reg.prev = 0;
>@@ -233,7 +233,7 @@
> if (s->reg.next)
> s->reg.next->reg.prev = s;
> user->subs = s;
>- spin_unlock_bh(reg_lock);
>+ spin_unlock_bh(®_lock);
> return TIPC_OK;
> }
>
>@@ -246,7 +246,7 @@
> return TIPC_FAILURE;
> if (s->reg.ref == 0)
> return TIPC_OK;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> user = &users[s->reg.ref];
> if (s->reg.prev)
> s->reg.prev->reg.next = s->reg.next;
>@@ -254,21 +254,21 @@
> user->subs = s->reg.next;
> if (s->next)
> s->reg.next->reg.prev = s->reg.prev;
>- spin_unlock_bh(reg_lock);
>+ spin_unlock_bh(®_lock);
> return TIPC_OK;
> }
>
> static void reg_init(void)
> {
> uint i = 1;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> users = (struct tipc_user*)k_malloc(sizeof(struct tipc_user));
> memset(users, 0, sizeof (users));
> for (i = 1; i <= MAX_USERID; i++) {
> users[i].next = i - 1;
> }
> next_free_user = MAX_USERID;
>- spin_lock_bh(reg_lock);
>+ spin_unlock_bh(®_lock);
> }
>
>
>@@ -290,10 +290,10 @@
> {
> struct tipc_user *user = (struct tipc_user *) u;
> tipc_started_event cb;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> cb = user->callback;
> user->callback = 0;
>- spin_unlock_bh(reg_lock);
>+ spin_unlock_bh(®_lock);
> if (!cb)
> return;
> user->callback(user->usr_handle);
>@@ -343,25 +343,41 @@
> struct name_subscr* s = 0;
> struct user_port* p = 0;
> struct tipc_user *user;
>- spin_lock_bh(reg_lock);
>+ spin_lock_bh(®_lock);
> user = &users[userid];
>- if (!user->next){
>+ if (NULL == user->next){
> s = user->subs;
> p = user->ports;
> user->subs = 0;
> user->ports = 0;
> user->next = next_free_user;
>- spin_unlock_bh(reg_lock);
>- }
>- while (s) {
>- tipc_unsubscribe(s->publ.s.ref);
>+ }
>+ spin_unlock_bh(®_lock);
>+ while (user->subs) {
>+ tipc_unsubscribe(user->subs->publ.s.ref);
> }
> while (user->ports) {
>- tipc_deleteport(p->ref);
>+ tipc_deleteport(user->ports->ref);
> }
>+
> }
>
>
>Index: socket.c
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/socket.c,v
>retrieving revision 1.2
>diff -u -r1.2 socket.c
>--- socket.c 4 Dec 2003 03:02:57 -0000 1.2
>+++ socket.c 16 Jan 2004 08:59:21 -0000
>@@ -277,9 +277,9 @@
> struct sk_buff *buf;
> if (!tsk)
> return 0;
>- spin_lock_bh(tsk);
>+ sock_lock(tsk);
> if (!sock->sk) {
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return 0;
> }
> sock->sk = NULL;
>@@ -304,7 +304,7 @@
> }
>
> res = tipc_deleteport(tsk->p->ref);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> kfree(tsk);
> reset_protinfo(sk);
> sk_free(sk);
>@@ -323,7 +323,7 @@
> return -EFAULT;
> if (i_sock_lock(tsk))
> return -ERESTARTSYS;
>- if (addr->addrtype != TIPC_ADDR_NAMESEQ)
>+ if (addr->addrtype == TIPC_ADDR_NAMESEQ)
> res = tipc_publish_nameseq(tsk->p->ref,
> tsk->bind_scope,
> &addr->addr.nameseq);
>@@ -333,7 +333,7 @@
> tsk->bind_scope,
> &addr->addr.nameseq);
> }
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res ? -EINVAL : 0;
> }
>
>@@ -350,7 +350,7 @@
> res = tipc_connect2port(tsk->p->ref, &addr->addr.id);
> if (res == TIPC_OK)
> sk->state = SS_CONNECTED;
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res ? -EFAULT : 0;
> }
>
>@@ -407,6 +407,7 @@
> tipc_ref_t new_ref = new_tsk->p->ref;
> id.ref = msg_origport(buf_msg(buf));
> id.node = msg_orignode(buf_msg(buf));
>+ user_lock(&tsk->p->lock);
> tipc_connect2port(new_ref, &id);
> tipc_setportimportance(new_ref,msg_importance(msg));
> tsk->queue_head = buf_next(buf);
>@@ -421,7 +422,7 @@
> user_unlock(&tsk->p->lock);
> }
> exit:
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
> }
>
>@@ -448,7 +449,7 @@
> } else
> res = -EFAULT;
> *uaddr_len = sizeof (*addr);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
> }
>
>@@ -462,7 +463,7 @@
> return -ERESTARTSYS;
> sock->state = SS_UNCONNECTED;
> res = tipc_disconnect(tsk->p->ref);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
> }
>
>@@ -492,7 +493,7 @@
> for (; section < scount; size += sseq[section].size, section++) {
> }
> if (unlikely(size > TIPC_MAX_DATA_SIZE)) {
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return -EINVAL;
> }
>
>@@ -509,7 +510,7 @@
>
> if (unlikely(tsk->pollmask & CONNECTION_ABORTED)) {
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> buf_discard(buf);
> return -ECONNABORTED;
> }
>@@ -534,7 +535,7 @@
>
> if (likely(res == TIPC_OK)) {
> exit:
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return size;
> }
>
>@@ -560,7 +561,7 @@
> }
> error_locked:
> error_non_locked:
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> buf_discard(buf);
> return res;
> }
>@@ -618,13 +619,13 @@
> if (unlikely
> (wait_event_interruptible(tsk->waitqueue, tsk->queue_head))) {
> return -ERESTARTSYS;
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> }
> buf = tsk->queue_head;
>
> if (unlikely(tsk->pollmask & MSG_ERROR)) {
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return -1;
> }
>
>@@ -689,7 +690,7 @@
> }
>
> recvmsg_exit:
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
> }
>
>@@ -811,7 +812,7 @@
> }
> }
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
> }
>
>@@ -881,7 +882,7 @@
> }
> }
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return !!res;
> }
>
>@@ -926,12 +927,12 @@
> s->usr_next = tsk->sub_list;
> tsk->sub_list = s;
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> put_user(s->s.ref, &((struct tipc_subscr *) arg)->ref);
> return 0;
> }
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return -EINVAL;
>
> }
>@@ -964,7 +965,7 @@
> }
> user_unlock(&tsk->p->lock);
> }
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
> }
>
>@@ -1013,7 +1014,7 @@
> tsk->pollmask |= tsk->ev_head->ev.event;
>
> user_unlock(&tsk->p->lock);
>- spin_unlock_bh(tsk);
>+ sock_unlock(tsk);
> return res;
>
> }
>Index: tipc_buf.h
>===================================================================
>RCS file: /cvsroot/tipc/source/unstable/net/tipc/tipc_buf.h,v
>retrieving revision 1.3
>diff -u -r1.3 tipc_buf.h
>--- tipc_buf.h 4 Dec 2003 02:22:20 -0000 1.3
>+++ tipc_buf.h 16 Jan 2004 08:59:22 -0000
>@@ -169,12 +169,12 @@
> static inline void buf_discard(struct sk_buff *skb)
> {
> if (likely(UB(skb)->pool)) {
>- spin_lock_bh(buf_lock);
>+ spin_lock_bh(&buf_lock);
> skb->nh.raw = skb->data = UB(skb)->data =
> skb->head + BUF_HEADROOM;
> buf_set_next(skb, *(UB(skb)->pool));
> *(UB(skb)->pool) = skb;
>- spin_unlock_bh(buf_lock);
>+ spin_unlock_bh(&buf_lock);
> return;
> }
> kfree_skb(skb);
>@@ -184,17 +184,17 @@
> {
> struct sk_buff *skb;
> if (likely(size <= SMALL_POOL_MSG_SIZE)) {
>- spin_lock_bh(buf_lock);
>+ spin_lock_bh(&buf_lock);
> skb = small_pool;
> if (likely(skb)) {
> small_pool = buf_next(skb);
>- spin_unlock_bh(buf_lock);
>+ spin_unlock_bh(&buf_lock);
> return skb;
> }
>- spin_unlock_bh(buf_lock);
>+ spin_unlock_bh(&buf_lock);
> return acquire_bufs(SMALL_POOL_MSG_SIZE, 40, &small_pool);
> } else if (size <= MEDIUM_POOL_MSG_SIZE) {
>- spin_lock_bh(buf_lock);
>+ spin_lock_bh(&buf_lock);
> skb = big_pool;
> if (skb) {
> big_pool = buf_next(skb);
>
>
|
|
From: Guo, M. <mi...@in...> - 2004-01-16 09:50:20
|
Hi,jon
With the below patch,the module can be inserted/removed correctly,but =
tipc_printf still has some problems.
Thanks
Guo Min
Index: buf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/buf.c,v
retrieving revision 1.3
diff -u -r1.3 buf.c
--- buf.c 4 Dec 2003 02:22:20 -0000 1.3
+++ buf.c 16 Jan 2004 08:59:14 -0000
@@ -85,16 +85,16 @@
UB(crs)->pool =3D pool;
buf_set_next(crs,0);
if (pool){
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
buf_set_next(crs,*pool);
*pool =3D crs;
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
}
}
if (pool){
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
*pool =3D buf_next(crs);
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
}
buf_set_next(crs, 0);
return crs;
Index: dbg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/dbg.c,v
retrieving revision 1.1
diff -u -r1.1 dbg.c
--- dbg.c 4 Dec 2003 02:22:20 -0000 1.1
+++ dbg.c 16 Jan 2004 08:59:15 -0000
@@ -135,6 +135,7 @@
spin_lock_bh(&print_lock);
if (b->tee[0]) {
err("Init on TEE buffer\n");
+ spin_unlock_bh(&print_lock);
return;
}
memset(raw, 0, sz);
@@ -161,7 +162,7 @@
if (buf->tee[0]) {
targets[0] =3D buf->tee[0];
targets[1] =3D buf->tee[1];
- kfree(buf);
+ //kfree(buf);
} else {
targets[0] =3D buf;
targets[1] =3D 0;
@@ -171,16 +172,22 @@
struct print_buf *b =3D targets[i++];
if (!b)
continue;
- assert(!b->tee[0]);
+ if (!b->tee[0])
+ {
+ spin_unlock_bh(&print_lock);
+ return;
+ }
if ((b->size - (b->crs - b->buf)) < MAX_STRING)
b->crs =3D b->buf;
FORMAT(b->crs, len, fmt);
if (((b->crs + len) - b->buf) > b->size) {
assert(!"Overstepped print/log buffer!!!\n");
}
- if (b =3D=3D CONS)
+ if ((b =3D=3D CONS) && ( b->crs))
printk(b->crs);
- b->crs +=3D len;
+ if (b->crs)
+ b->crs +=3D len;
+ =09
}
spin_unlock_bh(&print_lock);
}
@@ -218,7 +225,7 @@
if (buf->tee[0]) {
targets[0] =3D buf->tee[0];
targets[1] =3D buf->tee[1];
- kfree(buf);
+ //kfree(buf);
} else {
targets[0] =3D buf;
targets[1] =3D 0;
=20
Index: handler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/handler.c,v
retrieving revision 1.4
diff -u -r1.4 handler.c
--- handler.c 4 Dec 2003 02:22:20 -0000 1.4
+++ handler.c 16 Jan 2004 08:59:16 -0000
@@ -187,6 +187,7 @@
struct queue_item *item;
=20
spin_lock_bh(&qitem_lock);
+=09
item =3D (struct queue_item *) __get_queue_item();
item->handler =3D routine;
item->data =3D eventInfo;
@@ -197,8 +198,10 @@
signal_queue_head =3D item;
}
signal_queue_tail =3D item;
+=09
spin_unlock_bh(&qitem_lock);
- tasklet_schedule(&tipc_tasklet);
+=09
+ //tasklet_schedule(&tipc_tasklet);
return 0;
}
=20
@@ -280,6 +283,8 @@
}
}
spin_unlock_bh(&qitem_lock);
+
+ buf_stop();
}
=20
uint
Index: link.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/link.c,v
retrieving revision 1.2
diff -u -r1.2 link.c
--- link.c 11 Dec 2003 19:44:47 -0000 1.2
+++ link.c 16 Jan 2004 08:59:18 -0000
@@ -1406,19 +1406,19 @@
head =3D =
link_insert_deferred_queue(this,head);
if (likely(msg_is_dest(msg,tipc_own_addr))){
if (likely(msg_isdata(msg))) {
- =
spin_unlock_bh(this->owner->lock);
+ =
spin_unlock_bh(&this->owner->lock);
port_recv_msg(buf);
continue;
}
link_recv_non_data_msg(this, buf);
continue;
}
- spin_unlock_bh(this->owner->lock);
+ spin_unlock_bh(&this->owner->lock);
net_route_msg(buf);
continue;
}
link_handle_non_seq_msg(this, buf);
- spin_unlock_bh(this->owner->lock);
+ spin_unlock_bh(&this->owner->lock);
continue;
}
=20
@@ -1431,7 +1431,7 @@
else
buf_discard(buf);
=20
- spin_unlock_bh(this->owner->lock);
+ spin_unlock_bh(&this->owner->lock);
continue;
}
}
Index: link.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/link.h,v
retrieving revision 1.1
diff -u -r1.1 link.h
--- link.h 4 Dec 2003 02:22:20 -0000 1.1
+++ link.h 16 Jan 2004 08:59:19 -0000
@@ -270,11 +270,11 @@
struct node *node =3D node_find(addr);
if (likely(node)){
struct link* l;
- spin_lock_bh(node->lock);
+ spin_lock_bh(&node->lock);
l =3D node->links[bearer_id];
if (likely(l))
return l;
- spin_unlock_bh(node->lock);
+ spin_unlock_bh(&node->lock);
}
return 0;
}
Index: media.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/media.c,v
retrieving revision 1.1
diff -u -r1.1 media.c
--- media.c 4 Dec 2003 02:22:20 -0000 1.1
+++ media.c 16 Jan 2004 08:59:19 -0000
@@ -376,16 +376,18 @@
struct media *media =3D &media_list[0];
struct print_buf buf;
printbuf_init(&buf,raw,sz);
while (media->active) {
uint i;
for (i =3D 0; i < MAX_BEARERS; i++) {
struct bearer *b =3D &bearers[i];
if (b->active && (b->media =3D=3D media)) {
- tipc_printf(&buf, "%s\n", b->publ.name);
+ // tipc_printf(&buf, "%s\n", b->publ.name);
}
}
media++;
}
+=09
return TIPC_OK;
}
=20
Index: port.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/port.c,v
retrieving revision 1.1
diff -u -r1.1 port.c
--- port.c 4 Dec 2003 02:22:20 -0000 1.1
+++ port.c 16 Jan 2004 08:59:20 -0000
@@ -751,13 +751,13 @@
port_dispatcher_sigh(buf);
return 1;
}
- spin_lock_bh(queue_lock);
+ spin_lock_bh(&queue_lock);
if (msg_queue_head)
buf_set_next(msg_queue_tail, buf);
else
msg_queue_head =3D buf;
msg_queue_tail =3D buf;
- spin_lock_bh(queue_lock);
+ spin_lock_bh(&queue_lock);
k_signal((Handler)port_dispatcher_sigh, 0);
return 1;
}
@@ -1272,10 +1272,10 @@
{
struct port* p =3D ports;
struct sk_buff* b;
- spin_lock_bh(queue_lock);
+ spin_lock_bh(&queue_lock);
b =3D msg_queue_head;
msg_queue_head =3D 0;
- spin_unlock_bh(queue_lock);
+ spin_unlock_bh(&queue_lock);
while (b) {
struct sk_buff *next =3D buf_next(b);
buf_discard(b);
Index: reg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/reg.c,v
retrieving revision 1.1
diff -u -r1.1 reg.c
--- reg.c 4 Dec 2003 02:22:20 -0000 1.1
+++ reg.c 16 Jan 2004 08:59:21 -0000
@@ -92,7 +92,7 @@
uint sz =3D 1 << 4;
while (sz < requested_size)
sz <<=3D 1;
- write_lock(ref_lock);
+ write_lock(&ref_lock);
table =3D (struct reference *) k_malloc(sizeof (struct reference) * =
sz);
table[0].object =3D 0;
table[0].data.reference =3D ~0u;
@@ -106,7 +106,7 @@
ref_table.entries =3D table;
ref_table.first_free =3D 1;
ref_table.last_free =3D sz - 1;
- write_unlock(ref_lock);
+ write_unlock(&ref_lock);
}
=20
uint
@@ -136,7 +136,7 @@
{
struct reference *entry;
uint index_mask,index;=20
- write_lock(ref_lock);
+ write_lock(&ref_lock);
index_mask =3D ref_table.index_mask;
index =3D ref_nb & index_mask;
entry =3D &(ref_table.entries[index]);
@@ -155,7 +155,7 @@
}
ref_table.last_free =3D index;
entry->data.next_plus_upper =3D (ref_nb & ~index_mask) + index_mask + =
1;
- write_unlock(ref_lock);
+ write_unlock(&ref_lock);
}
=20
=20
@@ -182,7 +182,7 @@
return TIPC_FAILURE;
if (p->reg_ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[ref];
p->reg_ref =3D ref;
p->prev =3D 0;
@@ -190,7 +190,7 @@
if (p->next)
p->next->prev =3D p;
user->ports =3D p;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
@@ -203,7 +203,7 @@
return TIPC_FAILURE;
if (p->reg_ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[p->reg_ref];
if (p->prev)
p->prev->next =3D p->next;
@@ -211,7 +211,7 @@
user->ports =3D p->next;
if (p->next)
p->next->prev =3D p->prev;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
@@ -225,7 +225,7 @@
return TIPC_FAILURE;
if (s->reg.ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[s->reg.ref];
s->reg.ref =3D ref;
s->reg.prev =3D 0;
@@ -233,7 +233,7 @@
if (s->reg.next)
s->reg.next->reg.prev =3D s;
user->subs =3D s;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
@@ -246,7 +246,7 @@
return TIPC_FAILURE;
if (s->reg.ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[s->reg.ref];
if (s->reg.prev)
s->reg.prev->reg.next =3D s->reg.next;
@@ -254,21 +254,21 @@
user->subs =3D s->reg.next;
if (s->next)
s->reg.next->reg.prev =3D s->reg.prev;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
static void reg_init(void)
{
uint i =3D 1;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
users =3D (struct tipc_user*)k_malloc(sizeof(struct =
tipc_user));
memset(users, 0, sizeof (users));
for (i =3D 1; i <=3D MAX_USERID; i++) {
users[i].next =3D i - 1;
}
next_free_user =3D MAX_USERID;
- spin_lock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
}
=20
=20
@@ -290,10 +290,10 @@
{
struct tipc_user *user =3D (struct tipc_user *) u;
tipc_started_event cb;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
cb =3D user->callback;
user->callback =3D 0;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
if (!cb)
return;
user->callback(user->usr_handle);
@@ -343,25 +343,41 @@
struct name_subscr* s =3D 0;
struct user_port* p =3D 0;
struct tipc_user *user;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[userid]; =20
- if (!user->next){
+ if (NULL =3D=3D user->next){
s =3D user->subs;
p =3D user->ports;
user->subs =3D 0;
user->ports =3D 0;
user->next =3D next_free_user;
- spin_unlock_bh(reg_lock);
- }
- while (s) {
- tipc_unsubscribe(s->publ.s.ref);
+ }=09
+ spin_unlock_bh(®_lock);
+ while (user->subs) {
+ tipc_unsubscribe(user->subs->publ.s.ref); =20
}
while (user->ports) {
- tipc_deleteport(p->ref);
+ tipc_deleteport(user->ports->ref);
}
+
}
=20
=20
Index: socket.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/socket.c,v
retrieving revision 1.2
diff -u -r1.2 socket.c
--- socket.c 4 Dec 2003 03:02:57 -0000 1.2
+++ socket.c 16 Jan 2004 08:59:21 -0000
@@ -277,9 +277,9 @@
struct sk_buff *buf;
if (!tsk)
return 0;
- spin_lock_bh(tsk);
+ sock_lock(tsk);
if (!sock->sk) {
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return 0;
}
sock->sk =3D NULL;
@@ -304,7 +304,7 @@
}
=20
res =3D tipc_deleteport(tsk->p->ref);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
kfree(tsk);
reset_protinfo(sk);
sk_free(sk);
@@ -323,7 +323,7 @@
return -EFAULT;
if (i_sock_lock(tsk))
return -ERESTARTSYS;
- if (addr->addrtype !=3D TIPC_ADDR_NAMESEQ)
+ if (addr->addrtype =3D=3D TIPC_ADDR_NAMESEQ)
res =3D tipc_publish_nameseq(tsk->p->ref,
tsk->bind_scope,
&addr->addr.nameseq);
@@ -333,7 +333,7 @@
tsk->bind_scope,
&addr->addr.nameseq);
}
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res ? -EINVAL : 0;
}
=20
@@ -350,7 +350,7 @@
res =3D tipc_connect2port(tsk->p->ref, &addr->addr.id);
if (res =3D=3D TIPC_OK)
sk->state =3D SS_CONNECTED;
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res ? -EFAULT : 0;
}
=20
@@ -407,6 +407,7 @@
tipc_ref_t new_ref =3D new_tsk->p->ref;
id.ref =3D msg_origport(buf_msg(buf));
id.node =3D msg_orignode(buf_msg(buf));
+ user_lock(&tsk->p->lock);
tipc_connect2port(new_ref, &id);
tipc_setportimportance(new_ref,msg_importance(msg));
tsk->queue_head =3D buf_next(buf);
@@ -421,7 +422,7 @@
user_unlock(&tsk->p->lock);
}
exit:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -448,7 +449,7 @@
} else
res =3D -EFAULT;
*uaddr_len =3D sizeof (*addr);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -462,7 +463,7 @@
return -ERESTARTSYS;
sock->state =3D SS_UNCONNECTED;
res =3D tipc_disconnect(tsk->p->ref);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -492,7 +493,7 @@
for (; section < scount; size +=3D sseq[section].size, section++) {
}
if (unlikely(size > TIPC_MAX_DATA_SIZE)) {
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return -EINVAL;
}
=20
@@ -509,7 +510,7 @@
=20
if (unlikely(tsk->pollmask & CONNECTION_ABORTED)) {
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
buf_discard(buf);
return -ECONNABORTED;
}
@@ -534,7 +535,7 @@
=20
if (likely(res =3D=3D TIPC_OK)) {
exit:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return size;
}
=20
@@ -560,7 +561,7 @@
}
error_locked:
error_non_locked:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
buf_discard(buf);
return res;
}
@@ -618,13 +619,13 @@
if (unlikely
(wait_event_interruptible(tsk->waitqueue, tsk->queue_head))) {
return -ERESTARTSYS;
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
}
buf =3D tsk->queue_head;
=20
if (unlikely(tsk->pollmask & MSG_ERROR)) {
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return -1;
}
=20
@@ -689,7 +690,7 @@
}
=20
recvmsg_exit:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -811,7 +812,7 @@
}
}
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -881,7 +882,7 @@
}
}
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return !!res;
}
=20
@@ -926,12 +927,12 @@
s->usr_next =3D tsk->sub_list;
tsk->sub_list =3D s;
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
put_user(s->s.ref, &((struct tipc_subscr *) arg)->ref);
return 0;
}
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return -EINVAL;
=20
}
@@ -964,7 +965,7 @@
}
user_unlock(&tsk->p->lock);
}
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -1013,7 +1014,7 @@
tsk->pollmask |=3D tsk->ev_head->ev.event;
=20
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
=20
}
Index: tipc_buf.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/tipc_buf.h,v
retrieving revision 1.3
diff -u -r1.3 tipc_buf.h
--- tipc_buf.h 4 Dec 2003 02:22:20 -0000 1.3
+++ tipc_buf.h 16 Jan 2004 08:59:22 -0000
@@ -169,12 +169,12 @@
static inline void buf_discard(struct sk_buff *skb)
{
if (likely(UB(skb)->pool)) {
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
skb->nh.raw =3D skb->data =3D UB(skb)->data =3D
skb->head + BUF_HEADROOM;
buf_set_next(skb, *(UB(skb)->pool));
*(UB(skb)->pool) =3D skb;
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
return;
}
kfree_skb(skb);
@@ -184,17 +184,17 @@
{
struct sk_buff *skb;
if (likely(size <=3D SMALL_POOL_MSG_SIZE)) {
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
skb =3D small_pool;
if (likely(skb)) {
small_pool =3D buf_next(skb);
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
return skb;
}
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
return acquire_bufs(SMALL_POOL_MSG_SIZE, 40, &small_pool);
} else if (size <=3D MEDIUM_POOL_MSG_SIZE) {
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
skb =3D big_pool;
if (skb) {
big_pool =3D buf_next(skb);
|
|
From: Guo, M. <mi...@in...> - 2004-01-15 09:23:35
|
Hi, Jon:
I found there are really too many parts to be updated in the unstable =
tree.
here I clean up some bug.the attached is the patch.=20
Maybe the code cleanup is the highest priority tasks, in order to not =
collide with
your patch, I sent the patch to you firstly.If you agree, I would like =
to apply them to the current stable=20
tree,how about your opinion?
Thanks
Guo Min=20
The content of this email message solely contains my own personal views,
and not those of my employer.
=20
-----------------------------------
Index: buf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/buf.c,v
retrieving revision 1.3
diff -u -r1.3 buf.c
--- buf.c 4 Dec 2003 02:22:20 -0000 1.3
+++ buf.c 15 Jan 2004 09:11:22 -0000
@@ -85,16 +85,16 @@
UB(crs)->pool =3D pool;
buf_set_next(crs,0);
if (pool){
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
buf_set_next(crs,*pool);
*pool =3D crs;
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
}
}
if (pool){
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
*pool =3D buf_next(crs);
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
}
buf_set_next(crs, 0);
return crs;
Index: dbg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/dbg.c,v
retrieving revision 1.1
diff -u -r1.1 dbg.c
--- dbg.c 4 Dec 2003 02:22:20 -0000 1.1
+++ dbg.c 15 Jan 2004 09:11:22 -0000
@@ -135,6 +135,7 @@
spin_lock_bh(&print_lock);
if (b->tee[0]) {
err("Init on TEE buffer\n");
+ spin_unlock_bh(&print_lock);
return;
}
memset(raw, 0, sz);
@@ -161,7 +162,7 @@
if (buf->tee[0]) {
targets[0] =3D buf->tee[0];
targets[1] =3D buf->tee[1];
- kfree(buf);
+ //kfree(buf);
} else {
targets[0] =3D buf;
targets[1] =3D 0;
=20
Index: handler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/handler.c,v
retrieving revision 1.4
diff -u -r1.4 handler.c
--- handler.c 4 Dec 2003 02:22:20 -0000 1.4
+++ handler.c 15 Jan 2004 09:11:23 -0000
@@ -187,6 +187,7 @@
struct queue_item *item;
=20
spin_lock_bh(&qitem_lock);
+=09
item =3D (struct queue_item *) __get_queue_item();
item->handler =3D routine;
item->data =3D eventInfo;
@@ -197,8 +198,10 @@
signal_queue_head =3D item;
}
signal_queue_tail =3D item;
+=09
spin_unlock_bh(&qitem_lock);
- tasklet_schedule(&tipc_tasklet);
+=09
return 0;
}
=20
Index: link.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/link.c,v
retrieving revision 1.2
diff -u -r1.2 link.c
--- link.c 11 Dec 2003 19:44:47 -0000 1.2
+++ link.c 15 Jan 2004 09:11:24 -0000
@@ -1406,19 +1406,19 @@
head =3D =
link_insert_deferred_queue(this,head);
if (likely(msg_is_dest(msg,tipc_own_addr))){
if (likely(msg_isdata(msg))) {
- =
spin_unlock_bh(this->owner->lock);
+ =
spin_unlock_bh(&this->owner->lock);
port_recv_msg(buf);
continue;
}
link_recv_non_data_msg(this, buf);
continue;
}
- spin_unlock_bh(this->owner->lock);
+ spin_unlock_bh(&this->owner->lock);
net_route_msg(buf);
continue;
}
link_handle_non_seq_msg(this, buf);
- spin_unlock_bh(this->owner->lock);
+ spin_unlock_bh(&this->owner->lock);
continue;
}
=20
@@ -1431,7 +1431,7 @@
else
buf_discard(buf);
=20
- spin_unlock_bh(this->owner->lock);
+ spin_unlock_bh(&this->owner->lock);
continue;
}
}
Index: link.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/link.h,v
retrieving revision 1.1
diff -u -r1.1 link.h
--- link.h 4 Dec 2003 02:22:20 -0000 1.1
+++ link.h 15 Jan 2004 09:11:24 -0000
@@ -270,11 +270,11 @@
struct node *node =3D node_find(addr);
if (likely(node)){
struct link* l;
- spin_lock_bh(node->lock);
+ spin_lock_bh(&node->lock);
l =3D node->links[bearer_id];
if (likely(l))
return l;
- spin_unlock_bh(node->lock);
+ spin_unlock_bh(&node->lock);
}
return 0;
}
=20
Index: port.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/port.c,v
retrieving revision 1.1
diff -u -r1.1 port.c
--- port.c 4 Dec 2003 02:22:20 -0000 1.1
+++ port.c 15 Jan 2004 09:11:25 -0000
@@ -751,13 +751,13 @@
port_dispatcher_sigh(buf);
return 1;
}
- spin_lock_bh(queue_lock);
+ spin_lock_bh(&queue_lock);
if (msg_queue_head)
buf_set_next(msg_queue_tail, buf);
else
msg_queue_head =3D buf;
msg_queue_tail =3D buf;
- spin_lock_bh(queue_lock);
+ spin_lock_bh(&queue_lock);
k_signal((Handler)port_dispatcher_sigh, 0);
return 1;
}
@@ -1272,10 +1272,10 @@
{
struct port* p =3D ports;
struct sk_buff* b;
- spin_lock_bh(queue_lock);
+ spin_lock_bh(&queue_lock);
b =3D msg_queue_head;
msg_queue_head =3D 0;
- spin_unlock_bh(queue_lock);
+ spin_unlock_bh(&queue_lock);
while (b) {
struct sk_buff *next =3D buf_next(b);
buf_discard(b);
Index: reg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/reg.c,v
retrieving revision 1.1
diff -u -r1.1 reg.c
--- reg.c 4 Dec 2003 02:22:20 -0000 1.1
+++ reg.c 15 Jan 2004 09:11:25 -0000
@@ -182,7 +182,7 @@
return TIPC_FAILURE;
if (p->reg_ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[ref];
p->reg_ref =3D ref;
p->prev =3D 0;
@@ -190,7 +190,7 @@
if (p->next)
p->next->prev =3D p;
user->ports =3D p;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
@@ -203,7 +203,7 @@
return TIPC_FAILURE;
if (p->reg_ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[p->reg_ref];
if (p->prev)
p->prev->next =3D p->next;
@@ -211,7 +211,7 @@
user->ports =3D p->next;
if (p->next)
p->next->prev =3D p->prev;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
@@ -225,7 +225,7 @@
return TIPC_FAILURE;
if (s->reg.ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[s->reg.ref];
s->reg.ref =3D ref;
s->reg.prev =3D 0;
@@ -233,7 +233,7 @@
if (s->reg.next)
s->reg.next->reg.prev =3D s;
user->subs =3D s;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
@@ -246,7 +246,7 @@
return TIPC_FAILURE;
if (s->reg.ref =3D=3D 0)
return TIPC_OK;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[s->reg.ref];
if (s->reg.prev)
s->reg.prev->reg.next =3D s->reg.next;
@@ -254,21 +254,21 @@
user->subs =3D s->reg.next;
if (s->next)
s->reg.next->reg.prev =3D s->reg.prev;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
return TIPC_OK;
}
=20
static void reg_init(void)
{
uint i =3D 1;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
users =3D (struct tipc_user*)k_malloc(sizeof(struct =
tipc_user));
memset(users, 0, sizeof (users));
for (i =3D 1; i <=3D MAX_USERID; i++) {
users[i].next =3D i - 1;
}
next_free_user =3D MAX_USERID;
- spin_lock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
}
=20
=20
@@ -290,10 +290,10 @@
{
struct tipc_user *user =3D (struct tipc_user *) u;
tipc_started_event cb;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
cb =3D user->callback;
user->callback =3D 0;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
if (!cb)
return;
user->callback(user->usr_handle);
@@ -343,7 +343,7 @@
struct name_subscr* s =3D 0;
struct user_port* p =3D 0;
struct tipc_user *user;
- spin_lock_bh(reg_lock);
+ spin_lock_bh(®_lock);
user =3D &users[userid]; =20
if (!user->next){
s =3D user->subs;
@@ -352,7 +352,7 @@
user->ports =3D 0;
user->next =3D next_free_user;
next_free_user =3D userid;
- spin_unlock_bh(reg_lock);
+ spin_unlock_bh(®_lock);
}
while (s) {
tipc_unsubscribe(s->publ.s.ref);
=20
Index: socket.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/socket.c,v
retrieving revision 1.2
diff -u -r1.2 socket.c
--- socket.c 4 Dec 2003 03:02:57 -0000 1.2
+++ socket.c 15 Jan 2004 09:11:25 -0000
@@ -277,9 +277,9 @@
struct sk_buff *buf;
if (!tsk)
return 0;
- spin_lock_bh(tsk);
+ sock_lock(tsk);
if (!sock->sk) {
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return 0;
}
sock->sk =3D NULL;
@@ -304,7 +304,7 @@
}
=20
res =3D tipc_deleteport(tsk->p->ref);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
kfree(tsk);
reset_protinfo(sk);
sk_free(sk);
@@ -323,7 +323,7 @@
return -EFAULT;
if (i_sock_lock(tsk))
return -ERESTARTSYS;
- if (addr->addrtype !=3D TIPC_ADDR_NAMESEQ)
+ if (addr->addrtype =3D=3D TIPC_ADDR_NAMESEQ)
res =3D tipc_publish_nameseq(tsk->p->ref,
tsk->bind_scope,
&addr->addr.nameseq);
@@ -333,7 +333,7 @@
tsk->bind_scope,
&addr->addr.nameseq);
}
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res ? -EINVAL : 0;
}
=20
@@ -350,7 +350,7 @@
res =3D tipc_connect2port(tsk->p->ref, &addr->addr.id);
if (res =3D=3D TIPC_OK)
sk->state =3D SS_CONNECTED;
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res ? -EFAULT : 0;
}
=20
@@ -407,6 +407,7 @@
tipc_ref_t new_ref =3D new_tsk->p->ref;
id.ref =3D msg_origport(buf_msg(buf));
id.node =3D msg_orignode(buf_msg(buf));
+ user_lock(&tsk->p->lock);
tipc_connect2port(new_ref, &id);
tipc_setportimportance(new_ref,msg_importance(msg));
tsk->queue_head =3D buf_next(buf);
@@ -421,7 +422,7 @@
user_unlock(&tsk->p->lock);
}
exit:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -448,7 +449,7 @@
} else
res =3D -EFAULT;
*uaddr_len =3D sizeof (*addr);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -462,7 +463,7 @@
return -ERESTARTSYS;
sock->state =3D SS_UNCONNECTED;
res =3D tipc_disconnect(tsk->p->ref);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -492,7 +493,7 @@
for (; section < scount; size +=3D sseq[section].size, section++) {
}
if (unlikely(size > TIPC_MAX_DATA_SIZE)) {
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return -EINVAL;
}
=20
@@ -509,7 +510,7 @@
=20
if (unlikely(tsk->pollmask & CONNECTION_ABORTED)) {
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
buf_discard(buf);
return -ECONNABORTED;
}
@@ -534,7 +535,7 @@
=20
if (likely(res =3D=3D TIPC_OK)) {
exit:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return size;
}
=20
@@ -560,7 +561,7 @@
}
error_locked:
error_non_locked:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
buf_discard(buf);
return res;
}
@@ -618,13 +619,13 @@
if (unlikely
(wait_event_interruptible(tsk->waitqueue, tsk->queue_head))) {
return -ERESTARTSYS;
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
}
buf =3D tsk->queue_head;
=20
if (unlikely(tsk->pollmask & MSG_ERROR)) {
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return -1;
}
=20
@@ -689,7 +690,7 @@
}
=20
recvmsg_exit:
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -811,7 +812,7 @@
}
}
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -881,7 +882,7 @@
}
}
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return !!res;
}
=20
@@ -926,12 +927,12 @@
s->usr_next =3D tsk->sub_list;
tsk->sub_list =3D s;
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
put_user(s->s.ref, &((struct tipc_subscr *) arg)->ref);
return 0;
}
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return -EINVAL;
=20
}
@@ -964,7 +965,7 @@
}
user_unlock(&tsk->p->lock);
}
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
}
=20
@@ -1013,7 +1014,7 @@
tsk->pollmask |=3D tsk->ev_head->ev.event;
=20
user_unlock(&tsk->p->lock);
- spin_unlock_bh(tsk);
+ sock_unlock(tsk);
return res;
=20
}
Index: tipc_buf.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tipc/source/unstable/net/tipc/tipc_buf.h,v
retrieving revision 1.3
diff -u -r1.3 tipc_buf.h
--- tipc_buf.h 4 Dec 2003 02:22:20 -0000 1.3
+++ tipc_buf.h 15 Jan 2004 09:11:25 -0000
@@ -169,12 +169,12 @@
static inline void buf_discard(struct sk_buff *skb)
{
if (likely(UB(skb)->pool)) {
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
skb->nh.raw =3D skb->data =3D UB(skb)->data =3D
skb->head + BUF_HEADROOM;
buf_set_next(skb, *(UB(skb)->pool));
*(UB(skb)->pool) =3D skb;
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
return;
}
kfree_skb(skb);
@@ -184,17 +184,17 @@
{
struct sk_buff *skb;
if (likely(size <=3D SMALL_POOL_MSG_SIZE)) {
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
skb =3D small_pool;
if (likely(skb)) {
small_pool =3D buf_next(skb);
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
return skb;
}
- spin_unlock_bh(buf_lock);
+ spin_unlock_bh(&buf_lock);
return acquire_bufs(SMALL_POOL_MSG_SIZE, 40, &small_pool);
} else if (size <=3D MEDIUM_POOL_MSG_SIZE) {
- spin_lock_bh(buf_lock);
+ spin_lock_bh(&buf_lock);
skb =3D big_pool;
if (skb) {
big_pool =3D buf_next(skb);
<<tipc_unstable_spinlock.diff>>=20
|
|
From: Jon M. <jon...@er...> - 2004-01-12 21:10:10
|
Hi all, I just finished the first "official" draft describing TIPC for IETF. Use this as a reference for how TIPC version 2 is supposed to work. Of course, any viewpoints are welcome, -there will no doubt be a version 01 within a few months. /Jon |
|
From: Guo, M. <mi...@in...> - 2004-01-08 05:05:43
|
Welcome back, we will investigate it. =20 Thanks Guo Min -----Original Message----- From: tip...@li... = [mailto:tip...@li...]On Behalf Of Jon = Maloy Sent: Thursday, January 08, 2004 6:42 AM To: Guo, Min Cc: tipc Subject: [Tipc-discussion] Re: how about the current tipc work Hi Guo, I am finally back from my Christmas/New year brak, and can read my Ericsson mail again. One reason for having this neighbour protocol is, just as you said, to be able to sub-divide bigg clusters into smaller ones on the same = LAN. The calulations I do about link supervision background load in my draft explains why, but even memory usage considerations may require such split of clusters. Another reason is that we may want to have several clusters or zones to = communicate even when they are not on the same LAN, and maybe even=20 geographically separated. This is actually something we do in our own Ericsson products. Instead of having to set up and maintain hundreds or even thousands of = such=20 links manually when the clusters are changing, it is desirable with a = protocol=20 that can do this automatically and with an optimal result. This is the = purpose with the protocol. Actually, it is implemented, and *was* working, in Manager.c in the = ericsson_stable version. But the functionality I describe in the draft is more advanced, = with "all-to-N" links instead of "all-to-2" links as in the older version, and = supporting multicast setup, intead of relying on a manually configured pilot link. /jon Guo, Min wrote: PS: Is there anyone there who would be interested to work with the inter-cluster neighbour detection protocol ? The code is found in cfg.c, but it probably does not work any more. Anyway I updated the protocol a little in my draft, as you may see, so the code must follow. This is an interesting task, and a cool algorithm to demonstrate to the world. =20 Why use such complex neighbor detection protocol?=20 In my mind, I think it can be used to divide large cluster into small = cluster in the same LAN, and it can also do better load balance? Is that right? Thanks Guo Min =20 |
|
From: Jon M. <jon...@er...> - 2004-01-07 22:42:48
|
Hi Guo,
I am finally back from my Christmas/New year brak, and can read
my Ericsson mail again.
One reason for having this neighbour protocol is, just as you said,
to be able to sub-divide bigg clusters into smaller ones on the same
LAN.
The calulations I do about link supervision background load in my draft
explains why, but even memory usage considerations may require such
split of clusters.
Another reason is that we may want to have several clusters or zones to
communicate even when they are not on the same LAN, and maybe even
geographically separated. This is actually something we do in our own
Ericsson products.
Instead of having to set up and maintain hundreds or even thousands of
such
links manually when the clusters are changing, it is desirable with a
protocol
that can do this automatically and with an optimal result. This is the
purpose
with the protocol.
Actually, it is implemented, and *was* working, in Manager.c in the
ericsson_stable
version. But the functionality I describe in the draft is more advanced,
with "all-to-N"
links instead of "all-to-2" links as in the older version, and
supporting multicast setup,
intead of relying on a manually configured pilot link.
/jon
Guo, Min wrote:
PS: Is there anyone there who would be interested to work
with the inter-cluster neighbour detection protocol ?
The code is found in cfg.c, but it probably does not work
any more. Anyway I updated the protocol a little in my
draft, as you may see, so the code must follow.
This is an interesting task, and a cool algorithm to demonstrate
to the world.
Why use such complex neighbor detection protocol?
In my mind, I think it can be used to divide large cluster into small
cluster in the
same LAN, and it can also do better load balance? Is that right?
Thanks
Guo Min
|
|
From: <nic...@ya...> - 2003-12-16 20:46:08
|
nic...@ya... _________________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com |
|
From: Nicolas G. <lm...@er...> - 2003-12-16 20:44:54
|
nic...@ya... |
|
From: Nicolas G. <lm...@er...> - 2003-12-12 14:08:02
|
Hi everybody, I made this morning (Friday) an import on the CVS server on sourceforge of the new UNSTABLE_ERICSSON. For now, it appears that it is not visible with sourceforge's cvs browser tool, but it is there. For those of you who wants to get it, checkout source/unstable_ericsson I merged Jean-Guillaume's tipc-1.2.03 (containing his proc adaptation and Guo's multicast functionality) with mine that contains the stream interface of tipc. For those of you who wants to use the benchmark program with this version, be sure that you don't create socket with SOCK_STREAM type unless you really want to use the sock_stream interface. The update from tipc-1.2.03 is + Multicast + Proc + socket stream interface + Change the license to BSD license. Jon : I forgot to update the description of socket interface in tipc.h, it will be done this morning. /Nicolas Jon Maloy wrote: > I think there it is time for a small upgrade of TIPC now. I have been > extremely conservative with adding new features to the TIPC tar-balls, > because I had a feeling its quality was deteriorating for a while. Now I > think it is ok. > > I don't have time to do this right now, so I would be happy if one of > you > (J-G) would do the following: > > 1) Download tipc-1.2.03 > 2) Check out the latest "stable_ericsson". > 3) Merge Guo's multicast functionality from ericsson_stable (Multicast.c > and new contents of NameTable.c) into tipc-1.2.03. But NOT Ling's > additions to Reference.c and other files. (Sorry, Ling, but we can > only > do this in one way, and I prefer the distributed solution.) > 4) Change to BSD licence even in tipc.h, a file I forgot to update. > 5) Test the whole thing, with the benchmark, and with Vincent's > and Guo's test suites. > 6) Check into CVS. > 7) Tell me, and I will make a tar-ball of it and put it up at SF. > > /jon |
|
From: Jon M. <jon...@er...> - 2003-12-11 16:26:46
|
Hi, It seems like I have missed to do 'commit' on my removal of the core directory, so you get two versions of all files. That is corrected now. I had to remove the 'core' directory and move all the code there up to the net/tipc directory, rename 'tipc_buf' to 'sk_buff' etc., plus a lot of other cosmetic changes. I really hated to do this, but everybody keep telling me that this must be done to make the code acceptable for the Linux kernel community. Despite these changes, I have note touched the real basics of portability, the use of the tipc_*.h files etc. After all, names such as sk_buff, spin_lock_bh() etc can easily be remapped to other OS:es by a few #defines in tipc_adapter.h. But it is clear that the distinction between what is core code and what is adaptation code is not as visible as before, so special care must be taken to maintain this distinction in the code. The state of my 'unstable' code is the following: - It compiles, at least on 2.4 , and you can do insmod/rmmod with the module, mainly because most of the start-functions are disabled. - I have removed the tipc_big_lock, and am instead introducing locks at micro-level in each function or each file. I have introduced a few of those, but some remains to be done there. This also implies that I will have to "detach" certain upcalls from the link_reset() calls, by using signals. This is quite sensitive and tricky work, but I have a fairly clear idea about how do do it. I can explain it separately if you want to take that challenge, otherwise, this is the next thing I will do, as soon as my draft is out the door, hopefully by next week. - The cleanup of memory must be done per file/function via tipc_stop() now, and this is still not completely done. This is also tricky, since the order in which we stop the different functions is important. Otherwise the code is complete, and should be ready for testing and debugging. I suggest that you start with the tipc_start()/tipc_stop() functions, just ensuring that we can do insmod/rmmod without any crashes, but without starting any traffic. My locks must definitely be in place before we can start that last part. Regards /Jon Guo, Min wrote: >Hi, Jon > > I tried the code on the Linux kernel 2.4.20 and found the unstable code can not run. > > After I read your code, I found some problems > > 1. Some function are left as blank or unavailable ,such as named_init(). > 2. No big lock for tipc is not available. > 3. there are identical function in the files which can be found in the different directory with the same name, such as both Name_table.c and core/Name_table.c have > function nametbl_stop > > We would like to help you complete the unstable version, if you agree, could you please write a simple name translation table to us,such as original named to name_distr? We also glad to know the unimplemented and unavailable function in the unstable version but available in the stable_ericssion version. > >Thanks >Guo Min >The content of this email message solely contains my own personal views, >and not those of my employer. > > |
|
From: Jon M. <jon...@er...> - 2003-12-09 21:06:16
|
I think there it is time for a small upgrade of TIPC now. I have been
extremely conservative with adding new features to the TIPC tar-balls,
because I had a feeling its quality was deteriorating for a while. Now
I
think it is ok.
I don't have time to do this right now, so I would be happy if one of
you
(J-G) would do the following:
1) Download tipc-1.2.03
2) Check out the latest "stable_ericsson".
3) Merge Guo's multicast functionality from ericsson_stable (Multicast.c
and new contents of NameTable.c) into tipc-1.2.03. But NOT Ling's
additions to Reference.c and other files. (Sorry, Ling, but we can
only
do this in one way, and I prefer the distributed solution.)
4) Change to BSD licence even in tipc.h, a file I forgot to update.
5) Test the whole thing, with the benchmark, and with Vincent's
and Guo's test suites.
6) Check into CVS.
7) Tell me, and I will make a tar-ball of it and put it up at SF.
/jon
Jean-Guillaume wrote:
Jon: please include the following tipc_start.c file in the next stable
versions of tipc, I was surprised to see that it still doesn't include
the modications to start the procfs! I must have forgotten to send you
the modified file.
Also, I did a very minor change (removed a useless printk, and something
else), so this is the new version to be included with 1.2.03.
To the others:
I have changed proc_adaptation so that it uses procfs instead of
seqfile, and I changed some functions, so that the code now takes half
the lines it used to. It is now 2100 lines, and it will get tough to go
lower than that, because there is a good number of functiosn associated
to the maintenance of the dynamic procfs.
Please try this new version with the 1.2.03 version of tipc (and the
tipc_start.c file given here). I am curious to see if you will still get
crashes when doing a "cat nametable" ??
like I said in my previous mail, we won't use /proc/sys for now, because
of the dynamic updates.
add the -DDYNAMIC_PROC flag to use the name subscription (no more
scannetwork file)
thanks
J-G
_____
/*
* proc_adaptation.c: Creates and manage the /proc/tipc directory, which
displays information from kernel memory.
Created 2003-09-15 by Jean-Guillaume Paradis, intern at Ericsson
Canada, Montreal
*/
/******************************************************************
Copyright (c) 2003, Ericsson Research Canada
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice,
this list of conditions and the following disclaimer in the
documentation
and/or other materials provided with the distribution.
Neither the name of Ericsson Research Canada nor the names of its
contributors may be used to endorse or promote products derived from
this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE
POSSIBILITY OF SUCH DAMAGE.
******************************************************************/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/poll.h>
#include <linux/dirent.h>
#include <linux/list.h>
#include <linux/sysctl.h>
#include <stdio.h>
#include <tipc.h>
#include <tipc_adaptation.h>
#include "tipc_port.h"
#include "tipc_adaptation_locks.h"
#define DEBUG_LEVEL 0
#define TIPC_DIR "tipc"
#define MOD_NAME "proc_adapt: "
#define printf0(args...) if(DEBUG_LEVEL >= 0) { printk(args); }
#define printf1(args...) if(DEBUG_LEVEL >= 1) { printk(args); }
#define printf2(args...) if(DEBUG_LEVEL >= 2) { printk(args); }
#define printf3(args...) if(DEBUG_LEVEL >= 3) { printk(args); }
#define LINKS_CREATION 1
#define PORTS_CREATION 2
#define BEARERS_CREATION 3
extern const char *addr_string(tipc_address_t);
extern boolean bearer_nameValid(const char *);
/***************************
Used for the proc files
****************************/
#define NUMS_SIZE 5
#define MAX_ZONES 15
#define MAX_PROCS_BY_SUBNET 512
#define MAX_PROCS_ON_NETWORK 7680
#define MAX_LINK_BY_PROC 4
#define LINK_NAME_LENGTH 72
#define MAX_PORTS 2048 //to check
#define MAX_BEARER_TYPES 10
#define MAX_BEARER_NAMES 10
//used for the waitQueues array, the numbers correspond to the index
// the queues array must be big enough to handle all the types, of
course
#define PROCESSORS_TYPE 0
#define LINKS_TYPE 1
#define LINK_STATS_TYPE 2
#define RESET_LINK_TYPE 3
#define ROUTING_TABLE_TYPE 4
#define PEER_ADDRESS_TYPE 5
#define PORTS_TYPE 6
#define PORT_STATS_TYPE 7
#define RESET_PORT_STATS_TYPE 8
#define BEARERS_TYPE 9
#define NAME_TABLE_TYPE 10
#define SECOND_COMMAND_GROUP_TYPE 11
#define CREATE_LINK_TYPE 12
#define REMOVE_LINK_TYPE 13
#define BLOCK_LINK_TYPE 14
#define UNBLOCK_LINK_TYPE 15
#define SET_LINK_TOLERANCE_TYPE 16
#define SET_LINK_PRIORITY_TYPE 17
#define SET_LINK_WINDOW_TYPE 18
#define ENABLE_BEARER_TYPE 19
#define DISABLE_BEARER_TYPE 20
#define PROC_NA_TYPE 21
#define OWN_ADDRESS_TYPE 22
#define SCAN_NETWORK_TYPE 23
struct proc_dir_entry *tipc_root;
struct proc_dir_entry *tipc_sys_net;
struct ctl_table_header *tipc_sys_dir;
struct proc_file_info {
int type;
struct proc_dir_entry *this;
};
struct parent_proc_info {
uint proc_addr;
int proc_index;
};
// Used to store the links of a processor, for cleaning of the procfs
struct link_name {
char name[LINK_NAME_LENGTH];
// int nb;
struct list_head next;
};
struct generic_proc_entry { //used for port names,
char name[20];
struct list_head next;
};
struct proc_entry_with_dir { //user for bearer types, bearers
char name[20];
struct proc_dir_entry *dir; //the bearerType keeps its own
proc_dir_entry, bearers names keep the proc_dir_entry of
//their parent (a bearerType)
struct list_head next;
};
struct subnet_dir_entry {
struct proc_dir_entry *this;
struct proc_dir_entry *parent;
};
struct my_proc_dir_entry {
int exists;
int available;
struct proc_dir_entry *this;
struct proc_dir_entry *parent;
struct proc_dir_entry *links_dir; // processor1->Links
directory
struct proc_dir_entry *ports_dir;
struct proc_dir_entry *bearers_dir;
//we must keep the names of the directories created, to remove
the entries when necessary
struct list_head list_bearer_types;
struct list_head list_bearer_names;
struct list_head list_links;
struct list_head list_ports;
struct link_name *links[MAX_PROCS_BY_SUBNET * MAX_LINK_BY_PROC];
//the names are kept here, and are linked with the above lists
struct generic_proc_entry *ports[MAX_PORTS];
struct proc_entry_with_dir *bearer_types[MAX_BEARER_TYPES];
struct proc_entry_with_dir *bearer_names[MAX_BEARER_NAMES];
};
//when doign a request to the manager, these queues wait for the
callBack function when necessary
static wait_queue_head_t queues[30];
//these are the entries in /proc/tipc, we must remove them at module
exit to avoid corruption of the procfs
static struct proc_dir_entry *own_address_dir, *processors,
*network_dir, *scan_network;
//static struct proc_dir_entry * routingTableDir; not implemented yet,
add it if it is one day
//We set these variables to 1 in the corresponding callBack-> they are
the tested condition
//to wakeup the waiting queue
//After the wakeup, we set them back to 0, waiting for the next request
static int get_processors_cb_done = 0, get_links_cb_done =
0, get_link_stats_cb_done = 0;
static int get_peer_address_cb_done = 0, reset_link_stats_cb_done =
0, get_ports_cb_done = 0, get_port_stats_cb_done = 0;
static int reset_port_stats_cb_done = 0, get_name_table_cb_done =
0, get_bearers_cb_done = 0;
//The second group of commands share the same callback
static int second_cmd_group_cb_done = 0;
static int nb_procs = 0, nb_links = 0, nb_ports = 0;
//these are used in the creation of the procs directory hierarchy, to
keep track of the existing zones, etc.
static int zones[MAX_ZONES] = { 0, };
static struct subnet_dir_entry *subnets[MAX_ZONES];
/*
the procs struct uses the "proc_index" , which is mentionned in some
conversion functions
*/
static struct my_proc_dir_entry *procs[MAX_PROCS_ON_NETWORK];
//keeps the result of the CallBack until the Show method of the procfile
char result_links_cb[1], result_link_stats_cb[1], result_ports_cb[1];
//char * result_port_stats_cb; Doing a dynamic allocation doesn't work
here
//the string is ok in all
functions, until we hit the get_portsStats_start, show etc
//There, the string is
missing a part!
// There are NO places
except in the callback where the value of the string is changed..
//weird... another procfs
trick.
//let use these arrays for now...
char result_bearers_cb[1], result_port_stats_cb[1],
result_name_table_cb[1],
result_routing_table_cb[1];
char result_peer_address_cb[64];
//char * result_name_table_cb; // once again, problems with dynamic
allocation... when using this variable, with
//malloc in the callback and
free in the get_name_table_stop procfs function,
//we get a segmentation
fault -> unable to handle kernel paging request,
//but this error occurs
AFTER the unloading of my module!!!
//seems like there are a
couple of fishy things in the procfs...
//(I'm not surprised,
somebody in the linux kernel mailing list told me the procfs
//was pretty messed up ):(
//Each of these function needs its own port to the manager
static tipc_id_t port_id_processor = 0, port_id_bearers = 0,
port_id_links =
0, port_id_link_stats = 0;
static tipc_id_t port_id_peer_address = 0, port_id_reset_link_stats =
0, port_id_name_table = 0, port_id_id_ports = 0;
static tipc_id_t port_id_port_stats = 0, port_id_reset_stats = 0;
static tipc_id_t user = 0;
//second command group share the same port
static tipc_id_t port_id_second_cmd_group = 0;
//holds the ports number after a get_ports
static uint ports[MAX_PORTS];
static struct tipc_createport_argv createport;
static struct tipc_portname port;
/****************************
Set by the CallBacks, used for the proc files
*****************************/
static struct tipc_command_result_msg *get_processors_cb_result;
/****************************
Function Declarations
*****************************/
static int wait_for_callback(int *, int);
static int addr_to_proc_nb(tipc_id_t);
static tipc_id_t addr_atoi(char *);
static tipc_id_t proc_nb_to_addr(int);
static void add_proc_to_list(tipc_id_t, int);
static void remove_proc_from_list(tipc_id_t);
static void parse_string_and_action(int, int);
static int proc_read_data(char *, char **, off_t, int, int *, void *);
static int proc_write_data(struct file *, const char *, unsigned long,
void *);
static void print_manager_return_value(int, char *);
static void set_proc_attributes(struct proc_dir_entry *, int);
////void free_proc_bearers(int);
/*************************************************
Various conversion functions
**************************************************/
// atoi is in os_adaptation, but not itoa
static void
set_proc_attributes(struct proc_dir_entry *file, int type)
{
struct proc_file_info *info;
file->read_proc = proc_read_data;
file->data = (struct proc_file_info *) os_malloc(sizeof (struct
proc_file_info));
info = file->data;
info->type = type;
info->this = file;
}
static char *
itoa(uint i)
{
char buf[12];
char *pos = buf + sizeof (buf) - 1;
unsigned int u;
int negative = 0;
if (i < 0) {
negative = 1;
u = ((unsigned int) (-(1 + i))) + 1;
} else {
u = i;
}
*pos = 0;
do {
*--pos = '0' + (u % 10);
u /= 10;
} while (u);
if (negative) {
*--pos = '-';
}
return pos;
}
/*
tipc address --> processorNb index for the procs array
for now we don't need to work with the subnetNb, as it is the same as
the zoneZb
*/
static int
addr_to_proc_nb(tipc_id_t addr)
{
int zoneNb = 0xFF000000 & addr;
int procNb = 0x00000FFF & addr;
zoneNb = zoneNb >> 24;
return ((zoneNb - 1) * MAX_PROCS_BY_SUBNET + (procNb - 1));
}
/*
processorNb index -> tipc address
*/
static tipc_id_t
proc_nb_to_addr(int procNb)
{
tipc_id_t ret;
int zone = procNb / MAX_PROCS_BY_SUBNET;
zone++;
int processor = procNb % MAX_PROCS_BY_SUBNET;
processor++;
ret = (zone << 24) + (zone << 12) + processor;
return ret;
}
/*
takes an address in the form 0.0.0
returns a number corresponding to the string address
--> Maybe I might need a function that can take an address in the 0.0
form, etc
*/
static tipc_id_t
addr_atoi(char *addr)
{
int zoneNb, subNb, procNb;
tipc_id_t ret;
char zone[6] = { 0, };
char sub[6] = { 0, };
char proc[6] = { 0, };
char *pos2;
char *pos = strchr(addr, '.');
memcpy(&zone, addr, pos - addr);
zoneNb = atoi(zone);
pos = pos + 1;
pos2 = strchr(pos, '.');
memcpy(&sub, pos, pos2 - pos);
subNb = atoi(sub);
pos = pos2 + 1;
pos2 = strchr(pos, '\0');
memcpy(&proc, pos, pos2 - pos);
procNb = atoi(proc);
ret = (zoneNb << 24) + (subNb << 12) + procNb;
return ret;
}
/**************************************
Some functions to parse strings
**************************************/
/*
returns the number at the end of the directory name, after the _
ex: processor_2
*/
static int
parse_dir(const char *dir)
{
return atoi(dir);
}
static int
parse_nametable(const char *dir)
{
char *pos = strchr(dir, '_');
return atoi(pos + 1);
}
//extrack the bearerType of a bearerName
static char *
parse_bearer_type(char *bearer)
{
char *pos, *ret;
char type[20] = { 0, };
pos = strchr(bearer, ':');
memcpy(type, bearer + 1, pos - bearer - 1);
ret = (char *) os_malloc(sizeof (type) + 1);
strcpy(ret, type);
return ret;
}
//extract the bearer's name of a bearerName
//-> eth0 from <ethernet:eth0> for example
static char *
parse_bearer_name(char *bearer)
{
char *pos, *pos2;
char name[20] = { 0, };
char *ret;
pos = strchr(bearer, ':');
pos++;
pos2 = strchr(pos, '>');
memcpy(name, pos, pos2 - pos);
ret = (char *) os_malloc(sizeof (name) + 1);
strcpy(ret, name);
return ret;
}
//returned char * must be freed
static char *
bearer_name_from_dir(struct proc_dir_entry *file)
{
char name[40] = { 0 };
char type[40] = { 0 };
char *ret;
int sizeName = 0, sizeType = 0;
strcpy(name, file->parent->name);
strcpy(type, file->parent->parent->name);
sizeName = strlen(name);
sizeType = strlen(type);
ret = (char *) os_malloc(100);
ret[0] = '<';
memcpy(&ret[1], type, sizeType);
ret[sizeType + 1] = ':';
memcpy(&ret[sizeType + 2], name, sizeName);
ret[sizeType + sizeName + 2] = '>';
return ret;
}
//level is the depth of the read file compared to the "processor_1"
directory, for example
static struct parent_proc_info
get_parent_proc_info(struct proc_dir_entry *file, int level)
{
uint procNb = 0, subNb = 0, zoneNb = 0;
struct parent_proc_info ret;
switch (level) {
case 1:{
procNb = parse_dir(file->parent->name);
subNb = parse_dir(file->parent->parent->name);
zoneNb =
parse_dir(file->parent->parent->parent->name);
break;
}
case 3:{
procNb =
parse_dir(file->parent->parent->parent->name);
subNb =
parse_dir(file->parent->parent->parent->parent->name);
zoneNb
=parse_dir(file->parent->parent->parent->parent->parent->name);
break;
}
case 4:{
procNb
=parse_dir(file->parent->parent->parent->parent->name);
subNb =
parse_dir(file->parent->parent->parent->parent-> parent->name);
zoneNb =
parse_dir(file->parent->parent->parent->parent->parent->parent->name);
break;
}
default:{
printk("TIPC------> Default Case of
get_parent_proc_info: should not be there!\n");
break;
}
}
ret.proc_index = (zoneNb - 1) * MAX_PROCS_BY_SUBNET + procNb -
1;
ret.proc_addr = (zoneNb << 24) + (subNb << 12) + procNb;
return ret;
}
/*************************************************************
Callback functions, triggered by the functions that use the Manager
(see below)
Each callback needs an error_even callBack
**************************************************************/
/*
Handles error codes, prints the reason
*/
static void
error_msg_code_reason(tipc_msg_error_code reason)
{
switch (reason) {
case (tipc_no_portname):
printk("TIPC------> No portname\n");
break;
case (tipc_no_remote_port):
printk("TIPC------> No remote port\n");
break;
case (tipc_no_remote_processor):
printk("TIPC------> No remote processor\n");
break;
case (tipc_destination_overloaded):
printk("TIPC------> Destination overload\n");
break;
case (tipc_not_connected):
printk("TIPC------> Not connected\n");
break;
case (tipc_communication_error):
printk("TIPC------> Communication error\n");
break;
default:
printk("TIPC------> Unspecified error\n");
break;
}
}
/**************
The first callbacks are tipc_message_event
**************/
static tipc_message_event
get_processors_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
tipc_message_event dummy = (tipc_message_event) 0;
get_processors_cb_result = (tipc_command_result_msg *) data;
nb_procs = ntohl(get_processors_cb_result->result_len) /
sizeof
(get_processors_cb_result->result.processors[0]);
get_processors_cb_done = 1;
wake_up(&queues[PROCESSORS_TYPE]);
return dummy;
}
static tipc_error_event
first_cmd_group_error_cb(void *userdata, tipc_id_t portid,
unsigned char const *data, unsigned int size,
tipc_portreference const *attempted_dest_id,
tipc_msg_error_code reason,
tipc_portname const *attempted_dest_name, void
**buf)
{
tipc_error_event dummy = (tipc_error_event) 0;
printk("TIPC------> a command of the first group of management
command returned an error!\n");
printk("data: %s\n", data);
if (attempted_dest_id != NULL)
printk("TIPC------> Attempted processor address:
%u\n",attempted_dest_id->processor);
if (attempted_dest_name != NULL)
printk("TIPC------> Attempted portname type: %u
portname Instance: %u\n",
attempted_dest_name->type,
attempted_dest_name->instance);
printk("TIPC------> Reason of failure: ");
error_msg_code_reason(reason);
return dummy;
}
static tipc_message_event
get_bearers_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg *get_bearers_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_bearers_cb_result = (tipc_command_result_msg *) data;
strcpy(result_bearers_cb, get_bearers_cb_result->result.str);
get_bearers_cb_done = 1;
wake_up(&queues[BEARERS_TYPE]);
return dummy;
}
static tipc_message_event
get_links_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg *get_links_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_links_cb_result = (tipc_command_result_msg *) data;
nb_links = ntohl(get_links_cb_result->result_len) /
sizeof
(get_links_cb_result->result.link_event);
strcpy(result_links_cb, get_links_cb_result->result.str);
//printk("Links in callback: %s\n", result_links_cb);
get_links_cb_done = 1;
wake_up(&queues[LINKS_TYPE]);
return dummy;
}
static tipc_message_event
get_link_stats_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg *get_link_stats_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_link_stats_cb_result = (tipc_command_result_msg *) data;
strncpy(result_link_stats_cb,
get_link_stats_cb_result->result.str,
ntohl(get_link_stats_cb_result->result_len));
get_link_stats_cb_done = 1;
wake_up(&queues[LINK_STATS_TYPE]);
return dummy;
}
static tipc_message_event
get_peer_address_cb(void *userdata, tipc_id_t portid, unsigned char
const *data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg
*get_peer_address_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_peer_address_cb_result = (tipc_command_result_msg *) data;
strncpy(result_peer_address_cb,
get_peer_address_cb_result->result.peer_address,
ntohl(get_peer_address_cb_result->result_len));
get_peer_address_cb_done = 1;
wake_up(&queues[PEER_ADDRESS_TYPE]);
return dummy;
}
static tipc_message_event
reset_link_stats_cb(void *userdata, tipc_id_t portid, unsigned char
const *data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg
*reset_link_stats_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
reset_link_stats_cb_result = (tipc_command_result_msg *) data;
reset_link_stats_cb_done = 1;
wake_up(&queues[RESET_LINK_TYPE]);
return dummy;
}
static tipc_message_event
get_name_table_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg *get_name_table_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_name_table_cb_result = (tipc_command_result_msg *) data;
strncpy(result_name_table_cb,
get_name_table_cb_result->result.str,
ntohl(get_name_table_cb_result->result_len));
memset(result_name_table_cb +
ntohl(get_name_table_cb_result->result_len) - 1,
'\0', 1);
get_name_table_cb_done = 1;
wake_up(&queues[NAME_TABLE_TYPE]);
return dummy;
}
static tipc_message_event
get_ports_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg *get_ports_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_ports_cb_result = (tipc_command_result_msg *) data;
nb_ports = ntohl(get_ports_cb_result->result_len) / sizeof
(uint);
memcpy(&ports, &get_ports_cb_result->result.ports,
ntohl(get_ports_cb_result->result_len));
get_ports_cb_done = 1;
wake_up(&queues[PORTS_TYPE]);
return dummy;
}
static tipc_message_event
get_port_stats_cb(void *userdata, tipc_id_t portid, unsigned char const
*data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg *get_port_stats_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
get_port_stats_cb_result = (tipc_command_result_msg *) data;
strncpy(result_port_stats_cb,
get_port_stats_cb_result->result.str,
ntohl(get_port_stats_cb_result->result_len));
get_port_stats_cb_done = 1;
wake_up(&queues[PORT_STATS_TYPE]);
return dummy;
}
static tipc_message_event
reset_port_stats_cb(void *userdata, tipc_id_t portid, unsigned char
const *data,
unsigned int size, tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
static struct tipc_command_result_msg
*reset_port_stats_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
reset_port_stats_cb_result = (tipc_command_result_msg *) data;
reset_port_stats_cb_done = 1;
wake_up(&queues[RESET_PORT_STATS_TYPE]);
return dummy;
}
//The name subscription is used to dynamically update the procfs
hierarchy
//For now it is not used, as we have a problem with this...
//In the Callback, we are in a Kernel space interrupt, so we cannot use
a userspace function
//like create_proc_entry without crashing the system
static tipc_name_status_event
create_name_subscription_cb(void *userdata, tipc_id_t subscriptionid,
tipc_subscription_event event, unsigned int
type,
unsigned int found_lower, unsigned int
found_upper)
{
tipc_name_status_event dummy = (tipc_name_status_event) 0;
if (event == 0x800) {
//printk("TIPC------> Name Subs Cb: New Processor
published\n");
os_sendSignal_keventd((SignalHandler) add_proc_to_list,
(void *) found_lower);
} else if (event == 0x1000) {
//printk("TIPC------> Name Subs Cb: Processor
removed\n");
os_sendSignal_keventd((SignalHandler)
remove_proc_from_list, (void *) found_lower);
}
return dummy;
}
/***************
These are the 3 callBacks used by the seconds group of commands of
tipc_management.h
The tipc_message_event callback should not be called, as these commands
use connected messages
But there was a problem in the tipc code that called this callback
instead. This should not happen
again, but I'm leaving the callback here for safety: the manager will
find the callback and display
stuff instead of crashing in the absence of it
****************/
static tipc_message_event
second_cmd_group_event_cb(void *userdata, tipc_id_t portid,
unsigned char const *data, unsigned int size,
tipc_portreference const *origin,
tipc_msg_importance importance, void **buf)
{
struct tipc_command_result_msg *second_cmd_group_cb_result;
tipc_message_event dummy = (tipc_message_event) 0;
second_cmd_group_cb_result = (tipc_command_result_msg *) data;
printk("TIPC------> >>second_cmd_group_event_cb callback,This
probably means we got an error\n");
printk("TIPC------> Returned string: %s\n",
second_cmd_group_cb_result->result.str);
second_cmd_group_cb_done = 1;
wake_up(&queues[SECOND_COMMAND_GROUP_TYPE]);
return dummy;
}
static tipc_connected_message_event
second_cmd_group_cb(void *userdata, tipc_id_t portid, unsigned char
const *data,
unsigned int size, void **buf)
{
struct tipc_command_result_msg *second_cmd_group_cb_result;
tipc_connected_message_event dummy =
(tipc_connected_message_event) 0;
second_cmd_group_cb_result = (tipc_command_result_msg *) data;
printk("TIPC------>>>second_cmd_group_cb callback ->");
if (ntohl(second_cmd_group_cb_result->result_len) == 0)
printk("Acknowledgement succesful\n");
else
printk("Acknowledgement failed\n");
second_cmd_group_cb_done = 1;
wake_up(&queues[SECOND_COMMAND_GROUP_TYPE]);
return dummy;
}
static tipc_connected_error_event
second_cmd_group_error_cb(void *userdata, tipc_id_t portid,
tipc_msg_error_code reason, void **buf)
{
tipc_connected_error_event dummy = (tipc_connected_error_event)
0;
printk("TIPC------>>>second_cmd_group_error_cb!\n");
printk("TIPC------>Attempted address: %u\n", portid);
printk("TIPC------>Reason of failure: \n");
error_msg_code_reason(reason);
second_cmd_group_cb_done = 1;
wake_up(&queues[SECOND_COMMAND_GROUP_TYPE]);
return dummy;
}
/*******************************************************************
Functions that call the Manager for various information
********************************************************************/
/*
Does the Attach to the manager. If this fails, subsystem is down. All
requests to the manager
use the same user.
*/
static int
create_user_to_manager(void)
{
//Asking the manager
port.type = 0;
port.instance = tipc_ownAddress;
if (tipc_attach(&user, NULL, NULL) == 0) {
return 0;
} else {
return -1;
}
}
/*
Used by the first command group
*/
static void
create_port_id(tipc_id_t * portId)
{
if (*portId == 0)
tipc_createport(user, &createport, portId);
}
/*
The second command group shares the same port
*/
static void
create_second_cmd_group_port(void)
{
struct tipc_createport_argv create_port_argv;
if (port_id_second_cmd_group == 0) {
create_port_argv.importance = 2;
create_port_argv.connected_message_cb =
(tipc_connected_message_event) second_cmd_group_cb;
create_port_argv.connected_error_cb =
(tipc_connected_error_event)
second_cmd_group_error_cb;
create_port_argv.message_cb =
(tipc_message_event) second_cmd_group_event_cb;
tipc_createport(user, &create_port_argv,
&port_id_second_cmd_group);
//printk("port_id_second_cmd_group: %u
\n",port_id_second_cmd_group);
}
}
/*
For the second command group, upon the first Succesful Acknoledgement,
the port stays connected,
so subsequent calls must use tipc_send instead of tipc_send2name,
else we get an error (attempt to write to port in wrong state)
*/
static void
send_depending_on_connect(tipc_portname * port, tipc_message_section *
msg)
{
int connected = -1;
tipc_isconnected(port_id_second_cmd_group, &connected);
if (connected) {
tipc_send(port_id_second_cmd_group, 1, msg);
} else {
tipc_send2name(port_id_second_cmd_group, port, 0, 1,
msg);
}
}
/*
When a processor is added or removed from the zone, this callback is
fired. We use it to
dynamically update the hierarchy of the procfs
*/
static void
create_name_subscription(void)
{
struct tipc_name_subscription_argv name_argv;
tipc_id_t subscriptionId;
char address[50] = { 0 };
//Asking the manager
port.type = 0;
port.instance = tipc_ownAddress;
name_argv.userdata = NULL;
name_argv.type = 0;
//set the range of the subscription depending on the defined
variables
sprintf(address, "%u.%u.%u", addr_zone(tipc_ownAddress),
addr_subnet(tipc_ownAddress), (uint) 0);
name_argv.lowerbound = addr_atoi(address);
sprintf(address, "%u.%u.%u", addr_zone(tipc_ownAddress),
addr_subnet(tipc_ownAddress), (uint)
MAX_PROCS_BY_SUBNET - 1);
name_argv.upperbound = addr_atoi(address);
//no timeout
name_argv.timeout = 0xffffffff;
name_argv.name_event_cb = (tipc_name_status_event)
create_name_subscription_cb;
tipc_subscribe2name(user, &name_argv, &subscriptionId);
}
static void
manager_request(int type, tipc_id_t address, const char *str, uint
value,
const tipc_bearer_addr bear_addr)
{
//printk("manager1\n");
tipc_id_t *port_id = NULL;
struct tipc_command_msg cmd_msg;
struct tipc_message_section msg;
createport.importance = 2;
//printk("manager2\n");
//printk("value: %d str: %s addresss: %u\n", value, str,
address);
port.type = 0;
if (address != 0)
port.instance = address;
else
port.instance = tipc_ownAddress;
switch (type) {
case (PROCESSORS_TYPE):
//printk("manager case get processors\n");
port_id = &port_id_processor;
createport.message_cb = (tipc_message_event)
get_processors_cb;
cmd_msg.command = htonl(TIPC_GET_PROCESSORS);
cmd_msg.argv.scope = 0;
break;
case (BEARERS_TYPE):
port_id = &port_id_bearers;
createport.message_cb = (tipc_message_event)
get_bearers_cb;
cmd_msg.command = htonl(TIPC_GET_BEARERS);
//cmd_msg.argv.scope = 0;
break;
case (LINKS_TYPE):
port_id = &port_id_links;
createport.message_cb = (tipc_message_event)
get_links_cb;
cmd_msg.command = htonl(TIPC_GET_LINKS);
cmd_msg.argv.scope = 0;
break;
case (LINK_STATS_TYPE):
//printk("link stats type manager\n");
port_id = &port_id_link_stats;
createport.message_cb = (tipc_message_event)
get_link_stats_cb;
cmd_msg.command = htonl(TIPC_GET_LINK_STATISTICS);
strcpy(cmd_msg.argv.link_name, str);
break;
case (PEER_ADDRESS_TYPE):
port_id = &port_id_peer_address;
createport.message_cb =(tipc_message_event)
get_peer_address_cb;
cmd_msg.command = htonl(TIPC_GET_PEER_ADDRESS);
strcpy(cmd_msg.argv.link_name, str);
break;
case (RESET_LINK_TYPE):
port_id = &port_id_reset_link_stats;
createport.message_cb = (tipc_message_event)
reset_link_stats_cb;
cmd_msg.command = htonl(TIPC_RESET_LINK_STATISTICS);
strcpy(cmd_msg.argv.link_name, str);
break;
case (NAME_TABLE_TYPE):
port_id = &port_id_name_table;
struct tipc_get_name_table_argv name_table_argv;
name_table_argv.type = 0;
name_table_argv.depth = htonl(value); //only works for
0??
createport.message_cb = (tipc_message_event)
get_name_table_cb;
cmd_msg.command = htonl(TIPC_GET_NAME_TABLE);
//create_port_id(&port_id_name_table);
cmd_msg.argv.get_name_table = name_table_argv;
//cmd_msg.argv.scope = 0;
break;
case (PORTS_TYPE):
port_id = &port_id_id_ports;
createport.message_cb = (tipc_message_event)
get_ports_cb;
cmd_msg.command = htonl(TIPC_GET_PORTS);
break;
case (PORT_STATS_TYPE):
port_id = &port_id_port_stats;
createport.message_cb = (tipc_message_event)
get_port_stats_cb;
cmd_msg.command = htonl(TIPC_GET_PORT_STATISTICS);
memcpy(&cmd_msg.argv.port_ref, &value, sizeof (uint));
break;
case (RESET_PORT_STATS_TYPE):
port_id = &port_id_reset_stats;
createport.message_cb =
(tipc_message_event) reset_port_stats_cb;
cmd_msg.command = htonl(TIPC_RESET_PORT_STATISTICS);
memcpy(&cmd_msg.argv.port_ref, &value, sizeof (uint));
break;
case (CREATE_LINK_TYPE):
strcpy(cmd_msg.argv.create_link.bearer_name, str);
strcpy(cmd_msg.argv.create_link.peer_addr, bear_addr);
cmd_msg.command = htonl(TIPC_CREATE_LINK);
break;
case (REMOVE_LINK_TYPE):
strcpy(cmd_msg.argv.link_name, str);
cmd_msg.command = htonl(TIPC_REMOVE_LINK);
break;
case (BLOCK_LINK_TYPE):
strcpy(cmd_msg.argv.link_name, str);
cmd_msg.command = htonl(TIPC_BLOCK_LINK);
break;
case (UNBLOCK_LINK_TYPE):
strcpy(cmd_msg.argv.link_name, str);
cmd_msg.command = htonl(TIPC_UNBLOCK_LINK);
break;
case (SET_LINK_TOLERANCE_TYPE):
cmd_msg.argv.configure_link.value = ntohl(value);
cmd_msg.command = htonl(TIPC_SET_LINK_TOLERANCE);
strcpy(cmd_msg.argv.configure_link.name, str);
break;
case (SET_LINK_PRIORITY_TYPE):
cmd_msg.argv.configure_link.value = ntohl(value);
cmd_msg.command = htonl(TIPC_SET_LINK_PRIORITY);
strcpy(cmd_msg.argv.configure_link.name, str);
break;
case (SET_LINK_WINDOW_TYPE):
cmd_msg.argv.configure_link.value = ntohl(value);
cmd_msg.command = htonl(TIPC_SET_LINK_WINDOW);
strcpy(cmd_msg.argv.configure_link.name, str);
break;
case (ENABLE_BEARER_TYPE):
strcpy(cmd_msg.argv.enable_bearer.name, str);
cmd_msg.command = htonl(TIPC_ENABLE_BEARER);
cmd_msg.argv.enable_bearer.priority = htonl(value);
break;
case (DISABLE_BEARER_TYPE):
strcpy(cmd_msg.argv.bearer_name, str);
cmd_msg.command = htonl(TIPC_DISABLE_BEARER);
break;
}
msg.data = (char *) &cmd_msg;
msg.size = sizeof (cmd_msg);
if (type <= NAME_TABLE_TYPE) {
//printk("before create_port_id\n");
createport.error_cb =
(tipc_error_event) first_cmd_group_error_cb;
//printk("poc id pointer: %p\n", port_id);
create_port_id(port_id);
//printk("after create_port_id\n");
tipc_send2name(*port_id, &port, 0, 1, &msg);
//printk("after tipc_send2name\n");
} else {
create_second_cmd_group_port();
send_depending_on_connect(&port, &msg);
}
}
/*****************************************
Functions supporting the proc file system
******************************************/
/*
frees the memory that was allocated to hold the name of the processor
Links
*/
static void
free_proc_link_names(int procNb)
{
int i;
//for all the possible links on a proc
for (i = 0; i < MAX_PROCS_BY_SUBNET * MAX_LINK_BY_PROC; i++) {
if (procs[procNb]->links[i] != NULL) {
// printk("Index %u is not NULL!\n",i);
kfree((char *) procs[procNb]->links[i]);
procs[procNb]->links[i] = NULL;
}
}
//resetting the list
INIT_LIST_HEAD(&procs[procNb]->list_links);
}
/*
free the Links Directory and the links inside
*/
static void
free_proc_link_dir(int procNb)
{
struct list_head *pos;
struct link_name *tmp;
if (procs[procNb]->links_dir != NULL) { //the get_links file was
read, so the Links dir exits{
list_for_each(pos, &procs[procNb]->list_links) {
tmp = list_entry(pos, struct link_name, next);
remove_proc_entry(tmp->name,
procs[procNb]->links_dir);
}
remove_proc_entry("Links", procs[procNb]->this);
procs[procNb]->links_dir = NULL;
}
}
static void
free_proc_links(int procNb)
{
free_proc_link_dir(procNb);
free_proc_link_names(procNb);
}
/*
frees the memory that was allocated to hold the name of the processor
Ports
*/
static void
free_proc_port_names(int procNb)
{
// printk(">>free_proc_port_names\n");
int i;
//for all the possible Ports on a proc
for (i = 0; i < MAX_PORTS; i++) {
if (procs[procNb]->ports[i] != NULL) {
kfree((char *) procs[procNb]->ports[i]);
procs[procNb]->ports[i] = NULL;
}
}
//resetting the list
INIT_LIST_HEAD(&procs[procNb]->list_ports);
}
static void
free_proc_port_dir(int procNb)
{
struct list_head *pos;
struct generic_proc_entry *tmp;
if (procs[procNb]->ports_dir != NULL) { //the get_links file was
read, so the Links dir exits{
list_for_each(pos, &procs[procNb]->list_ports) {
tmp = list_entry(pos, struct generic_proc_entry,
next);
remove_proc_entry(tmp->name,
procs[procNb]->ports_dir);
// printk("removing port Directory:
%s\n",tmp->name);
}
remove_proc_entry("Ports", procs[procNb]->this);
procs[procNb]->ports_dir = NULL;
}
}
static void
free_proc_ports(int procNb)
{
free_proc_port_dir(procNb);
free_proc_port_names(procNb);
}
/*
Free the memory allocated to hold the bearer_types and Names, and
reinitialize the lists
*/
static void
free_bearers_names(int procNb)
{
int i;
//for all the possible bearers
for (i = 0; i < MAX_BEARER_TYPES; i++) {
if (procs[procNb]->bearer_types[i] != NULL) {
// printk("Index %u is not NULL!\n",i);
kfree((char *) procs[procNb]->bearer_types[i]);
procs[procNb]->bearer_types[i] = NULL;
}
}
//resetting the list
INIT_LIST_HEAD(&procs[procNb]->list_bearer_types);
for (i = 0; i < MAX_BEARER_NAMES; i++) {
if (procs[procNb]->bearer_names[i] != NULL) {
kfree((char *) procs[procNb]->bearer_names[i]);
procs[procNb]->bearer_names[i] = NULL;
}
}
//resetting the list
INIT_LIST_HEAD(&procs[procNb]->list_bearer_names);
}
/*
We remove the bearer_names first, and then the bearer_types, since
bearer_names are under Types
in the hierarchy
*/
static void
free_bearers_dir(int procNb)
{
struct list_head *pos;
struct proc_entry_with_dir *tmp;
if (procs[procNb]->bearers_dir != NULL) { //the
get_bearers file was read, so the Bearers dir exits{
list_for_each(pos, &procs[procNb]->list_bearer_names) {
tmp = list_entry(pos, struct
proc_entry_with_dir, next);
remove_proc_entry(tmp->name, tmp->dir); //we
stored its parent there
}
list_for_each(pos, &procs[procNb]->list_bearer_types) {
tmp = list_entry(pos, struct
proc_entry_with_dir, next);
//printk("removing bearerType directory :
%s\n",tmp->name);
remove_proc_entry(tmp->name,procs[procNb]->bearers_dir);
}
remove_proc_entry("Bearers", procs[procNb]->this);
procs[procNb]->bearers_dir = NULL;
}
}
static void
free_proc_bearers(int procNb)
{
free_bearers_dir(procNb);
free_bearers_names(procNb);
}
/*when opening the "get_links" file, the Links directory is created,
with subdirs for each link
the names of these links must be kept, so that upon removal of the
processor, we can do a
remove_proc_entry for each of the subdirectory!
this function adds a link name to a processor
*/
static void
addLinkToProc(int procNb, char *str)
{
int i;
//for all possible links
for (i = 0; i < MAX_PROCS_BY_SUBNET * MAX_LINK_BY_PROC; i++) {
//take the 1st available pointer
if (procs[procNb]->links[i] == NULL) {
procs[procNb]->links[i] = (struct link_name *)
os_malloc(sizeof (struct link_name));
strcpy(procs[procNb]->links[i]->name, str);
//add the link to the list of the processor
list_add_tail(&procs[procNb]->links[i]->next,
&procs[procNb]->list_links);
return;
}
}
//dit not return, all pointers are used (should not happen!)
}
static void
add_port_to_proc(int procNb, char *str)
{
int i;
//for all possible ports
for (i = 0; i < MAX_PORTS; i++) {
//take the 1st available pointer
if (procs[procNb]->ports[i] == NULL) {
procs[procNb]->ports[i] = (struct
generic_proc_entry *) os_malloc(sizeof (struct generic_proc_entry));
strcpy(procs[procNb]->ports[i]->name, str);
//add the link to the list of the processor
list_add_tail(&procs[procNb]->ports[i]->next,
&procs[procNb]->list_ports);
return;
}
}
//dit not return, all pointers are used (should not happen!)
printk
("TIPC------>ERROR in add_port_to_proc: All the
generic_proc_entry structs of the specified processor are full!\n");
}
/*
Same thing, but for bearers, the function also CREATES the directory
*/
static void
add_bearer_type_to_proc(char *bearerType, int procNb)
{
struct list_head *pos;
struct proc_entry_with_dir *tmp;
struct proc_dir_entry *tmpDir;
int flag = 0, i;
//check to see if the bearerType already exists for the
processor
list_for_each(pos, &procs[procNb]->list_bearer_types) {
tmp = list_entry(pos, struct proc_entry_with_dir, next);
if (strcmp(tmp->name, bearerType) == 0) {
flag = 1; //bearerType already exists for
the processor
break; //get out of the list_for_each
}
}
if (!flag) { // bearerType wasn't in the processors's
list, so we must add it and create the proc_entry
//add the bearerType to the processor
for (i = 0; i < MAX_BEARER_TYPES; i++) { //take
the 1st available pointer
if (procs[procNb]->bearer_types[i] == NULL) {
tmpDir =
proc_mkdir(bearerType,
procs[procNb]->bearers_dir);
procs[procNb]->bearer_types[i] = (struct
proc_entry_with_dir *)
os_malloc(sizeof (struct proc_entry_with_dir));
strcpy(procs[procNb]->bearer_types[i]->name, bearerType);
//the bearer_types keeps its own
proc_dir_entry
procs[procNb]->bearer_types[i]->dir =
tmpDir;
//add the bearerType to the list of the
processor
list_add_tail(&procs[procNb]->bearer_types[i]->
next,
&procs[procNb]->
list_bearer_types);
return;
}
}
//dit not return, all pointers are used (should not
happen!)
printk ("TIPC------>Error in add_bearer_type_to_proc:
All the proc_entry_with_dir structs of the specified processor are
full!\n");
}
}
static struct proc_dir_entry *
add_bearer_name_to_proc(char *bearerType, char *bearerName, int procNb)
{
struct list_head *pos;
struct proc_entry_with_dir *bearerTypeDir = NULL;
struct proc_dir_entry *tmpDir = (struct proc_dir_entry *) 0;
int flag = 0, i;
//here, we are finding the proc_entry_with_dir of the bearerType
list_for_each(pos, &procs[procNb]->list_bearer_types) {
bearerTypeDir =list_entry(pos, struct
proc_entry_with_dir, next);
if (strcmp(bearerTypeDir->name, bearerType) == 0) {
flag = 1; //bearerType already exists for
the processor
break; //get out of the list_for_each
}
}
if (flag) { //the bearerType should always be in the
list, since it was added before the bearerName
for (i = 0; i < MAX_BEARER_NAMES; i++) { //take
the 1st available pointer
if (procs[procNb]->bearer_names[i] == NULL) {
//create the directory, the parent is
the bearerType already found
tmpDir = proc_mkdir(bearerName,
bearerTypeDir->dir);
procs[procNb]->bearer_names[i] =
(struct proc_entry_with_dir *)
os_malloc(sizeof (struct proc_entry_with_dir));
strcpy(procs[procNb]->bearer_names[i]->name, bearerName);
//the bearerName keeps a pointer to its
parent
procs[procNb]->bearer_names[i]->dir =
bearerTypeDir->dir;
//add the bearerName to the list of the
processor
list_add_tail(&procs[procNb]->bearer_names[i]->next,&procs[procNb]->
list_bearer_names);
return tmpDir;
}
}
//dit not return, all pointers are used (should not
happen!)
printk("TIPC------>Error in add_bearer_name_to_proc All
the proc_entry_with_dir structs of the specified processor are
full!\n");
return tmpDir;
} else {
printk ("TIPC------> BearerType: %s not found in the
processors list for bearerName: %s !\n",
bearerType, bearerName);
return tmpDir;
}
}
/*
Called by parse_string_and_action
Uses the result of a callBack, and calls the functions to create the
directories/files from that data
*/
static void
__parse_string_and_action(struct proc_dir_entry *dir, int procNb, int
action)
{
//printk("__parse_string_and_action\n");
int i;
struct proc_dir_entry *tmp, *tmp2;
char link[LINK_NAME_LENGTH] = { 0, };
char bearer[20] = { 0, };
char port[20] = { 0, };
char *pos, *beforeString, *bearerType, *bearerName;
switch (action) {
case LINKS_CREATION:{
//printk("result_links_cb: %s\n",
result_links_cb);
pos = result_links_cb;
do {
beforeString = pos;
pos = strchr(pos, '\n');
if (pos != NULL) {
pos++; //AFTER the \n
//we are already in the
"Links" directory
//memcpy(&link,beforeString+1,pos-beforeString-3); //strip the
surrounding < and > of the link, makes for
//a better directory name
memcpy(&link, beforeString, pos
- beforeString - 1); //don't strip here
remove_proc_entry(link, dir);
tmp = proc_mkdir(link, dir);
//add the link the the
processor's list
addLinkToProc(procNb, link);
remove_proc_entry("stats", tmp);
tmp2 =
create_proc_entry("stats", 0644, tmp);
set_proc_attributes(tmp2,
LINK_STATS_TYPE);
remove_proc_entry("resetStats",
tmp);
tmp2 =
create_proc_entry("resetStats", 0644, tmp);
set_proc_attributes(tmp2,
RESET_LINK_TYPE);
remove_proc_entry("peerAddress",
tmp);
tmp2
=create_proc_entry("peerAddress",
0644,
tmp);
set_proc_attributes(tmp2,
PEER_ADDRESS_TYPE);
remove_proc_entry("remove_link",
tmp);
tmp2 =
create_proc_entry("remove_link", 0644, tmp);
set_proc_attributes(tmp2,
REMOVE_LINK_TYPE);
remove_proc_entry("block_link",
tmp);
tmp2
=create_proc_entry("block_link", 0644, tmp);
set_proc_attributes(tmp2,
BLOCK_LINK_TYPE);
remove_proc_entry("unblock_link", tmp);
tmp2
=create_proc_entry("unblock_link",0644, tmp);
set_proc_attributes(tmp2,
UNBLOCK_LINK_TYPE);
remove_proc_entry
("W_set_link_tolerance", tmp);
tmp2 = create_proc_entry
("W_set_link_tolerance", 0644, tmp);
set_proc_attributes(tmp2,
SET_LINK_TOLERANCE_TYPE);
tmp2->write_proc =
proc_write_data;
remove_proc_entry("W_set_link_priority", tmp);
tmp2 = create_proc_entry
("W_set_link_priority", 0644, tmp);
set_proc_attributes(tmp2,
SET_LINK_PRIORITY_TYPE);
tmp2->write_proc =
proc_write_data;
remove_proc_entry("W_set_link_window",tmp);
tmp2 =create_proc_entry
("W_set_link_window", 0644, tmp);
set_proc_attributes(tmp2,
SET_LINK_WINDOW_TYPE);
tmp2->write_proc =
proc_write_data;
} else {
return;
}
} while ((pos != NULL) && (pos[0] != '\0'));
break;
}
case PORTS_CREATION:{
for (i = 0; i < nb_ports; i++) {
strcpy(&port[0], itoa(ports[i]));
remove_proc_entry(port, dir);
tmp = proc_mkdir(port, dir);
add_port_to_proc(procNb, port);
remove_proc_entry("stats", tmp);
tmp2 = create_proc_entry("stats", 0644,
tmp);
set_proc_attributes(tmp2,
PORT_STATS_TYPE);
remove_proc_entry("resetStats", tmp);
tmp2 = create_proc_entry("resetStats",
0644, tmp);
set_proc_attributes(tmp2,
RESET_PORT_STATS_TYPE);
}
return;
break;
}
case BEARERS_CREATION:{
pos = result_bearers_cb;
do {
beforeString = pos;
pos = strchr(pos, '\n');
if (pos != NULL) {
pos++;
memcpy(&bearer, beforeString,
pos - beforeString - 1); //strip the first <
bearerType =
parse_bearer_type(bearer);
bearerName =
parse_bearer_name(bearer);
add_bearer_type_to_proc(bearerType,
procNb);
//bearerName is under a
bearerType
tmp =
add_bearer_name_to_proc(bearerType, bearerName, procNb);
kfree((char *) bearerType);
kfree((char *) bearerName);
remove_proc_entry("disable_bearer", tmp);
tmp2
=create_proc_entry("disable_bearer", 0644, tmp);
set_proc_attributes(tmp2,
DISABLE_BEARER_TYPE);
} else {
return;
}
} while ((pos != NULL) && (pos[0] != '\0'));
break;
}
default:{
return;
break;
}
}
}
/*
Takes a processorsNb and an action to accomplish
*/
static void
parse_string_and_action(int proc_nb, int action)
{
struct proc_dir_entry *dir;
dir = procs[proc_nb]->this;
//main action of the function
switch (action) {
case LINKS_CREATION:{
dir = proc_mkdir("Links", dir);
procs[proc_nb]->links_dir = dir;
__parse_string_and_action(dir, proc_nb, action);
//creates the indiviual Links directories
break;
}
case PORTS_CREATION:{
dir = proc_mkdir("Ports", dir);
procs[proc_nb]->ports_dir = dir;
//str will be NULL
__parse_string_and_action(dir, proc_nb, action);
break;
}
case BEARERS_CREATION:{
dir = proc_mkdir("Bearers", dir);
procs[proc_nb]->bearers_dir = dir;
__parse_string_and_action(dir, proc_nb, action);
//creates the indiviual Links directories
break;
}
}
}
/***********************************************
Functions that engage callBack functions, and manage the wait for the
return
Callbacks are put in a global array of waitQueues, 1 for each type
***********************************************/
/*
Waits for a Callback for a number of ticks
*/
static int
wait_for_callback(int *callback, int type)
{
int ret =
!wait_event_interruptible_timeout(queues[type], *callback,
500);
if (ret == -ERESTARTSYS) {
return -ERESTARTSYS; //important, to resume handling
of the signals
} else if (ret) {
printk
("TIPC------> timeout in wait_event_interruptible
while asking to manager\n");
return -1;
} else {
return 0;
}
}
/*
Asks to the manager a request for information, waits for the return
arg1 is for depth of nametable, and a few others
arg2 is for a tipcAddress
arg3 is a the name of a link for example, arg4 too
Some functions share the same wait_queue and callBacks
*/
static int
ask_manager_and_wait(int type, char *name, int *cb_flag, uint arg1, uint
arg2,
const char *arg3, char *arg4)
{
int ret;
if (type <= NAME_TABLE_TYPE) {
init_waitqueue_head(&queues[type]);
} else
init_waitqueue_head(&queues[SECOND_COMMAND_GROUP_TYPE]);
manager_request(type, arg2, arg3, arg1, arg4);
//printk("manager request done\n");
ret = wait_for_callback(cb_flag, type);
//printk("wait for callback done\n");
*cb_flag = 0;
return ret;
}
/**************************************************
Functions that manage the processors
**************************************************/
/*
allocates memory for a processor entry in the procs[array]
creates the processors's directory in the procfs, possibly adding a new
Zone and Subnet
*/
static void
add_proc_to_list(tipc_id_t addr, int available)
{
struct proc_dir_entry *zoneTmpDir, *subnetTmpDir, *procTmpDir,
*fileTmp;
int zone, proc, i;
char name[LINK_NAME_LENGTH];
zone = addr_zone(addr) - 1;
proc = addr_proc(addr) - 1;
int procNb = (zone * MAX_PROCS_BY_SUBNET) + proc;
//proc already exists (should not happen, it's a security for
integrity)
if ((zones[zone] == 1) && (subnets[zone] != NULL)
&& (procs[procNb] != NULL)) {
return;
}
if (zones[zone] == 0) {
sprintf(name, "%d", zone + 1);
//printk("name: %s\n",name);
// printk("network_dir pointer: %p\n",network_dir);
zoneTmpDir = proc_mkdir(name, network_dir);
zones[zone] = 1;
sprintf(name, "%d", zone + 1);
// printk("zoneTmpDir pointer: %p\n",zoneTmpDir);
subnetTmpDir = proc_mkdir(name, zoneTmpDir);
subnets[zone] = (struct subnet_dir_entry *)
os_malloc(sizeof (struct subnet_dir_entry));
subnets[zone]->parent = zoneTmpDir;
subnets[zone]->this = subnetTmpDir;
}
if (procs[procNb] == NULL) {
// printk("Creating Proc %u\n",proc+1);
sprintf(name, "%d", proc + 1);
//printk("name: %s\n",name);
procs[procNb] = (struct my_proc_dir_entry *)
os_malloc(sizeof (struct my_proc_dir_entry));
procTmpDir = proc_mkdir(name, subnets[zone]->this);
procs[procNb]->parent = subnets[zone]->this;
procs[procNb]->this = procTmpDir;
INIT_LIST_HEAD(&procs[procNb]->list_links);
INIT_LIST_HEAD(&procs[procNb]->list_ports);
INIT_LIST_HEAD(&procs[procNb]->list_bearer_types);
INIT_LIST_HEAD(&procs[procNb]->list_bearer_names);
//Not necessary???
for (i = 0; i < MAX_PROCS_BY_SUBNET * MAX_LINK_BY_PROC;
i++) {
procs[procNb]->links[i] = NULL;
}
for (i = 0; i < MAX_PORTS; i++) {
procs[procNb]->ports[i] = NULL;
}
for (i = 0; i < MAX_BEARER_TYPES; i++) {
procs[procNb]->bearer_types[i] = NULL;
}
for (i = 0; i < MAX_BEARER_NAMES; i++) {
procs[procNb]->bearer_names[i] = NULL;
}
if (available) {
fileTmp = create_proc_entry("get_links", 0644,
procTmpDir);
set_proc_attributes(fileTmp, LINKS_TYPE);
fileTmp = create_proc_entry("get_ports",
0644, procTmpDir);
set_proc_attributes(fileTmp, PORTS_TYPE);
fileTmp = create_proc_entry("get_bearers",
0644, procTmpDir);
set_proc_attributes(fileTmp, BEARERS_TYPE);
fileTmp = create_proc_entry("nametable_0",
0644, procTmpDir);
set_proc_attributes(fileTmp, NAME_TABLE_TYPE);
//fileTmp->proc_fops = &get_name_table_fops;
fileTmp =
create_proc_entry("nametable_1", 0644, procTmpDir);
set_proc_attributes(fileTmp, NAME_TABLE_TYPE);
fileTmp = create_proc_entry("nametable_2",
0644, procTmpDir);
set_proc_attributes(fileTmp, NAME_TABLE_TYPE);
fileTmp = create_proc_entry("W_create_link",
0644,
procTmpDir);
fileTmp->write_proc = proc_write_data;
set_proc_attributes(fileTmp, CREATE_LINK_TYPE);
fileTmp =
create_proc_entry("W_enable_bearer", 0644,
procTmpDir);
fileTmp->write_proc = proc_write_data;
set_proc_attributes(fileTmp,
ENABLE_BEARER_TYPE);
} else {
fileTmp =
create_proc_entry("Processor_Not_Available", 0644, procTmpDir);
set_proc_attributes(fileTmp, PROC_NA_TYPE);
}
}
}
/*
frees the memory allocated for the proc_dir_entry struct, and the
underlying list of Links, ports etc
deletes the directories to keep the integrity of the procfs
*/
static void
remove_proc_from_list(tipc_id_t addr)
{
char name[LINK_NAME_LENGTH];
int zone, proc, i, flag = 1;
zone = addr_zone(addr) - 1;
proc = addr_proc(addr) - 1;
int procNb = (zone * MAX_PROCS_BY_SUBNET) + proc;
//remove the specified processor
if (procs[procNb] != NULL) {
//free the LinkNames array of the processors and the
Links Directory
free_proc_links(procNb);
free_proc_ports(procNb);
free_proc_bearers(procNb);
sprintf(name, "%d", proc + 1);
//remove the files and the processor dir itself
if (procs[procNb]->available) {
remove_proc_entry("get_links",
procs[procNb]->this);
remove_proc_entry("get_ports",
procs[procNb]->this);
remove_proc_entry("get_bearers",
procs[procNb]->this);
remove_proc_entry("nametable_0",
procs[procNb]->this);
remove_proc_entry("nametable_1",
procs[procNb]->this);
remove_proc_entry("nametable_2",
procs[procNb]->this);
remove_proc_entry("W_create_link",
procs[procNb]->this);
remove_proc_entry("W_enable_bearer",
procs[procNb]->this);
} else {
remove_proc_entry("Processor_Not_Available",
procs[procNb]->this);
}
remove_proc_entry(name, procs[procNb]->parent);
kfree((char *) procs[procNb]);
procs[procNb] = NULL;
}
//if all the processors of the zone are gone, we must remove the
zone too
for (i = (zone * MAX_PROCS_BY_SUBNET);
i < (zone + 1) * MAX_PROCS_BY_SUBNET; i++) {
//we have at least 1 processor active in the zone
if (procs[i] != NULL) {
flag = 0;
break;
}
}
//all processors are gone, remove subnet and zone
if (flag) {
//printk("All processors of subnet gone, removing Subnet
and Zone %u\n",zone+1);
sprintf(name, "%d", zone + 1);
remove_proc_entry(name, network_dir);
zones[zone] = 0;
sprintf(name, "%d", zone + 1);
remove_proc_entry(name, subnets[zone]->parent);
kfree((char *) subnets[zone]);
subnets[zone] = NULL;
}
}
/*
Well duh! ;)
*/
static void
remove_all_processors(void)
{
int i;
uint zone, proc, proc_addr;
for (i = 0; i < MAX_PROCS_ON_NETWORK; i++) {
if (procs[i] != NULL) { //processor exists
//we recreate a tipc address from the iterator
zone = i / MAX_PROCS_BY_SUBNET + 1;
proc = i % MAX_PROCS_BY_SUBNET + 1;
proc_addr = (zone << 24) + (zone << 12) + proc;
//right now, zone == subnet
remove_proc_from_list(proc_addr);
}
}
}
/*
Called when opening the scan_network file of the procfs for example
Asks for the current list of processors, updates the procfs hierarchy
accordingly
*/
static void
get_network_info_from_procs(void)
{
int i, ret, proc_nb;
tipc_id_t proc_addr;
//we assume that all the processors don't exist anymore
for (i = 0; i < MAX_PROCS_BY_SUBNET * MAX_LINK_BY_PROC; i++) {
if (procs[i] != NULL)
procs[i]->exists = 0;
}
//get_processorsAndWait();
ret =ask_manager_and_wait(PROCESSORS_TYPE, "get_processors",
&get_processors_cb_done, 0, 0, NULL,
NULL);
if (ret == -1)
printk("TIPC------>get_processors request failed..\n");
else {
//for all the current existing processors
for (i = 0; i < nb_procs; i++) {
proc_addr =
ntohl(get_processors_cb_result->result.processors[i].addr);
proc_nb = addr_to_proc_nb(proc_addr);
if (proc_addr == 1) {
//printk("processor available\n");
//if the processors isn't in the procfs,
we add it
if (procs[proc_nb] == NULL) {
// printk("Address of processor
added to list: %u\n",
ntohl(get_processors_cb_result->result.processors[i].addr));
add_proc_to_list(proc_addr, 1);
} else { //processor already
exists
//processor is changing state,
we add it again
if (procs[proc_nb]->available ==
0) {
//printk("processor used
to be NA, but now it is back\n");
remove_proc_from_list
(proc_nb_to_addr(i));
add_proc_to_list(proc_addr, 1);
}
}
//wether it was in the procfs or not, we
must now say it exists
procs[proc_nb]->exists = 1;
procs[proc_nb]->available = 1;
} else { //we list the processors even if
they are not available, but they won't have the common entries,
//only a Procerrors_not_available entry
//processor used to be available, now it
isn't
//processors doesn't exist in the list
if (procs[proc_nb] == NULL) {
add_proc_to_list(proc_addr, 0);
} else { //processor exists
//but changing state!
if (procs[proc_nb]->available ==
1) {
remove_proc_from_list
(proc_nb_to_addr(i));
add_proc_to_list(proc_addr, 0);
}
}
//wether it was in the procfs or not, we
must now say it exists
procs[proc_nb]->exists = 1;
procs[proc_nb]->available = 0;
}
}
//now, for the processors who existed in a previous scan
...
[truncated message content] |