diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-08 03:19:09 -0500 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:08 -0500 |
| commit | 3e6c8cd5669c1202fe806ce3e13d701f20a71c7e (patch) | |
| tree | d7412c66923db0093472215cfe352e66d7214ac1 /net/tipc | |
| parent | d54a81d341af80875c201890500f727c8188dd9b (diff) | |
[TIPC]: endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
| -rw-r--r-- | net/tipc/config.c | 32 | ||||
| -rw-r--r-- | net/tipc/dbg.c | 3 | ||||
| -rw-r--r-- | net/tipc/name_distr.c | 10 | ||||
| -rw-r--r-- | net/tipc/node.c | 9 |
4 files changed, 20 insertions, 34 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c index ed1351ed05e1..458a2c46cef3 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
| @@ -107,7 +107,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, | |||
| 107 | struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) | 107 | struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) |
| 108 | { | 108 | { |
| 109 | struct sk_buff *buf; | 109 | struct sk_buff *buf; |
| 110 | u32 value_net; | 110 | __be32 value_net; |
| 111 | 111 | ||
| 112 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); | 112 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); |
| 113 | if (buf) { | 113 | if (buf) { |
| @@ -284,8 +284,7 @@ static struct sk_buff *cfg_set_own_addr(void) | |||
| 284 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 284 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
| 285 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 285 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 286 | 286 | ||
| 287 | addr = *(u32 *)TLV_DATA(req_tlv_area); | 287 | addr = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 288 | addr = ntohl(addr); | ||
| 289 | if (addr == tipc_own_addr) | 288 | if (addr == tipc_own_addr) |
| 290 | return tipc_cfg_reply_none(); | 289 | return tipc_cfg_reply_none(); |
| 291 | if (!tipc_addr_node_valid(addr)) | 290 | if (!tipc_addr_node_valid(addr)) |
| @@ -319,8 +318,7 @@ static struct sk_buff *cfg_set_remote_mng(void) | |||
| 319 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 318 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 320 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 319 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 321 | 320 | ||
| 322 | value = *(u32 *)TLV_DATA(req_tlv_area); | 321 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 323 | value = ntohl(value); | ||
| 324 | tipc_remote_management = (value != 0); | 322 | tipc_remote_management = (value != 0); |
| 325 | return tipc_cfg_reply_none(); | 323 | return tipc_cfg_reply_none(); |
| 326 | } | 324 | } |
| @@ -332,8 +330,7 @@ static struct sk_buff *cfg_set_max_publications(void) | |||
| 332 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 330 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 333 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 331 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 334 | 332 | ||
| 335 | value = *(u32 *)TLV_DATA(req_tlv_area); | 333 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 336 | value = ntohl(value); | ||
| 337 | if (value != delimit(value, 1, 65535)) | 334 | if (value != delimit(value, 1, 65535)) |
| 338 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 335 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 339 | " (max publications must be 1-65535)"); | 336 | " (max publications must be 1-65535)"); |
| @@ -348,8 +345,7 @@ static struct sk_buff *cfg_set_max_subscriptions(void) | |||
| 348 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 345 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 349 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 346 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 350 | 347 | ||
| 351 | value = *(u32 *)TLV_DATA(req_tlv_area); | 348 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 352 | value = ntohl(value); | ||
| 353 | if (value != delimit(value, 1, 65535)) | 349 | if (value != delimit(value, 1, 65535)) |
| 354 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 350 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 355 | " (max subscriptions must be 1-65535"); | 351 | " (max subscriptions must be 1-65535"); |
| @@ -363,8 +359,7 @@ static struct sk_buff *cfg_set_max_ports(void) | |||
| 363 | 359 | ||
| 364 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 360 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 365 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 361 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 366 | value = *(u32 *)TLV_DATA(req_tlv_area); | 362 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 367 | value = ntohl(value); | ||
| 368 | if (value == tipc_max_ports) | 363 | if (value == tipc_max_ports) |
| 369 | return tipc_cfg_reply_none(); | 364 | return tipc_cfg_reply_none(); |
| 370 | if (value != delimit(value, 127, 65535)) | 365 | if (value != delimit(value, 127, 65535)) |
| @@ -383,8 +378,7 @@ static struct sk_buff *cfg_set_max_zones(void) | |||
| 383 | 378 | ||
| 384 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 379 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 385 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 380 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 386 | value = *(u32 *)TLV_DATA(req_tlv_area); | 381 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 387 | value = ntohl(value); | ||
| 388 | if (value == tipc_max_zones) | 382 | if (value == tipc_max_zones) |
| 389 | return tipc_cfg_reply_none(); | 383 | return tipc_cfg_reply_none(); |
| 390 | if (value != delimit(value, 1, 255)) | 384 | if (value != delimit(value, 1, 255)) |
| @@ -403,8 +397,7 @@ static struct sk_buff *cfg_set_max_clusters(void) | |||
| 403 | 397 | ||
| 404 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 398 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 405 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 399 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 406 | value = *(u32 *)TLV_DATA(req_tlv_area); | 400 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 407 | value = ntohl(value); | ||
| 408 | if (value != delimit(value, 1, 1)) | 401 | if (value != delimit(value, 1, 1)) |
| 409 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 402 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 410 | " (max clusters fixed at 1)"); | 403 | " (max clusters fixed at 1)"); |
| @@ -417,8 +410,7 @@ static struct sk_buff *cfg_set_max_nodes(void) | |||
| 417 | 410 | ||
| 418 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 411 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 419 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 412 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 420 | value = *(u32 *)TLV_DATA(req_tlv_area); | 413 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 421 | value = ntohl(value); | ||
| 422 | if (value == tipc_max_nodes) | 414 | if (value == tipc_max_nodes) |
| 423 | return tipc_cfg_reply_none(); | 415 | return tipc_cfg_reply_none(); |
| 424 | if (value != delimit(value, 8, 2047)) | 416 | if (value != delimit(value, 8, 2047)) |
| @@ -437,8 +429,7 @@ static struct sk_buff *cfg_set_max_slaves(void) | |||
| 437 | 429 | ||
| 438 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 430 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 439 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 431 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 440 | value = *(u32 *)TLV_DATA(req_tlv_area); | 432 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 441 | value = ntohl(value); | ||
| 442 | if (value != 0) | 433 | if (value != 0) |
| 443 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 434 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 444 | " (max secondary nodes fixed at 0)"); | 435 | " (max secondary nodes fixed at 0)"); |
| @@ -451,8 +442,7 @@ static struct sk_buff *cfg_set_netid(void) | |||
| 451 | 442 | ||
| 452 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 443 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 453 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 444 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 454 | value = *(u32 *)TLV_DATA(req_tlv_area); | 445 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 455 | value = ntohl(value); | ||
| 456 | if (value == tipc_net_id) | 446 | if (value == tipc_net_id) |
| 457 | return tipc_cfg_reply_none(); | 447 | return tipc_cfg_reply_none(); |
| 458 | if (value != delimit(value, 1, 9999)) | 448 | if (value != delimit(value, 1, 9999)) |
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index d8af4c28695d..627f99b7afdf 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c | |||
| @@ -393,8 +393,7 @@ struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space) | |||
| 393 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 393 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
| 394 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 394 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 395 | 395 | ||
| 396 | value = *(u32 *)TLV_DATA(req_tlv_area); | 396 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 397 | value = ntohl(value); | ||
| 398 | if (value != delimit(value, 0, 32768)) | 397 | if (value != delimit(value, 0, 32768)) |
| 399 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 398 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 400 | " (log size must be 0-32768)"); | 399 | " (log size must be 0-32768)"); |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 03bd659c43ca..7bf87cb26ef3 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
| @@ -66,11 +66,11 @@ | |||
| 66 | */ | 66 | */ |
| 67 | 67 | ||
| 68 | struct distr_item { | 68 | struct distr_item { |
| 69 | u32 type; | 69 | __be32 type; |
| 70 | u32 lower; | 70 | __be32 lower; |
| 71 | u32 upper; | 71 | __be32 upper; |
| 72 | u32 ref; | 72 | __be32 ref; |
| 73 | u32 key; | 73 | __be32 key; |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | /** | 76 | /** |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 886bda5e88db..106cd0dfac78 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
| @@ -597,8 +597,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
| 597 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 597 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
| 598 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 598 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 599 | 599 | ||
| 600 | domain = *(u32 *)TLV_DATA(req_tlv_area); | 600 | domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 601 | domain = ntohl(domain); | ||
| 602 | if (!tipc_addr_domain_valid(domain)) | 601 | if (!tipc_addr_domain_valid(domain)) |
| 603 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 602 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 604 | " (network address)"); | 603 | " (network address)"); |
| @@ -642,8 +641,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
| 642 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 641 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
| 643 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 642 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 644 | 643 | ||
| 645 | domain = *(u32 *)TLV_DATA(req_tlv_area); | 644 | domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 646 | domain = ntohl(domain); | ||
| 647 | if (!tipc_addr_domain_valid(domain)) | 645 | if (!tipc_addr_domain_valid(domain)) |
| 648 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 646 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 649 | " (network address)"); | 647 | " (network address)"); |
| @@ -664,8 +662,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
| 664 | 662 | ||
| 665 | /* Add TLV for broadcast link */ | 663 | /* Add TLV for broadcast link */ |
| 666 | 664 | ||
| 667 | link_info.dest = tipc_own_addr & 0xfffff00; | 665 | link_info.dest = htonl(tipc_own_addr & 0xfffff00); |
| 668 | link_info.dest = htonl(link_info.dest); | ||
| 669 | link_info.up = htonl(1); | 666 | link_info.up = htonl(1); |
| 670 | sprintf(link_info.str, tipc_bclink_name); | 667 | sprintf(link_info.str, tipc_bclink_name); |
| 671 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); | 668 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); |
