[TIPC]: endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Al Viro 2006-11-08 00:19:09 -08:00 committed by David S. Miller
parent d54a81d341
commit 3e6c8cd566
7 changed files with 38 additions and 52 deletions

View File

@ -194,34 +194,34 @@
struct tipc_node_info {
__u32 addr; /* network address of node */
__u32 up; /* 0=down, 1= up */
__be32 addr; /* network address of node */
__be32 up; /* 0=down, 1= up */
};
struct tipc_link_info {
__u32 dest; /* network address of peer node */
__u32 up; /* 0=down, 1=up */
__be32 dest; /* network address of peer node */
__be32 up; /* 0=down, 1=up */
char str[TIPC_MAX_LINK_NAME]; /* link name */
};
struct tipc_bearer_config {
__u32 priority; /* Range [1,31]. Override per link */
__u32 detect_scope;
__be32 priority; /* Range [1,31]. Override per link */
__be32 detect_scope;
char name[TIPC_MAX_BEARER_NAME];
};
struct tipc_link_config {
__u32 value;
__be32 value;
char name[TIPC_MAX_LINK_NAME];
};
#define TIPC_NTQ_ALLTYPES 0x80000000
struct tipc_name_table_query {
__u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
__u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
__u32 lowbound; /* (i.e. displays all entries of name table) */
__u32 upbound;
__be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
__be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
__be32 lowbound; /* (i.e. displays all entries of name table) */
__be32 upbound;
};
/*
@ -262,8 +262,8 @@ struct tipc_route_info {
*/
struct tlv_desc {
__u16 tlv_len; /* TLV length (descriptor + value) */
__u16 tlv_type; /* TLV identifier */
__be16 tlv_len; /* TLV length (descriptor + value) */
__be16 tlv_type; /* TLV identifier */
};
#define TLV_ALIGNTO 4
@ -377,9 +377,9 @@ struct tipc_genlmsghdr {
struct tipc_cfg_msg_hdr
{
__u32 tcm_len; /* Message length (including header) */
__u16 tcm_type; /* Command type */
__u16 tcm_flags; /* Additional flags */
__be32 tcm_len; /* Message length (including header) */
__be16 tcm_type; /* Command type */
__be16 tcm_flags; /* Additional flags */
char tcm_reserved[8]; /* Unused */
};

View File

@ -58,7 +58,7 @@
*/
struct tipc_media_addr {
__u32 type; /* bearer type (network byte order) */
__be32 type; /* bearer type (network byte order) */
union {
__u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */
#if 0

View File

@ -40,7 +40,7 @@
#ifdef __KERNEL__
struct tipc_msg {
u32 hdr[15];
__be32 hdr[15];
};

View File

@ -107,7 +107,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
{
struct sk_buff *buf;
u32 value_net;
__be32 value_net;
buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value)));
if (buf) {
@ -284,8 +284,7 @@ static struct sk_buff *cfg_set_own_addr(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
addr = *(u32 *)TLV_DATA(req_tlv_area);
addr = ntohl(addr);
addr = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (addr == tipc_own_addr)
return tipc_cfg_reply_none();
if (!tipc_addr_node_valid(addr))
@ -319,8 +318,7 @@ static struct sk_buff *cfg_set_remote_mng(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
tipc_remote_management = (value != 0);
return tipc_cfg_reply_none();
}
@ -332,8 +330,7 @@ static struct sk_buff *cfg_set_max_publications(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value != delimit(value, 1, 65535))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max publications must be 1-65535)");
@ -348,8 +345,7 @@ static struct sk_buff *cfg_set_max_subscriptions(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value != delimit(value, 1, 65535))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max subscriptions must be 1-65535");
@ -363,8 +359,7 @@ static struct sk_buff *cfg_set_max_ports(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value == tipc_max_ports)
return tipc_cfg_reply_none();
if (value != delimit(value, 127, 65535))
@ -383,8 +378,7 @@ static struct sk_buff *cfg_set_max_zones(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value == tipc_max_zones)
return tipc_cfg_reply_none();
if (value != delimit(value, 1, 255))
@ -403,8 +397,7 @@ static struct sk_buff *cfg_set_max_clusters(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value != delimit(value, 1, 1))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max clusters fixed at 1)");
@ -417,8 +410,7 @@ static struct sk_buff *cfg_set_max_nodes(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value == tipc_max_nodes)
return tipc_cfg_reply_none();
if (value != delimit(value, 8, 2047))
@ -437,8 +429,7 @@ static struct sk_buff *cfg_set_max_slaves(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value != 0)
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (max secondary nodes fixed at 0)");
@ -451,8 +442,7 @@ static struct sk_buff *cfg_set_netid(void)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value == tipc_net_id)
return tipc_cfg_reply_none();
if (value != delimit(value, 1, 9999))

View File

@ -393,8 +393,7 @@ struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value != delimit(value, 0, 32768))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (log size must be 0-32768)");

View File

@ -66,11 +66,11 @@
*/
struct distr_item {
u32 type;
u32 lower;
u32 upper;
u32 ref;
u32 key;
__be32 type;
__be32 lower;
__be32 upper;
__be32 ref;
__be32 key;
};
/**

View File

@ -597,8 +597,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
domain = *(u32 *)TLV_DATA(req_tlv_area);
domain = ntohl(domain);
domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (!tipc_addr_domain_valid(domain))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (network address)");
@ -642,8 +641,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
domain = *(u32 *)TLV_DATA(req_tlv_area);
domain = ntohl(domain);
domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (!tipc_addr_domain_valid(domain))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (network address)");
@ -664,8 +662,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
/* Add TLV for broadcast link */
link_info.dest = tipc_own_addr & 0xfffff00;
link_info.dest = htonl(link_info.dest);
link_info.dest = htonl(tipc_own_addr & 0xfffff00);
link_info.up = htonl(1);
sprintf(link_info.str, tipc_bclink_name);
tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));