diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2010-05-11 16:30:13 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-13 08:02:26 +0200 |
commit | 80e0c33064bd71bd5791c79f28c59a1aee898993 (patch) | |
tree | 867783e6eef562e8a89b48404e4c652a732a2e23 /net/tipc/addr.c | |
parent | tipc: add tipc_ prefix to fcns targeted for un-inlining (diff) | |
download | linux-80e0c33064bd71bd5791c79f28c59a1aee898993.tar.xz linux-80e0c33064bd71bd5791c79f28c59a1aee898993.zip |
tipc: Reduce footprint by un-inlining address routines
Convert address-related inline routines that are more than one
line into standard functions, thereby eliminating a significant
amount of repeated code.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/addr.c')
-rw-r--r-- | net/tipc/addr.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c index e5207a11edf6..c048543ffbeb 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c @@ -92,3 +92,35 @@ int tipc_addr_node_valid(u32 addr) return (tipc_addr_domain_valid(addr) && tipc_node(addr)); } +int tipc_in_scope(u32 domain, u32 addr) +{ + if (!domain || (domain == addr)) + return 1; + if (domain == (addr & 0xfffff000u)) /* domain <Z.C.0> */ + return 1; + if (domain == (addr & 0xff000000u)) /* domain <Z.0.0> */ + return 1; + return 0; +} + +/** + * tipc_addr_scope - convert message lookup domain to a 2-bit scope value + */ + +int tipc_addr_scope(u32 domain) +{ + if (likely(!domain)) + return TIPC_ZONE_SCOPE; + if (tipc_node(domain)) + return TIPC_NODE_SCOPE; + if (tipc_cluster(domain)) + return TIPC_CLUSTER_SCOPE; + return TIPC_ZONE_SCOPE; +} + +char *tipc_addr_string_fill(char *string, u32 addr) +{ + snprintf(string, 16, "<%u.%u.%u>", + tipc_zone(addr), tipc_cluster(addr), tipc_node(addr)); + return string; +} |