LTP GCOV extension - code coverage report
Current view: directory - net/tipc - local.h
Test: tipc.info
Date: 2003-08-07 Instrumented lines: 9
Code covered: 77.8 % Executed lines: 7

       1                 : /* 
       2                 :  * TIPC Linux kernel implementation
       3                 :  * Copyright (c) 2001-2003 Ericsson Research Canada
       4                 :  * Copyright (c) 2003 OSDL, Inc.
       5                 :  *
       6                 :  * This file is based on the original source code done by Jon Maloy
       7                 :  * (jon.maloy@ericsson.com) for TIPC version 0.96, available from
       8                 :  * http://tipc.sourceforge.net
       9                 :  ***************************************************************************
      10                 :  * This program is free software; you can redistribute it and/or modify
      11                 :  * it under the terms of the GNU General Public License as published by
      12                 :  * the Free Software Foundation; either version 2 of the License, or
      13                 :  * (at your option) any later version.
      14                 :  *   
      15                 :  * This program is distributed in the hope that it will be useful,
      16                 :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      17                 :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      18                 :  * GNU General Public License for more details.
      19                 :  *  
      20                 :  * You should have received a copy of the GNU General Public License
      21                 :  * along with this program; if not, write to the Free Software
      22                 :  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      23                 :  ***************************************************************************
      24                 :  * Alphabetical list of people who have worked on this file:
      25                 :  *      - Mark Haverkamp        (markh@osdl.org)
      26                 :  *      - Mika Kukkonen         (mika@osdl.org)
      27                 :  *      - Rusty Lynch           (rusty@linux.intel.com)
      28                 :  */
      29                 : 
      30                 : #ifndef __NET_TIPC_LOCAL_H_
      31                 : #define __NET_TIPC_LOCAL_H_
      32                 : 
      33                 : #include <linux/types.h>
      34                 : #include <linux/list.h>
      35                 : 
      36                 : #include <net/tipc.h>
      37                 : 
      38                 : #include "net_addr.h"
      39                 : #include "net_event.h"
      40                 : #include "network.h"
      41                 : #include "cluster.h"
      42                 : #include "node.h"
      43                 : #include "zone.h"
      44                 : 
      45                 : struct tipc_local_network {
      46                 :         uint zone_count;
      47                 :         struct net_reg reg;
      48                 :         struct tipc_zone *zones[TIPC_ZONE_AMOUNT];
      49                 :         struct hlist_head lookup[TIPC_NET_HASH_SIZE];
      50                 : };
      51                 : 
      52                 : extern struct tipc_local_network tipc_my_network;
      53                 : 
      54                 : struct tipc_local_zone {
      55                 :         uint id;
      56                 :         struct tipc_zone rep;
      57                 :         uint cluster_count;
      58                 :         struct tipc_cluster *clusters[TIPC_CLUSTER_AMOUNT];
      59                 : };
      60                 : 
      61                 : extern struct tipc_local_zone tipc_my_zone;
      62                 : 
      63                 : struct tipc_local_cluster {
      64                 :         uint id;
      65                 :         struct tipc_cluster rep;
      66                 :         uint node_count;
      67                 :         struct tipc_node *nodes[TIPC_NODE_AMOUNT];
      68                 : };
      69                 : 
      70                 : extern struct tipc_local_cluster tipc_my_cluster;
      71                 : 
      72                 : struct tipc_local_node {
      73                 :         uint id;
      74                 :         struct tipc_node rep;
      75                 :         uint link_count;
      76                 : };
      77                 : 
      78                 : extern struct tipc_local_node tipc_my_node;
      79                 : 
      80                 : extern int tipc_my_network_init(uint my_zone_id, uint my_cluster_id, uint my_node_id);
      81                 : extern void tipc_my_network_exit(void);
      82                 : 
      83                 : static inline int
      84                 : tipc_local_addr(tipc_net_addr_t addr)
      85          962884 : {
      86          481445 :         if (tipc_zone_id(addr) != tipc_my_zone.id)
      87                 :                 return 0;
      88          962884 :         if (tipc_cluster_id(addr) != tipc_my_cluster.id)
      89                 :                 return 0;
      90                 :         return 1;
      91                 : }
      92                 : 
      93                 : static inline Link *
      94                 : link_find(const tipc_net_addr_t addr, const uint media_id)
      95         1341342 : {
      96          447122 :         struct tipc_node *node;
      97                 : 
      98          447122 :         if (tipc_local_addr(addr))
      99          447122 :                 node = localnodes[tipc_node_id(addr)];
     100               0 :         else if (network.zones[tipc_zone_id(addr)]->clusters[1])
     101               0 :                 node = network.zones[tipc_zone_id(addr)]->clusters[1]
     102                 :                     ->nodes[tipc_node_id(addr)];
     103                 :         else
     104                 :                 return 0;
     105                 :         return node ? node->links[media_id] : (Link *) 0;
     106                 : }
     107                 : 
     108                 : #endif /* __NET_TIPC_LOCAL_H_ */

Generated by: LTP GCOV extension version 1.1