git: 14466e2b9616 - stable/14 - hastd: Use void pointers for opaque data
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Nov 2026 15:12:45 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=14466e2b9616165bae4a34d554842a4a91c31aef
commit 14466e2b9616165bae4a34d554842a4a91c31aef
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-10-20 13:28:42 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-11-05 15:11:58 +0000
hastd: Use void pointers for opaque data
Use void, not char, for pointers to opaque data in our send and receive
functions.
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D60729
(cherry picked from commit a5e6bee5a0bff9e9c12037e0b2c76c4f2ab5e046)
hastd: Fix build failure
Fixes: a5e6bee5a0bf ("hastd: Use void pointers for opaque data")
Reported by: garga@
(cherry picked from commit dff56e8118985248678e1a6916cdefd708a9d85f)
---
sbin/hastd/proto_common.c | 6 +++---
sbin/hastd/proto_impl.h | 8 ++++----
sbin/hastd/proto_socketpair.c | 4 ++--
sbin/hastd/proto_tcp.c | 4 ++--
sbin/hastd/proto_uds.c | 4 ++--
5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/sbin/hastd/proto_common.c b/sbin/hastd/proto_common.c
index 143b7666b7ca..9df6fd7a7ec7 100644
--- a/sbin/hastd/proto_common.c
+++ b/sbin/hastd/proto_common.c
@@ -90,7 +90,7 @@ proto_descriptor_send(int sock, int fd)
}
int
-proto_common_send(int sock, const unsigned char *data, size_t size, int fd)
+proto_common_send(int sock, const void *data, size_t size, int fd)
{
ssize_t done;
size_t sendsize;
@@ -146,7 +146,7 @@ proto_common_send(int sock, const unsigned char *data, size_t size, int fd)
errno = ETIMEDOUT;
return (errno);
}
- data += done;
+ data = (const char *)data + done;
size -= done;
} while (size > 0);
if (errcount > 0) {
@@ -191,7 +191,7 @@ proto_descriptor_recv(int sock, int *fdp)
}
int
-proto_common_recv(int sock, unsigned char *data, size_t size, int *fdp)
+proto_common_recv(int sock, void *data, size_t size, int *fdp)
{
ssize_t done;
diff --git a/sbin/hastd/proto_impl.h b/sbin/hastd/proto_impl.h
index 181a4cd4a17d..449ab4097397 100644
--- a/sbin/hastd/proto_impl.h
+++ b/sbin/hastd/proto_impl.h
@@ -44,8 +44,8 @@ typedef int prt_connect_wait_t(void *, int);
typedef int prt_server_t(const char *, void **);
typedef int prt_accept_t(void *, void **);
typedef int prt_wrap_t(int, bool, void **);
-typedef int prt_send_t(void *, const unsigned char *, size_t, int);
-typedef int prt_recv_t(void *, unsigned char *, size_t, int *);
+typedef int prt_send_t(void *, const void *, size_t, int);
+typedef int prt_recv_t(void *, void *, size_t, int *);
typedef int prt_descriptor_t(const void *);
typedef bool prt_address_match_t(const void *, const char *);
typedef void prt_local_address_t(const void *, char *, size_t);
@@ -72,7 +72,7 @@ struct proto {
void proto_register(struct proto *proto, bool isdefault);
-int proto_common_send(int sock, const unsigned char *data, size_t size, int fd);
-int proto_common_recv(int sock, unsigned char *data, size_t size, int *fdp);
+int proto_common_send(int sock, const void *data, size_t size, int fd);
+int proto_common_recv(int sock, void *data, size_t size, int *fdp);
#endif /* !_PROTO_IMPL_H_ */
diff --git a/sbin/hastd/proto_socketpair.c b/sbin/hastd/proto_socketpair.c
index ac0a86aacdd9..9badb708421d 100644
--- a/sbin/hastd/proto_socketpair.c
+++ b/sbin/hastd/proto_socketpair.c
@@ -83,7 +83,7 @@ sp_client(const char *srcaddr, const char *dstaddr, void **ctxp)
}
static int
-sp_send(void *ctx, const unsigned char *data, size_t size, int fd)
+sp_send(void *ctx, const void *data, size_t size, int fd)
{
struct sp_ctx *spctx = ctx;
int sock;
@@ -122,7 +122,7 @@ sp_send(void *ctx, const unsigned char *data, size_t size, int fd)
}
static int
-sp_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
+sp_recv(void *ctx, void *data, size_t size, int *fdp)
{
struct sp_ctx *spctx = ctx;
int fd;
diff --git a/sbin/hastd/proto_tcp.c b/sbin/hastd/proto_tcp.c
index dc5a23da7b23..adbdd82f33fe 100644
--- a/sbin/hastd/proto_tcp.c
+++ b/sbin/hastd/proto_tcp.c
@@ -480,7 +480,7 @@ tcp_wrap(int fd, bool client, void **ctxp)
}
static int
-tcp_send(void *ctx, const unsigned char *data, size_t size, int fd)
+tcp_send(void *ctx, const void *data, size_t size, int fd)
{
struct tcp_ctx *tctx = ctx;
@@ -493,7 +493,7 @@ tcp_send(void *ctx, const unsigned char *data, size_t size, int fd)
}
static int
-tcp_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
+tcp_recv(void *ctx, void *data, size_t size, int *fdp)
{
struct tcp_ctx *tctx = ctx;
diff --git a/sbin/hastd/proto_uds.c b/sbin/hastd/proto_uds.c
index acb61a360180..5a14eb353c30 100644
--- a/sbin/hastd/proto_uds.c
+++ b/sbin/hastd/proto_uds.c
@@ -227,7 +227,7 @@ uds_accept(void *ctx, void **newctxp)
}
static int
-uds_send(void *ctx, const unsigned char *data, size_t size, int fd)
+uds_send(void *ctx, const void *data, size_t size, int fd)
{
struct uds_ctx *uctx = ctx;
@@ -239,7 +239,7 @@ uds_send(void *ctx, const unsigned char *data, size_t size, int fd)
}
static int
-uds_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
+uds_recv(void *ctx, void *data, size_t size, int *fdp)
{
struct uds_ctx *uctx = ctx;