History

tipc: obsolete TIPC_ZONE_SCOPE

Publications for TIPC_CLUSTER_SCOPE and TIPC_ZONE_SCOPE are in all aspects handled the same way, both on the publishing node and on the receiving nodes. Despite previous ambitions to the contrary, this is never going to change, so we take the conseqeunce of this and obsolete TIPC_ZONE_SCOPE and related macros/functions. Whenever a user is doing a bind() or a sendmsg() attempt using ZONE_SCOPE we translate this internally to CLUSTER_SCOPE, while we remain compatible with users and remote nodes still using ZONE_SCOPE. Furthermore, the non-formalized scope value 0 has always been permitted for use during lookup, with the same meaning as ZONE_SCOPE/CLUSTER_SCOPE. We now permit it even as binding scope, but for compatibility reasons we choose to not change the value of TIPC_CLUSTER_SCOPE.

Jon Maloy committed 8 years ago

Commit 928df181 parent 4f1aec07 files · +77 −88Browse files

Showing the changes to include/uapi/linux (1 of 7 files). Show all

Unified · Split

include/uapi/linux/tipc.h+54−48
@@ -61,50 +61,6 @@ struct tipc_name_seq { · 60 unmodified lines
6161 __u32 upper;
6262 };
6363
64−/* TIPC Address Size, Offset, Mask specification for Z.C.N
65− */
66−#define TIPC_NODE_BITS 12
67−#define TIPC_CLUSTER_BITS 12
68−#define TIPC_ZONE_BITS 8
69−
70−#define TIPC_NODE_OFFSET 0
71−#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
72−#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
73−
74−#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
75−#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
76−#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
77−
78−#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
79−#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
80−#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
81−
82−#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
83−
84−static inline __u32 tipc_addr(unsigned int zone,
85− unsigned int cluster,
86− unsigned int node)
87−{
88− return (zone << TIPC_ZONE_OFFSET) |
89− (cluster << TIPC_CLUSTER_OFFSET) |
90− node;
91−}
92−
93−static inline unsigned int tipc_zone(__u32 addr)
94−{
95− return addr >> TIPC_ZONE_OFFSET;
96−}
97−
98−static inline unsigned int tipc_cluster(__u32 addr)
99−{
100− return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
101−}
102−
103−static inline unsigned int tipc_node(__u32 addr)
104−{
105− return addr & TIPC_NODE_MASK;
106−}
107−
10864 /*
10965 * Application-accessible port name types
11066 */
@@ -117,9 +73,10 @@ static inline unsigned int tipc_node(__u32 addr) · 6 unmodified lines
11773 /*
11874 * Publication scopes when binding port names and port name sequences
11975 */
120−#define TIPC_ZONE_SCOPE 1
121−#define TIPC_CLUSTER_SCOPE 2
122−#define TIPC_NODE_SCOPE 3
76+enum tipc_scope {
77+ TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */
78+ TIPC_NODE_SCOPE = 3
79+};
12380
12481 /*
12582 * Limiting values for messages
@@ -243,7 +200,7 @@ struct sockaddr_tipc { · 117 unmodified lines
243200 struct tipc_group_req {
244201 __u32 type; /* group id */
245202 __u32 instance; /* member id */
246− __u32 scope; /* zone/cluster/node */
203+ __u32 scope; /* cluster/node */
247204 __u32 flags;
248205 };
249206
@@ -268,4 +225,53 @@ struct tipc_sioc_ln_req { · 18 unmodified lines
268225 __u32 bearer_id;
269226 char linkname[TIPC_MAX_LINK_NAME];
270227 };
228+
229+
230+/* The macros and functions below are deprecated:
231+ */
232+
233+#define TIPC_ZONE_SCOPE 1
234+
235+#define TIPC_NODE_BITS 12
236+#define TIPC_CLUSTER_BITS 12
237+#define TIPC_ZONE_BITS 8
238+
239+#define TIPC_NODE_OFFSET 0
240+#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS
241+#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)
242+
243+#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1)
244+#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1)
245+#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1)
246+
247+#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
248+#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
249+#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)
250+
251+#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)
252+
253+static inline __u32 tipc_addr(unsigned int zone,
254+ unsigned int cluster,
255+ unsigned int node)
256+{
257+ return (zone << TIPC_ZONE_OFFSET) |
258+ (cluster << TIPC_CLUSTER_OFFSET) |
259+ node;
260+}
261+
262+static inline unsigned int tipc_zone(__u32 addr)
263+{
264+ return addr >> TIPC_ZONE_OFFSET;
265+}
266+
267+static inline unsigned int tipc_cluster(__u32 addr)
268+{
269+ return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
270+}
271+
272+static inline unsigned int tipc_node(__u32 addr)
273+{
274+ return addr & TIPC_NODE_MASK;
275+}
276+
271277 #endif