diff options
Diffstat (limited to 'include/uapi/linux/tipc.h')
| -rw-r--r-- | include/uapi/linux/tipc.h | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h index 14bacc7e6cef..4ac9f1f02b06 100644 --- a/include/uapi/linux/tipc.h +++ b/include/uapi/linux/tipc.h | |||
| @@ -61,50 +61,6 @@ struct tipc_name_seq { | |||
| 61 | __u32 upper; | 61 | __u32 upper; |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 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 | |||
| 108 | /* | 64 | /* |
| 109 | * Application-accessible port name types | 65 | * Application-accessible port name types |
| 110 | */ | 66 | */ |
| @@ -117,9 +73,10 @@ static inline unsigned int tipc_node(__u32 addr) | |||
| 117 | /* | 73 | /* |
| 118 | * Publication scopes when binding port names and port name sequences | 74 | * Publication scopes when binding port names and port name sequences |
| 119 | */ | 75 | */ |
| 120 | #define TIPC_ZONE_SCOPE 1 | 76 | enum tipc_scope { |
| 121 | #define TIPC_CLUSTER_SCOPE 2 | 77 | TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */ |
| 122 | #define TIPC_NODE_SCOPE 3 | 78 | TIPC_NODE_SCOPE = 3 |
| 79 | }; | ||
| 123 | 80 | ||
| 124 | /* | 81 | /* |
| 125 | * Limiting values for messages | 82 | * Limiting values for messages |
| @@ -243,7 +200,7 @@ struct sockaddr_tipc { | |||
| 243 | struct tipc_group_req { | 200 | struct tipc_group_req { |
| 244 | __u32 type; /* group id */ | 201 | __u32 type; /* group id */ |
| 245 | __u32 instance; /* member id */ | 202 | __u32 instance; /* member id */ |
| 246 | __u32 scope; /* zone/cluster/node */ | 203 | __u32 scope; /* cluster/node */ |
| 247 | __u32 flags; | 204 | __u32 flags; |
| 248 | }; | 205 | }; |
| 249 | 206 | ||
| @@ -268,4 +225,53 @@ struct tipc_sioc_ln_req { | |||
| 268 | __u32 bearer_id; | 225 | __u32 bearer_id; |
| 269 | char linkname[TIPC_MAX_LINK_NAME]; | 226 | char linkname[TIPC_MAX_LINK_NAME]; |
| 270 | }; | 227 | }; |
| 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 | |||
| 271 | #endif | 277 | #endif |
