Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[TIPC]: endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Al Viro and committed by
David S. Miller
3e6c8cd5 d54a81d3

+38 -52
+16 -16
include/linux/tipc_config.h
··· 194 194 195 195 196 196 struct tipc_node_info { 197 - __u32 addr; /* network address of node */ 198 - __u32 up; /* 0=down, 1= up */ 197 + __be32 addr; /* network address of node */ 198 + __be32 up; /* 0=down, 1= up */ 199 199 }; 200 200 201 201 struct tipc_link_info { 202 - __u32 dest; /* network address of peer node */ 203 - __u32 up; /* 0=down, 1=up */ 202 + __be32 dest; /* network address of peer node */ 203 + __be32 up; /* 0=down, 1=up */ 204 204 char str[TIPC_MAX_LINK_NAME]; /* link name */ 205 205 }; 206 206 207 207 struct tipc_bearer_config { 208 - __u32 priority; /* Range [1,31]. Override per link */ 209 - __u32 detect_scope; 208 + __be32 priority; /* Range [1,31]. Override per link */ 209 + __be32 detect_scope; 210 210 char name[TIPC_MAX_BEARER_NAME]; 211 211 }; 212 212 213 213 struct tipc_link_config { 214 - __u32 value; 214 + __be32 value; 215 215 char name[TIPC_MAX_LINK_NAME]; 216 216 }; 217 217 218 218 #define TIPC_NTQ_ALLTYPES 0x80000000 219 219 220 220 struct tipc_name_table_query { 221 - __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ 222 - __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ 223 - __u32 lowbound; /* (i.e. displays all entries of name table) */ 224 - __u32 upbound; 221 + __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ 222 + __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ 223 + __be32 lowbound; /* (i.e. displays all entries of name table) */ 224 + __be32 upbound; 225 225 }; 226 226 227 227 /* ··· 262 262 */ 263 263 264 264 struct tlv_desc { 265 - __u16 tlv_len; /* TLV length (descriptor + value) */ 266 - __u16 tlv_type; /* TLV identifier */ 265 + __be16 tlv_len; /* TLV length (descriptor + value) */ 266 + __be16 tlv_type; /* TLV identifier */ 267 267 }; 268 268 269 269 #define TLV_ALIGNTO 4 ··· 377 377 378 378 struct tipc_cfg_msg_hdr 379 379 { 380 - __u32 tcm_len; /* Message length (including header) */ 381 - __u16 tcm_type; /* Command type */ 382 - __u16 tcm_flags; /* Additional flags */ 380 + __be32 tcm_len; /* Message length (including header) */ 381 + __be16 tcm_type; /* Command type */ 382 + __be16 tcm_flags; /* Additional flags */ 383 383 char tcm_reserved[8]; /* Unused */ 384 384 }; 385 385
+1 -1
include/net/tipc/tipc_bearer.h
··· 58 58 */ 59 59 60 60 struct tipc_media_addr { 61 - __u32 type; /* bearer type (network byte order) */ 61 + __be32 type; /* bearer type (network byte order) */ 62 62 union { 63 63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ 64 64 #if 0
+1 -1
include/net/tipc/tipc_msg.h
··· 40 40 #ifdef __KERNEL__ 41 41 42 42 struct tipc_msg { 43 - u32 hdr[15]; 43 + __be32 hdr[15]; 44 44 }; 45 45 46 46
+11 -21
net/tipc/config.c
··· 107 107 struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) 108 108 { 109 109 struct sk_buff *buf; 110 - u32 value_net; 110 + __be32 value_net; 111 111 112 112 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); 113 113 if (buf) { ··· 284 284 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 285 285 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 286 286 287 - addr = *(u32 *)TLV_DATA(req_tlv_area); 288 - addr = ntohl(addr); 287 + addr = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 289 288 if (addr == tipc_own_addr) 290 289 return tipc_cfg_reply_none(); 291 290 if (!tipc_addr_node_valid(addr)) ··· 318 319 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 319 320 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 320 321 321 - value = *(u32 *)TLV_DATA(req_tlv_area); 322 - value = ntohl(value); 322 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 323 323 tipc_remote_management = (value != 0); 324 324 return tipc_cfg_reply_none(); 325 325 } ··· 330 332 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 331 333 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 332 334 333 - value = *(u32 *)TLV_DATA(req_tlv_area); 334 - value = ntohl(value); 335 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 335 336 if (value != delimit(value, 1, 65535)) 336 337 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 337 338 " (max publications must be 1-65535)"); ··· 345 348 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 346 349 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 347 350 348 - value = *(u32 *)TLV_DATA(req_tlv_area); 349 - value = ntohl(value); 351 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 350 352 if (value != delimit(value, 1, 65535)) 351 353 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 352 354 " (max subscriptions must be 1-65535"); ··· 359 363 360 364 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 361 365 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 362 - value = *(u32 *)TLV_DATA(req_tlv_area); 363 - value = ntohl(value); 366 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 364 367 if (value == tipc_max_ports) 365 368 return tipc_cfg_reply_none(); 366 369 if (value != delimit(value, 127, 65535)) ··· 378 383 379 384 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 380 385 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 381 - value = *(u32 *)TLV_DATA(req_tlv_area); 382 - value = ntohl(value); 386 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 383 387 if (value == tipc_max_zones) 384 388 return tipc_cfg_reply_none(); 385 389 if (value != delimit(value, 1, 255)) ··· 397 403 398 404 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 399 405 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 400 - value = *(u32 *)TLV_DATA(req_tlv_area); 401 - value = ntohl(value); 406 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 402 407 if (value != delimit(value, 1, 1)) 403 408 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 404 409 " (max clusters fixed at 1)"); ··· 410 417 411 418 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 412 419 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 413 - value = *(u32 *)TLV_DATA(req_tlv_area); 414 - value = ntohl(value); 420 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 415 421 if (value == tipc_max_nodes) 416 422 return tipc_cfg_reply_none(); 417 423 if (value != delimit(value, 8, 2047)) ··· 429 437 430 438 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 431 439 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 432 - value = *(u32 *)TLV_DATA(req_tlv_area); 433 - value = ntohl(value); 440 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 434 441 if (value != 0) 435 442 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 436 443 " (max secondary nodes fixed at 0)"); ··· 442 451 443 452 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 444 453 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 445 - value = *(u32 *)TLV_DATA(req_tlv_area); 446 - value = ntohl(value); 454 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 447 455 if (value == tipc_net_id) 448 456 return tipc_cfg_reply_none(); 449 457 if (value != delimit(value, 1, 9999))
+1 -2
net/tipc/dbg.c
··· 393 393 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 394 394 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 395 395 396 - value = *(u32 *)TLV_DATA(req_tlv_area); 397 - value = ntohl(value); 396 + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 398 397 if (value != delimit(value, 0, 32768)) 399 398 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 400 399 " (log size must be 0-32768)");
+5 -5
net/tipc/name_distr.c
··· 66 66 */ 67 67 68 68 struct distr_item { 69 - u32 type; 70 - u32 lower; 71 - u32 upper; 72 - u32 ref; 73 - u32 key; 69 + __be32 type; 70 + __be32 lower; 71 + __be32 upper; 72 + __be32 ref; 73 + __be32 key; 74 74 }; 75 75 76 76 /**
+3 -6
net/tipc/node.c
··· 597 597 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 598 598 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 599 599 600 - domain = *(u32 *)TLV_DATA(req_tlv_area); 601 - domain = ntohl(domain); 600 + domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 602 601 if (!tipc_addr_domain_valid(domain)) 603 602 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 604 603 " (network address)"); ··· 641 642 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 642 643 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 643 644 644 - domain = *(u32 *)TLV_DATA(req_tlv_area); 645 - domain = ntohl(domain); 645 + domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 646 646 if (!tipc_addr_domain_valid(domain)) 647 647 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 648 648 " (network address)"); ··· 662 664 663 665 /* Add TLV for broadcast link */ 664 666 665 - link_info.dest = tipc_own_addr & 0xfffff00; 666 - link_info.dest = htonl(link_info.dest); 667 + link_info.dest = htonl(tipc_own_addr & 0xfffff00); 667 668 link_info.up = htonl(1); 668 669 sprintf(link_info.str, tipc_bclink_name); 669 670 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));