diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-11-27 03:12:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-27 03:12:47 -0500 |
commit | c4106aa88a440430d387e022f2ad6dc1e0d52e98 (patch) | |
tree | 09064e6e767301ca28357ed5125e99123f5beaca /net/decnet/af_decnet.c | |
parent | 5b9ab2ec04ec1e1e53939768805612ac191d7ba2 (diff) |
decnet: remove private wrappers of endian helpers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Reviewed-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/af_decnet.c')
-rw-r--r-- | net/decnet/af_decnet.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 3c23ab33dbc0..cf0e18499297 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -167,7 +167,7 @@ static struct hlist_head *dn_find_list(struct sock *sk) | |||
167 | if (scp->addr.sdn_flags & SDF_WILD) | 167 | if (scp->addr.sdn_flags & SDF_WILD) |
168 | return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL; | 168 | return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL; |
169 | 169 | ||
170 | return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK]; | 170 | return &dn_sk_hash[le16_to_cpu(scp->addrloc) & DN_SK_HASH_MASK]; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* | 173 | /* |
@@ -181,7 +181,7 @@ static int check_port(__le16 port) | |||
181 | if (port == 0) | 181 | if (port == 0) |
182 | return -1; | 182 | return -1; |
183 | 183 | ||
184 | sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(port) & DN_SK_HASH_MASK]) { | 184 | sk_for_each(sk, node, &dn_sk_hash[le16_to_cpu(port) & DN_SK_HASH_MASK]) { |
185 | struct dn_scp *scp = DN_SK(sk); | 185 | struct dn_scp *scp = DN_SK(sk); |
186 | if (scp->addrloc == port) | 186 | if (scp->addrloc == port) |
187 | return -1; | 187 | return -1; |
@@ -195,12 +195,12 @@ static unsigned short port_alloc(struct sock *sk) | |||
195 | static unsigned short port = 0x2000; | 195 | static unsigned short port = 0x2000; |
196 | unsigned short i_port = port; | 196 | unsigned short i_port = port; |
197 | 197 | ||
198 | while(check_port(dn_htons(++port)) != 0) { | 198 | while(check_port(cpu_to_le16(++port)) != 0) { |
199 | if (port == i_port) | 199 | if (port == i_port) |
200 | return 0; | 200 | return 0; |
201 | } | 201 | } |
202 | 202 | ||
203 | scp->addrloc = dn_htons(port); | 203 | scp->addrloc = cpu_to_le16(port); |
204 | 204 | ||
205 | return 1; | 205 | return 1; |
206 | } | 206 | } |
@@ -255,7 +255,7 @@ static struct hlist_head *listen_hash(struct sockaddr_dn *addr) | |||
255 | 255 | ||
256 | if (hash == 0) { | 256 | if (hash == 0) { |
257 | hash = addr->sdn_objnamel; | 257 | hash = addr->sdn_objnamel; |
258 | for(i = 0; i < dn_ntohs(addr->sdn_objnamel); i++) { | 258 | for(i = 0; i < le16_to_cpu(addr->sdn_objnamel); i++) { |
259 | hash ^= addr->sdn_objname[i]; | 259 | hash ^= addr->sdn_objname[i]; |
260 | hash ^= (hash << 3); | 260 | hash ^= (hash << 3); |
261 | } | 261 | } |
@@ -297,16 +297,16 @@ int dn_sockaddr2username(struct sockaddr_dn *sdn, unsigned char *buf, unsigned c | |||
297 | break; | 297 | break; |
298 | case 1: | 298 | case 1: |
299 | *buf++ = 0; | 299 | *buf++ = 0; |
300 | *buf++ = dn_ntohs(sdn->sdn_objnamel); | 300 | *buf++ = le16_to_cpu(sdn->sdn_objnamel); |
301 | memcpy(buf, sdn->sdn_objname, dn_ntohs(sdn->sdn_objnamel)); | 301 | memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel)); |
302 | len = 3 + dn_ntohs(sdn->sdn_objnamel); | 302 | len = 3 + le16_to_cpu(sdn->sdn_objnamel); |
303 | break; | 303 | break; |
304 | case 2: | 304 | case 2: |
305 | memset(buf, 0, 5); | 305 | memset(buf, 0, 5); |
306 | buf += 5; | 306 | buf += 5; |
307 | *buf++ = dn_ntohs(sdn->sdn_objnamel); | 307 | *buf++ = le16_to_cpu(sdn->sdn_objnamel); |
308 | memcpy(buf, sdn->sdn_objname, dn_ntohs(sdn->sdn_objnamel)); | 308 | memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel)); |
309 | len = 7 + dn_ntohs(sdn->sdn_objnamel); | 309 | len = 7 + le16_to_cpu(sdn->sdn_objnamel); |
310 | break; | 310 | break; |
311 | } | 311 | } |
312 | 312 | ||
@@ -327,7 +327,7 @@ int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *sdn, | |||
327 | int namel = 12; | 327 | int namel = 12; |
328 | 328 | ||
329 | sdn->sdn_objnum = 0; | 329 | sdn->sdn_objnum = 0; |
330 | sdn->sdn_objnamel = dn_htons(0); | 330 | sdn->sdn_objnamel = cpu_to_le16(0); |
331 | memset(sdn->sdn_objname, 0, DN_MAXOBJL); | 331 | memset(sdn->sdn_objname, 0, DN_MAXOBJL); |
332 | 332 | ||
333 | if (len < 2) | 333 | if (len < 2) |
@@ -361,13 +361,13 @@ int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *sdn, | |||
361 | if (len < 0) | 361 | if (len < 0) |
362 | return -1; | 362 | return -1; |
363 | 363 | ||
364 | sdn->sdn_objnamel = dn_htons(*data++); | 364 | sdn->sdn_objnamel = cpu_to_le16(*data++); |
365 | len -= dn_ntohs(sdn->sdn_objnamel); | 365 | len -= le16_to_cpu(sdn->sdn_objnamel); |
366 | 366 | ||
367 | if ((len < 0) || (dn_ntohs(sdn->sdn_objnamel) > namel)) | 367 | if ((len < 0) || (le16_to_cpu(sdn->sdn_objnamel) > namel)) |
368 | return -1; | 368 | return -1; |
369 | 369 | ||
370 | memcpy(sdn->sdn_objname, data, dn_ntohs(sdn->sdn_objnamel)); | 370 | memcpy(sdn->sdn_objname, data, le16_to_cpu(sdn->sdn_objnamel)); |
371 | 371 | ||
372 | return size - len; | 372 | return size - len; |
373 | } | 373 | } |
@@ -391,7 +391,7 @@ struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr) | |||
391 | continue; | 391 | continue; |
392 | if (scp->addr.sdn_objnamel != addr->sdn_objnamel) | 392 | if (scp->addr.sdn_objnamel != addr->sdn_objnamel) |
393 | continue; | 393 | continue; |
394 | if (memcmp(scp->addr.sdn_objname, addr->sdn_objname, dn_ntohs(addr->sdn_objnamel)) != 0) | 394 | if (memcmp(scp->addr.sdn_objname, addr->sdn_objname, le16_to_cpu(addr->sdn_objnamel)) != 0) |
395 | continue; | 395 | continue; |
396 | } | 396 | } |
397 | sock_hold(sk); | 397 | sock_hold(sk); |
@@ -419,7 +419,7 @@ struct sock *dn_find_by_skb(struct sk_buff *skb) | |||
419 | struct dn_scp *scp; | 419 | struct dn_scp *scp; |
420 | 420 | ||
421 | read_lock(&dn_hash_lock); | 421 | read_lock(&dn_hash_lock); |
422 | sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(cb->dst_port) & DN_SK_HASH_MASK]) { | 422 | sk_for_each(sk, node, &dn_sk_hash[le16_to_cpu(cb->dst_port) & DN_SK_HASH_MASK]) { |
423 | scp = DN_SK(sk); | 423 | scp = DN_SK(sk); |
424 | if (cb->src != dn_saddr2dn(&scp->peer)) | 424 | if (cb->src != dn_saddr2dn(&scp->peer)) |
425 | continue; | 425 | continue; |
@@ -734,10 +734,10 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
734 | if (saddr->sdn_family != AF_DECnet) | 734 | if (saddr->sdn_family != AF_DECnet) |
735 | return -EINVAL; | 735 | return -EINVAL; |
736 | 736 | ||
737 | if (dn_ntohs(saddr->sdn_nodeaddrl) && (dn_ntohs(saddr->sdn_nodeaddrl) != 2)) | 737 | if (le16_to_cpu(saddr->sdn_nodeaddrl) && (le16_to_cpu(saddr->sdn_nodeaddrl) != 2)) |
738 | return -EINVAL; | 738 | return -EINVAL; |
739 | 739 | ||
740 | if (dn_ntohs(saddr->sdn_objnamel) > DN_MAXOBJL) | 740 | if (le16_to_cpu(saddr->sdn_objnamel) > DN_MAXOBJL) |
741 | return -EINVAL; | 741 | return -EINVAL; |
742 | 742 | ||
743 | if (saddr->sdn_flags & ~SDF_WILD) | 743 | if (saddr->sdn_flags & ~SDF_WILD) |
@@ -748,7 +748,7 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
748 | return -EACCES; | 748 | return -EACCES; |
749 | 749 | ||
750 | if (!(saddr->sdn_flags & SDF_WILD)) { | 750 | if (!(saddr->sdn_flags & SDF_WILD)) { |
751 | if (dn_ntohs(saddr->sdn_nodeaddrl)) { | 751 | if (le16_to_cpu(saddr->sdn_nodeaddrl)) { |
752 | read_lock(&dev_base_lock); | 752 | read_lock(&dev_base_lock); |
753 | ldev = NULL; | 753 | ldev = NULL; |
754 | for_each_netdev(&init_net, dev) { | 754 | for_each_netdev(&init_net, dev) { |
@@ -799,15 +799,15 @@ static int dn_auto_bind(struct socket *sock) | |||
799 | if ((scp->accessdata.acc_accl != 0) && | 799 | if ((scp->accessdata.acc_accl != 0) && |
800 | (scp->accessdata.acc_accl <= 12)) { | 800 | (scp->accessdata.acc_accl <= 12)) { |
801 | 801 | ||
802 | scp->addr.sdn_objnamel = dn_htons(scp->accessdata.acc_accl); | 802 | scp->addr.sdn_objnamel = cpu_to_le16(scp->accessdata.acc_accl); |
803 | memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, dn_ntohs(scp->addr.sdn_objnamel)); | 803 | memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, le16_to_cpu(scp->addr.sdn_objnamel)); |
804 | 804 | ||
805 | scp->accessdata.acc_accl = 0; | 805 | scp->accessdata.acc_accl = 0; |
806 | memset(scp->accessdata.acc_acc, 0, 40); | 806 | memset(scp->accessdata.acc_acc, 0, 40); |
807 | } | 807 | } |
808 | /* End of compatibility stuff */ | 808 | /* End of compatibility stuff */ |
809 | 809 | ||
810 | scp->addr.sdn_add.a_len = dn_htons(2); | 810 | scp->addr.sdn_add.a_len = cpu_to_le16(2); |
811 | rv = dn_dev_bind_default((__le16 *)scp->addr.sdn_add.a_addr); | 811 | rv = dn_dev_bind_default((__le16 *)scp->addr.sdn_add.a_addr); |
812 | if (rv == 0) { | 812 | if (rv == 0) { |
813 | rv = dn_hash_sock(sk); | 813 | rv = dn_hash_sock(sk); |
@@ -1027,7 +1027,7 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) | |||
1027 | u16 len = *ptr++; /* yes, it's 8bit on the wire */ | 1027 | u16 len = *ptr++; /* yes, it's 8bit on the wire */ |
1028 | 1028 | ||
1029 | BUG_ON(len > 16); /* we've checked the contents earlier */ | 1029 | BUG_ON(len > 16); /* we've checked the contents earlier */ |
1030 | opt->opt_optl = dn_htons(len); | 1030 | opt->opt_optl = cpu_to_le16(len); |
1031 | opt->opt_status = 0; | 1031 | opt->opt_status = 0; |
1032 | memcpy(opt->opt_data, ptr, len); | 1032 | memcpy(opt->opt_data, ptr, len); |
1033 | skb_pull(skb, len + 1); | 1033 | skb_pull(skb, len + 1); |
@@ -1375,7 +1375,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us | |||
1375 | if (optlen != sizeof(struct optdata_dn)) | 1375 | if (optlen != sizeof(struct optdata_dn)) |
1376 | return -EINVAL; | 1376 | return -EINVAL; |
1377 | 1377 | ||
1378 | if (dn_ntohs(u.opt.opt_optl) > 16) | 1378 | if (le16_to_cpu(u.opt.opt_optl) > 16) |
1379 | return -EINVAL; | 1379 | return -EINVAL; |
1380 | 1380 | ||
1381 | memcpy(&scp->conndata_out, &u.opt, optlen); | 1381 | memcpy(&scp->conndata_out, &u.opt, optlen); |
@@ -1388,7 +1388,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us | |||
1388 | if (optlen != sizeof(struct optdata_dn)) | 1388 | if (optlen != sizeof(struct optdata_dn)) |
1389 | return -EINVAL; | 1389 | return -EINVAL; |
1390 | 1390 | ||
1391 | if (dn_ntohs(u.opt.opt_optl) > 16) | 1391 | if (le16_to_cpu(u.opt.opt_optl) > 16) |
1392 | return -EINVAL; | 1392 | return -EINVAL; |
1393 | 1393 | ||
1394 | memcpy(&scp->discdata_out, &u.opt, optlen); | 1394 | memcpy(&scp->discdata_out, &u.opt, optlen); |
@@ -2213,12 +2213,12 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf) | |||
2213 | { | 2213 | { |
2214 | int i; | 2214 | int i; |
2215 | 2215 | ||
2216 | switch (dn_ntohs(dn->sdn_objnamel)) { | 2216 | switch (le16_to_cpu(dn->sdn_objnamel)) { |
2217 | case 0: | 2217 | case 0: |
2218 | sprintf(buf, "%d", dn->sdn_objnum); | 2218 | sprintf(buf, "%d", dn->sdn_objnum); |
2219 | break; | 2219 | break; |
2220 | default: | 2220 | default: |
2221 | for (i = 0; i < dn_ntohs(dn->sdn_objnamel); i++) { | 2221 | for (i = 0; i < le16_to_cpu(dn->sdn_objnamel); i++) { |
2222 | buf[i] = dn->sdn_objname[i]; | 2222 | buf[i] = dn->sdn_objname[i]; |
2223 | if (IS_NOT_PRINTABLE(buf[i])) | 2223 | if (IS_NOT_PRINTABLE(buf[i])) |
2224 | buf[i] = '.'; | 2224 | buf[i] = '.'; |
@@ -2281,7 +2281,7 @@ static inline void dn_socket_format_entry(struct seq_file *seq, struct sock *sk) | |||
2281 | seq_printf(seq, | 2281 | seq_printf(seq, |
2282 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s " | 2282 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s " |
2283 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s %4s %s\n", | 2283 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s %4s %s\n", |
2284 | dn_addr2asc(dn_ntohs(dn_saddr2dn(&scp->addr)), buf1), | 2284 | dn_addr2asc(le16_to_cpu(dn_saddr2dn(&scp->addr)), buf1), |
2285 | scp->addrloc, | 2285 | scp->addrloc, |
2286 | scp->numdat, | 2286 | scp->numdat, |
2287 | scp->numoth, | 2287 | scp->numoth, |
@@ -2289,7 +2289,7 @@ static inline void dn_socket_format_entry(struct seq_file *seq, struct sock *sk) | |||
2289 | scp->ackxmt_oth, | 2289 | scp->ackxmt_oth, |
2290 | scp->flowloc_sw, | 2290 | scp->flowloc_sw, |
2291 | local_object, | 2291 | local_object, |
2292 | dn_addr2asc(dn_ntohs(dn_saddr2dn(&scp->peer)), buf2), | 2292 | dn_addr2asc(le16_to_cpu(dn_saddr2dn(&scp->peer)), buf2), |
2293 | scp->addrrem, | 2293 | scp->addrrem, |
2294 | scp->numdat_rcv, | 2294 | scp->numdat_rcv, |
2295 | scp->numoth_rcv, | 2295 | scp->numoth_rcv, |