summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormike <mike@FreeBSD.org>2001-08-30 00:04:19 +0000
committermike <mike@FreeBSD.org>2001-08-30 00:04:19 +0000
commita45063618a1d6723c7f698850318bdd8b65f27a0 (patch)
tree2a398220f9e238744c0dfb240b714a2129e1c526 /sys/powerpc
parent77d67fb5682dc550f62559210baf33988ee0f890 (diff)
downloadFreeBSD-src-a45063618a1d6723c7f698850318bdd8b65f27a0.zip
FreeBSD-src-a45063618a1d6723c7f698850318bdd8b65f27a0.tar.gz
o Remove some GCCisms in src/powerpc/include/endian.h.
o Unify <machine/endian.h>'s across all architectures. o Make bswapXX() functions use a different spelling of u_int16_t and friends to reduce namespace pollution. The bswapXX() functions don't actually exist, but we'll probably import these at some point. Atleast one driver (if_de) depends on bswapXX() for big endian cases. o Deprecate byteorder(3) prototypes from <sys/types.h>, these are now prototyped indirectly in <arpa/inet.h>. o Deprecate in_addr_t and in_port_t typedefs in <sys/types.h>, these are now typedef'd in <arpa/inet.h>. o Change byteorder(3) prototypes to use standards compliant uint32_t (spelled __uint32_t to reduce namespace pollution). o Document new preferred headers and standards compliance. Discussed with: bde PR: 29946 Reviewed by: bmilekic
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/include/ansi.h2
-rw-r--r--sys/powerpc/include/endian.h26
2 files changed, 16 insertions, 12 deletions
diff --git a/sys/powerpc/include/ansi.h b/sys/powerpc/include/ansi.h
index a2e3198..733b0d7 100644
--- a/sys/powerpc/include/ansi.h
+++ b/sys/powerpc/include/ansi.h
@@ -48,6 +48,8 @@
*/
#define _BSD_CLOCK_T_ int /* clock() */
#define _BSD_CLOCKID_T_ int /* clockid_t */
+#define _BSD_IN_ADDR_T_ __uint32_t /* inet(3) functions */
+#define _BSD_IN_PORT_T_ __uint16_t
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */
diff --git a/sys/powerpc/include/endian.h b/sys/powerpc/include/endian.h
index e8f11a7..a1f5ce6 100644
--- a/sys/powerpc/include/endian.h
+++ b/sys/powerpc/include/endian.h
@@ -55,17 +55,19 @@
#define BYTE_ORDER BIG_ENDIAN
+#ifndef _KERNEL
#include <sys/cdefs.h>
-#include <sys/types.h>
+#endif
+#include <machine/ansi.h>
__BEGIN_DECLS
-in_addr_t htonl __P((in_addr_t)) __attribute__((__const__));
-in_port_t htons __P((in_port_t)) __attribute__((__const__));
-in_addr_t ntohl __P((in_addr_t)) __attribute__((__const__));
-in_port_t ntohs __P((in_port_t)) __attribute__((__const__));
-u_int16_t bswap16 __P((u_int16_t)) __attribute__((__const__));
-u_int32_t bswap32 __P((u_int32_t)) __attribute__((__const__));
-u_int64_t bswap64 __P((u_int64_t)) __attribute__((__const__));
+__uint32_t htonl __P((__uint32_t));
+__uint16_t htons __P((__uint16_t));
+__uint32_t ntohl __P((__uint32_t));
+__uint16_t ntohs __P((__uint16_t));
+__uint16_t bswap16 __P((__uint16_t));
+__uint32_t bswap32 __P((__uint32_t));
+__uint64_t bswap64 __P((__uint64_t));
__END_DECLS
/*
@@ -84,10 +86,10 @@ __END_DECLS
#else
-#define NTOHL(x) (x) = ntohl((in_addr_t)(x))
-#define NTOHS(x) (x) = ntohs((in_port_t)(x))
-#define HTONL(x) (x) = htonl((in_addr_t)(x))
-#define HTONS(x) (x) = htons((in_port_t)(x))
+#define NTOHL(x) (x) = ntohl((__uint32_t)(x))
+#define NTOHS(x) (x) = ntohs((__uint16_t)(x))
+#define HTONL(x) (x) = htonl((__uint32_t)(x))
+#define HTONS(x) (x) = htons((__uint16_t)(x))
#endif
#endif /* !_POSIX_SOURCE */
OpenPOWER on IntegriCloud