|
From: kosmirror <kos...@us...> - 2025-09-02 06:37:49
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "A pseudo Operating System for the Dreamcast.".
The branch, master has been updated
via 36687707d91a7e99cc2a71b6ffc86f861be5e1d9 (commit)
via e670f29becfa28d289e8651702fe88f579825a23 (commit)
via 2f8991c0157fca007a6335b2aaaccd2820da25d9 (commit)
from 1d3584ab7c0bcdc90a92ef0058a9554cd203d428 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 36687707d91a7e99cc2a71b6ffc86f861be5e1d9
Author: Paul Cercueil <pa...@cr...>
Date: Wed Aug 27 19:14:50 2025 +0200
Deprecate <arch/byteorder.h>
Deprecate the <arch/byteorder.h> header, and all its contents.
Signed-off-by: Paul Cercueil <pa...@cr...>
commit e670f29becfa28d289e8651702fe88f579825a23
Author: Paul Cercueil <pa...@cr...>
Date: Wed Aug 27 15:02:28 2025 +0200
Make htons/htonl/ntohs/ntohl static inline in <arpa/inet.h>
Inline their implementation in <arpa/inet.h> instead of having their
implementation in a different C file.
Signed-off-by: Paul Cercueil <pa...@cr...>
commit 2f8991c0157fca007a6335b2aaaccd2820da25d9
Author: Paul Cercueil <pa...@cr...>
Date: Mon Aug 18 23:16:07 2025 +0200
Drop endian stuff from <arch/types.h>
This is not used anywhere.
The argument to add it was to fix a libtremor build issue; however the
current libtremor in kos-ports will build just fine with those removed.
Signed-off-by: Paul Cercueil <pa...@cr...>
-----------------------------------------------------------------------
Summary of changes:
include/arpa/inet.h | 16 +++++++++----
kernel/arch/dreamcast/include/arch/byteorder.h | 6 +++++
kernel/arch/dreamcast/include/arch/types.h | 10 ---------
kernel/libc/koslib/Makefile | 2 +-
kernel/libc/koslib/byteorder.c | 31 --------------------------
5 files changed, 19 insertions(+), 46 deletions(-)
delete mode 100644 kernel/libc/koslib/byteorder.c
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index 7653b2ad..48b50115 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -40,25 +40,33 @@ __BEGIN_DECLS
\param value The value to convert.
\return value converted to network byte order.
*/
-uint32_t htonl(uint32_t value);
+static inline uint32_t htonl(uint32_t value) {
+ return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? value : __builtin_bswap32(value);
+}
/** \brief Convert a 32-bit value from network byte order to host byte order.
\param value The value to convert.
\return value converted to host byte order.
*/
-uint32_t ntohl(uint32_t value);
+static inline uint32_t ntohl(uint32_t value) {
+ return htonl(value);
+}
/** \brief Convert a 16-bit value from host byte order to network byte order.
\param value The value to convert.
\return value converted to network byte order.
*/
-uint16_t htons(uint16_t value);
+static inline uint16_t htons(uint16_t value) {
+ return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? value : __builtin_bswap16(value);
+}
/** \brief Convert a 16-bit value from network byte order to host byte order.
\param value The value to convert.
\return value converted to host byte order.
*/
-uint16_t ntohs(uint16_t value);
+static inline uint16_t ntohs(uint16_t value) {
+ return htons(value);
+}
/** \brief Convert a string representation of an IPv4 address to an in_addr_t.
diff --git a/kernel/arch/dreamcast/include/arch/byteorder.h b/kernel/arch/dreamcast/include/arch/byteorder.h
index ebfc03d4..2d352621 100644
--- a/kernel/arch/dreamcast/include/arch/byteorder.h
+++ b/kernel/arch/dreamcast/include/arch/byteorder.h
@@ -49,6 +49,7 @@ __BEGIN_DECLS
or equivalent.
\return The swapped value.
*/
+__depr("arch_swap16() is deprecated, use __builtin_bswap16().")
static inline uint16_t arch_swap16(uint16_t x) {
return __builtin_bswap16(x);
}
@@ -62,6 +63,7 @@ static inline uint16_t arch_swap16(uint16_t x) {
or equivalent.
\return The swapped value.
*/
+__depr("arch_swap32() is deprecated, use __builtin_bswap32().")
static inline uint32_t arch_swap32(uint32_t x) {
return __builtin_bswap32(x);
}
@@ -77,6 +79,7 @@ static inline uint32_t arch_swap32(uint32_t x) {
or equivalent.
\return The converted value.
*/
+__depr("arch_ntohs() is deprecated, use ntohs() from <arpa/inet.h>")
static inline uint16_t arch_ntohs(uint16_t x) {
return __builtin_bswap16(x);
}
@@ -92,6 +95,7 @@ static inline uint16_t arch_ntohs(uint16_t x) {
or equivalent.
\return The converted value.
*/
+__depr("arch_ntohl() is deprecated, use ntohl() from <arpa/inet.h>")
static inline uint32_t arch_ntohl(uint32_t x) {
return __builtin_bswap32(x);
}
@@ -107,6 +111,7 @@ static inline uint32_t arch_ntohl(uint32_t x) {
or equivalent.
\return The converted value.
*/
+__depr("arch_htons() is deprecated, use htons() from <arpa/inet.h>")
static inline uint16_t arch_htons(uint16_t x) {
return __builtin_bswap16(x);
}
@@ -122,6 +127,7 @@ static inline uint16_t arch_htons(uint16_t x) {
or equivalent.
\return The converted value.
*/
+__depr("arch_htonl() is deprecated, use htonl() from <arpa/inet.h>")
static inline uint32_t arch_htonl(uint32_t x) {
return __builtin_bswap32(x);
}
diff --git a/kernel/arch/dreamcast/include/arch/types.h b/kernel/arch/dreamcast/include/arch/types.h
index d9065fba..295bc031 100644
--- a/kernel/arch/dreamcast/include/arch/types.h
+++ b/kernel/arch/dreamcast/include/arch/types.h
@@ -57,16 +57,6 @@ typedef int handle_t; /**< \brief Generic "handle" type */
typedef handle_t tid_t; /**< \brief Thread ID type */
typedef handle_t prio_t; /**< \brief Priority value type */
-#ifndef BYTE_ORDER
-/* Make sure to pull in the base endianness defines... */
-#ifndef LITTLE_ENDIAN
-#include <sys/_types.h>
-#endif
-
-/** \brief Endianness definition -- Little Endian */
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
/** @} */
__END_DECLS
diff --git a/kernel/libc/koslib/Makefile b/kernel/libc/koslib/Makefile
index 081d0102..1b39491d 100644
--- a/kernel/libc/koslib/Makefile
+++ b/kernel/libc/koslib/Makefile
@@ -7,7 +7,7 @@
# In here we have pieces of the KOS libc that are either too custom or too
# useful in the context of KOS to go with the Newlib defaults.
-OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \
+OBJS = abort.o memset2.o memset4.o memcpy2.o memcpy4.o \
assert.o dbglog.o malloc.o \
opendir.o readdir.o closedir.o rewinddir.o scandir.o seekdir.o \
telldir.o usleep.o inet_addr.o realpath.o getcwd.o chdir.o mkdir.o \
diff --git a/kernel/libc/koslib/byteorder.c b/kernel/libc/koslib/byteorder.c
deleted file mode 100644
index 3e00a4e9..00000000
--- a/kernel/libc/koslib/byteorder.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* KallistiOS ##version##
-
- byteorder.c
- Copyright (C) 2001 Megan Potter
- Copyright (C) 2016 Lawrence Sebald
-
-*/
-
-/* Byte-order translation functions */
-#include <stdint.h>
-#include <arch/byteorder.h>
-
-/* Network to Host short */
-uint16_t ntohs(uint16_t value) {
- return arch_ntohs(value);
-}
-
-/* Network to Host long */
-uint32_t ntohl(uint32_t value) {
- return arch_ntohl(value);
-}
-
-/* Host to Network short */
-uint16_t htons(uint16_t value) {
- return arch_htons(value);
-}
-
-/* Host to Network long */
-uint32_t htonl(uint32_t value) {
- return arch_htonl(value);
-}
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|