merge sock_alloc_fd/sock_attach_fd into a new helper
[safe/jmp/linux-2.6] / net / tipc / link.c
index 9784a8e..6f50f64 100644 (file)
@@ -378,8 +378,8 @@ static void link_timeout(struct link *l_ptr)
                struct tipc_msg *msg = buf_msg(l_ptr->first_out);
                u32 length = msg_size(msg);
 
-               if ((msg_user(msg) == MSG_FRAGMENTER)
-                   && (msg_type(msg) == FIRST_FRAGMENT)) {
+               if ((msg_user(msg) == MSG_FRAGMENTER) &&
+                   (msg_type(msg) == FIRST_FRAGMENT)) {
                        length = msg_size(msg_get_wrapped(msg));
                }
                if (length) {
@@ -1155,7 +1155,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
 int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
 {
        struct link *l_ptr;
-       struct node *n_ptr;
+       struct tipc_node *n_ptr;
        int res = -ELINKCONG;
 
        read_lock_bh(&tipc_net_lock);
@@ -1226,7 +1226,7 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
 int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
 {
        struct link *l_ptr;
-       struct node *n_ptr;
+       struct tipc_node *n_ptr;
        int res;
        u32 selector = msg_origport(buf_msg(buf)) & 1;
        u32 dummy;
@@ -1270,7 +1270,7 @@ int tipc_link_send_sections_fast(struct port *sender,
        struct tipc_msg *hdr = &sender->publ.phdr;
        struct link *l_ptr;
        struct sk_buff *buf;
-       struct node *node;
+       struct tipc_node *node;
        int res;
        u32 selector = msg_origport(hdr) & 1;
 
@@ -1364,7 +1364,7 @@ static int link_send_sections_long(struct port *sender,
                                   u32 destaddr)
 {
        struct link *l_ptr;
-       struct node *node;
+       struct tipc_node *node;
        struct tipc_msg *hdr = &sender->publ.phdr;
        u32 dsz = msg_data_sz(hdr);
        u32 max_pkt,fragm_sz,rest;
@@ -1561,7 +1561,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
                        l_ptr->retransm_queue_head = mod(++r_q_head);
                        l_ptr->retransm_queue_size = --r_q_size;
                        l_ptr->stats.retransmitted++;
-                       return TIPC_OK;
+                       return 0;
                } else {
                        l_ptr->stats.bearer_congs++;
                        msg_dbg(buf_msg(buf), "|>DEF-RETR>");
@@ -1580,7 +1580,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
                        l_ptr->unacked_window = 0;
                        buf_discard(buf);
                        l_ptr->proto_msg_queue = NULL;
-                       return TIPC_OK;
+                       return 0;
                } else {
                        msg_dbg(buf_msg(buf), "|>DEF-PROT>");
                        l_ptr->stats.bearer_congs++;
@@ -1604,7 +1604,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
                                        msg_set_type(msg, CLOSED_MSG);
                                msg_dbg(msg, ">PUSH-DATA>");
                                l_ptr->next_out = buf->next;
-                               return TIPC_OK;
+                               return 0;
                        } else {
                                msg_dbg(msg, "|PUSH-DATA|");
                                l_ptr->stats.bearer_congs++;
@@ -1628,15 +1628,15 @@ void tipc_link_push_queue(struct link *l_ptr)
 
        do {
                res = tipc_link_push_packet(l_ptr);
-       }
-       while (res == TIPC_OK);
+       } while (!res);
+
        if (res == PUSH_FAILED)
                tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
 }
 
 static void link_reset_all(unsigned long addr)
 {
-       struct node *n_ptr;
+       struct tipc_node *n_ptr;
        char addr_string[16];
        u32 i;
 
@@ -1682,7 +1682,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf)
 
                /* Handle failure on broadcast link */
 
-               struct node *n_ptr;
+               struct tipc_node *n_ptr;
                char addr_string[16];
 
                tipc_printf(TIPC_OUTPUT, "Msg seq number: %u,  ", msg_seqno(msg));
@@ -1843,7 +1843,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
        read_lock_bh(&tipc_net_lock);
        while (head) {
                struct bearer *b_ptr = (struct bearer *)tb_ptr;
-               struct node *n_ptr;
+               struct tipc_node *n_ptr;
                struct link *l_ptr;
                struct sk_buff *crs;
                struct sk_buff *buf = head;
@@ -2788,8 +2788,8 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
 
        /* Is there an incomplete message waiting for this fragment? */
 
-       while (pbuf && ((msg_seqno(buf_msg(pbuf)) != long_msg_seq_no)
-                       || (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) {
+       while (pbuf && ((msg_seqno(buf_msg(pbuf)) != long_msg_seq_no) ||
+                       (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) {
                prev = pbuf;
                pbuf = pbuf->next;
        }
@@ -2935,7 +2935,7 @@ void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
  * Returns pointer to link (or 0 if invalid link name).
  */
 
-static struct link *link_find_link(const char *name, struct node **node)
+static struct link *link_find_link(const char *name, struct tipc_node **node)
 {
        struct link_name link_name_parts;
        struct bearer *b_ptr;
@@ -2965,7 +2965,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
        struct tipc_link_config *args;
        u32 new_value;
        struct link *l_ptr;
-       struct node *node;
+       struct tipc_node *node;
        int res;
 
        if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
@@ -2998,7 +2998,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
                        link_set_supervision_props(l_ptr, new_value);
                        tipc_link_send_proto_msg(l_ptr, STATE_MSG,
                                                 0, 0, new_value, 0, 0);
-                       res = TIPC_OK;
+                       res = 0;
                }
                break;
        case TIPC_CMD_SET_LINK_PRI:
@@ -3007,14 +3007,14 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
                        l_ptr->priority = new_value;
                        tipc_link_send_proto_msg(l_ptr, STATE_MSG,
                                                 0, 0, 0, new_value, 0);
-                       res = TIPC_OK;
+                       res = 0;
                }
                break;
        case TIPC_CMD_SET_LINK_WINDOW:
                if ((new_value >= TIPC_MIN_LINK_WIN) &&
                    (new_value <= TIPC_MAX_LINK_WIN)) {
                        tipc_link_set_queue_limits(l_ptr, new_value);
-                       res = TIPC_OK;
+                       res = 0;
                }
                break;
        }
@@ -3043,7 +3043,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
 {
        char *link_name;
        struct link *l_ptr;
-       struct node *node;
+       struct tipc_node *node;
 
        if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
                return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
@@ -3091,7 +3091,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
 {
        struct print_buf pb;
        struct link *l_ptr;
-       struct node *node;
+       struct tipc_node *node;
        char *status;
        u32 profile_total = 0;
 
@@ -3207,7 +3207,7 @@ int link_control(const char *name, u32 op, u32 val)
        int res = -EINVAL;
        struct link *l_ptr;
        u32 bearer_id;
-       struct node * node;
+       struct tipc_node * node;
        u32 a;
 
        a = link_name2addr(name, &bearer_id);
@@ -3230,7 +3230,7 @@ int link_control(const char *name, u32 op, u32 val)
                        if (op == TIPC_CMD_UNBLOCK_LINK) {
                                l_ptr->blocked = 0;
                        }
-                       res = TIPC_OK;
+                       res = 0;
                }
                tipc_node_unlock(node);
        }
@@ -3249,7 +3249,7 @@ int link_control(const char *name, u32 op, u32 val)
 
 u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
 {
-       struct node *n_ptr;
+       struct tipc_node *n_ptr;
        struct link *l_ptr;
        u32 res = MAX_PKT_DEFAULT;
 
@@ -3325,8 +3325,8 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
                                      (l_ptr->last_out)), l_ptr->out_queue_size);
                if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) -
                         msg_seqno(buf_msg(l_ptr->first_out)))
-                    != (l_ptr->out_queue_size - 1))
-                   || (l_ptr->last_out->next != NULL)) {
+                    != (l_ptr->out_queue_size - 1)) ||
+                   (l_ptr->last_out->next != NULL)) {
                        tipc_printf(buf, "\nSend queue inconsistency\n");
                        tipc_printf(buf, "first_out= %x ", l_ptr->first_out);
                        tipc_printf(buf, "next_out= %x ", l_ptr->next_out);