diff options
-rw-r--r-- | net/tipc/addr.c | 32 | ||||
-rw-r--r-- | net/tipc/addr.h | 37 |
2 files changed, 35 insertions, 34 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) | |||
92 | return (tipc_addr_domain_valid(addr) && tipc_node(addr)); | 92 | return (tipc_addr_domain_valid(addr) && tipc_node(addr)); |
93 | } | 93 | } |
94 | 94 | ||
95 | int tipc_in_scope(u32 domain, u32 addr) | ||
96 | { | ||
97 | if (!domain || (domain == addr)) | ||
98 | return 1; | ||
99 | if (domain == (addr & 0xfffff000u)) /* domain <Z.C.0> */ | ||
100 | return 1; | ||
101 | if (domain == (addr & 0xff000000u)) /* domain <Z.0.0> */ | ||
102 | return 1; | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * tipc_addr_scope - convert message lookup domain to a 2-bit scope value | ||
108 | */ | ||
109 | |||
110 | int tipc_addr_scope(u32 domain) | ||
111 | { | ||
112 | if (likely(!domain)) | ||
113 | return TIPC_ZONE_SCOPE; | ||
114 | if (tipc_node(domain)) | ||
115 | return TIPC_NODE_SCOPE; | ||
116 | if (tipc_cluster(domain)) | ||
117 | return TIPC_CLUSTER_SCOPE; | ||
118 | return TIPC_ZONE_SCOPE; | ||
119 | } | ||
120 | |||
121 | char *tipc_addr_string_fill(char *string, u32 addr) | ||
122 | { | ||
123 | snprintf(string, 16, "<%u.%u.%u>", | ||
124 | tipc_zone(addr), tipc_cluster(addr), tipc_node(addr)); | ||
125 | return string; | ||
126 | } | ||
diff --git a/net/tipc/addr.h b/net/tipc/addr.h index 4d4aee0e4232..c1cc5724d8cc 100644 --- a/net/tipc/addr.h +++ b/net/tipc/addr.h | |||
@@ -67,32 +67,6 @@ static inline int may_route(u32 addr) | |||
67 | return(addr ^ tipc_own_addr) >> 11; | 67 | return(addr ^ tipc_own_addr) >> 11; |
68 | } | 68 | } |
69 | 69 | ||
70 | static inline int tipc_in_scope(u32 domain, u32 addr) | ||
71 | { | ||
72 | if (!domain || (domain == addr)) | ||
73 | return 1; | ||
74 | if (domain == (addr & 0xfffff000u)) /* domain <Z.C.0> */ | ||
75 | return 1; | ||
76 | if (domain == (addr & 0xff000000u)) /* domain <Z.0.0> */ | ||
77 | return 1; | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | /** | ||
82 | * tipc_addr_scope - convert message lookup domain to a 2-bit scope value | ||
83 | */ | ||
84 | |||
85 | static inline int tipc_addr_scope(u32 domain) | ||
86 | { | ||
87 | if (likely(!domain)) | ||
88 | return TIPC_ZONE_SCOPE; | ||
89 | if (tipc_node(domain)) | ||
90 | return TIPC_NODE_SCOPE; | ||
91 | if (tipc_cluster(domain)) | ||
92 | return TIPC_CLUSTER_SCOPE; | ||
93 | return TIPC_ZONE_SCOPE; | ||
94 | } | ||
95 | |||
96 | /** | 70 | /** |
97 | * addr_domain - convert 2-bit scope value to equivalent message lookup domain | 71 | * addr_domain - convert 2-bit scope value to equivalent message lookup domain |
98 | * | 72 | * |
@@ -110,14 +84,9 @@ static inline int addr_domain(int sc) | |||
110 | return tipc_addr(tipc_zone(tipc_own_addr), 0, 0); | 84 | return tipc_addr(tipc_zone(tipc_own_addr), 0, 0); |
111 | } | 85 | } |
112 | 86 | ||
113 | static inline char *tipc_addr_string_fill(char *string, u32 addr) | ||
114 | { | ||
115 | snprintf(string, 16, "<%u.%u.%u>", | ||
116 | tipc_zone(addr), tipc_cluster(addr), tipc_node(addr)); | ||
117 | return string; | ||
118 | } | ||
119 | |||
120 | int tipc_addr_domain_valid(u32); | 87 | int tipc_addr_domain_valid(u32); |
121 | int tipc_addr_node_valid(u32 addr); | 88 | int tipc_addr_node_valid(u32 addr); |
122 | 89 | int tipc_in_scope(u32 domain, u32 addr); | |
90 | int tipc_addr_scope(u32 domain); | ||
91 | char *tipc_addr_string_fill(char *string, u32 addr); | ||
123 | #endif | 92 | #endif |