From bbe404a34aac08502909dc7c15a9c699de9d421c Mon Sep 17 00:00:00 2001 From: dlg Date: Thu, 25 Feb 2021 02:43:31 +0000 Subject: [PATCH] let m_copydata use a void * instead of caddr_t i'm not a fan of having to cast to caddr_t when we have modern inventions like void *s we can take advantage of. ok claudio@ mvs@ bluhm@ --- share/man/man9/mbuf.9 | 8 ++++---- sys/kern/uipc_mbuf.c | 5 +++-- sys/sys/mbuf.h | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index 6d6352f6dba..260de5bd669 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mbuf.9,v 1.121 2021/02/23 14:57:52 mvs Exp $ +.\" $OpenBSD: mbuf.9,v 1.122 2021/02/25 02:43:31 dlg Exp $ .\" .\" Copyright (c) 2001 Jean-Jacques Bernard-Gundol .\" All rights reserved. @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: February 23 2021 $ +.Dd $Mdocdate: February 25 2021 $ .Dt MGET 9 .Os .Sh NAME @@ -116,7 +116,7 @@ .Ft void .Fn m_reclaim "void" .Ft void -.Fn m_copydata "struct mbuf *m" "int off" "int len" "caddr_t cp" +.Fn m_copydata "struct mbuf *m" "int off" "int len" "void *cp" .Ft void .Fn m_cat "struct mbuf *m" "struct mbuf *n" .Ft struct mbuf * @@ -673,7 +673,7 @@ is a pointer, no action occurs. .It Fn m_reclaim "void" Ask protocols to free unused memory space. -.It Fn m_copydata "struct mbuf *m" "int off" "int len" "caddr_t cp" +.It Fn m_copydata "struct mbuf *m" "int off" "int len" "void *cp" Copy data from the mbuf chain pointed to by .Fa m starting at diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 21b1d7279be..5bf8c99f68f 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.277 2021/01/13 12:38:36 bluhm Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.278 2021/02/25 02:43:32 dlg Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -711,8 +711,9 @@ nospace: * continuing for "len" bytes, into the indicated buffer. */ void -m_copydata(struct mbuf *m, int off, int len, caddr_t cp) +m_copydata(struct mbuf *m, int off, int len, void *p) { + caddr_t cp = p; unsigned count; if (off < 0) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 234fdb9db5c..4a590a01e3e 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.251 2020/12/12 11:49:02 jan Exp $ */ +/* $OpenBSD: mbuf.h,v 1.252 2021/02/25 02:43:31 dlg Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -435,7 +435,7 @@ int m_copyback(struct mbuf *, int, int, const void *, int); struct mbuf *m_freem(struct mbuf *); void m_purge(struct mbuf *); void m_reclaim(void *, int); -void m_copydata(struct mbuf *, int, int, caddr_t); +void m_copydata(struct mbuf *, int, int, void *); void m_cat(struct mbuf *, struct mbuf *); struct mbuf *m_devget(char *, int, int); int m_apply(struct mbuf *, int, int, -- 2.20.1