]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[TIPC]: endianness annotations
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 8 Nov 2006 08:19:09 +0000 (00:19 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:21:08 +0000 (21:21 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/tipc_config.h
include/net/tipc/tipc_bearer.h
include/net/tipc/tipc_msg.h
net/tipc/config.c
net/tipc/dbg.c
net/tipc/name_distr.c
net/tipc/node.c

index 33a653913d942fa35c263edf1d019f36f4e0f5b1..b0c916d1f37508f817ef52dba253d3f939391fb0 100644 (file)
 
 
 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 */
 };
 
index e07136d74c2f7805d363e9529a4ef10a9b62caa2..2151a80cdf30cfa1214f72eed61b8b1095e785b7 100644 (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
index 4d096eebc93f96b51588b6177a8ceebdc8a8a4d5..fb42eb7a86a55dc41fa0556059551012e9b46aca 100644 (file)
@@ -40,7 +40,7 @@
 #ifdef __KERNEL__
 
 struct tipc_msg {
-       u32 hdr[15];
+       __be32 hdr[15];
 };
 
 
index ed1351ed05e10ab651f9aa388a21f2c6460d5c9c..458a2c46cef3d5a022947fbe85350bacdda17317 100644 (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))
index d8af4c28695d21202aeeb4a3ce155c1b46a780c1..627f99b7afdfbcc637bc0eca6f4cf1bc8badfcd6 100644 (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)");
index 03bd659c43ca5901d7941508c8d4d2a03e247d68..7bf87cb26ef3e0dbf072f760d112052646e9f357 100644 (file)
  */
 
 struct distr_item {
-       u32 type;
-       u32 lower;
-       u32 upper;
-       u32 ref;
-       u32 key;
+       __be32 type;
+       __be32 lower;
+       __be32 upper;
+       __be32 ref;
+       __be32 key;
 };
 
 /**
index 886bda5e88dbfc0939a9da349effb352453cdc47..106cd0dfac78b3d1637a2590ba3d616a69431c1f 100644 (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));