summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-06-19 17:19:51 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-06-19 17:19:51 +0000
commitca639b0c5f6a4e65b66fe52a73ac00614c6be19f (patch)
treeeb540e2dd5fdf66377b0dc89de5425c52ba4e738 /sbin
parent95292aac0ac0ea5091b8c373577fa9a870c96374 (diff)
Improve the ibuf API by adding these functions:
Functions extending ibuf_add to work with more specific data types ibuf_add_buf, ibuf_add_zero, ibuf_add_n8, ibuf_add_n16, ibuf_add_n32, ibuf_add_n64 Functions replacing ibuf_seek where data at a specific offset is modified ibuf_set, ibuf_set_n8, ibuf_set_n16, ibuf_set_n32, ibuf_set_n64 Functions to check, get and set the filedescriptor stored on the ibuf ibuf_fd_avail, ibuf_fd_get, ibuf_fd_set and ibuf_data() to access the data buffer, to be used together with ibuf_size() On top of this add an optimized imsg_compose_ibuf() where an ibuf is wrapped into an imsg in an efficent way. Finally remove msgbuf_drain since it is not used by anything outside of the ibuf code. Because of this removal bump the major of libutil. Remove ibuf_data() in iked since the same function is now provided by libutil. OK tb@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/iked/iked.h3
-rw-r--r--sbin/iked/imsg_util.c8
2 files changed, 2 insertions, 9 deletions
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h
index 84999630d9f..85958e1c237 100644
--- a/sbin/iked/iked.h
+++ b/sbin/iked/iked.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.h,v 1.217 2023/06/16 10:28:43 tb Exp $ */
+/* $OpenBSD: iked.h,v 1.218 2023/06/19 17:19:50 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -1270,7 +1270,6 @@ struct ibuf *
int ibuf_cat(struct ibuf *, struct ibuf *);
size_t ibuf_length(struct ibuf *);
int ibuf_setsize(struct ibuf *, size_t);
-void *ibuf_data(struct ibuf *);
void *ibuf_getdata(struct ibuf *, size_t);
struct ibuf *
ibuf_get(struct ibuf *, size_t);
diff --git a/sbin/iked/imsg_util.c b/sbin/iked/imsg_util.c
index cf83b5c9848..eab8eea72bc 100644
--- a/sbin/iked/imsg_util.c
+++ b/sbin/iked/imsg_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg_util.c,v 1.18 2023/06/12 09:02:32 claudio Exp $ */
+/* $OpenBSD: imsg_util.c,v 1.19 2023/06/19 17:19:50 claudio Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -84,12 +84,6 @@ ibuf_length(struct ibuf *buf)
}
void *
-ibuf_data(struct ibuf *buf)
-{
- return (ibuf_seek(buf, 0, 0));
-}
-
-void *
ibuf_getdata(struct ibuf *buf, size_t len)
{
void *data;